Skip to content

How to fix an HLDS segmentation fault on a CS 1.6 server

A segmentation fault means the server crashed, most often inside a Metamod plugin, an AMX Mod X module or a plugin. How to get a backtrace, read it and fix the cause.

Audience
For experienced admins
Last checked
Steps
8
Reading time
5 min
On Hostsrc
Includes the steps for a Hostsrc server

A segmentation fault means the server process tried to use memory it shouldn't, and Linux stopped it. On HLDS and ReHLDS the console shows lines like these, and hlds_run starts the server again 10 seconds later. The line number depends on your copy of hlds_run.

./hlds_run: line 275: 12345 Segmentation fault      $HL_CMDAdd "-debug" to the ./hlds_run command line to generate a debug.log to help with solving this problemSat Oct 24 18:02:11 UTC 2026: Server restart in 10 seconds

The crash is rarely in the engine itself. Most come from something loaded into it: a Metamod plugin, an AMX Mod X module or plugin, or files built for another engine or game version. Find which one with a backtrace and the logs, then update, fix or remove it.

On Hostsrc

New servers install with xHLDS. On a crash it writes a crash report and one console line with what crashed, the map and the uptime, then restarts as before. Step 8 covers the report.

Before you start

  • Access to the server's console and files.
  • On your own Linux server, for a backtrace: gdb installed, and core files allowed in the shell that starts the server (ulimit -c unlimited).

Steps

  1. Step 1: Note when it crashes

    Write down what happened just before each crash: a map change, a player joining, a round start, a command. A crash at the same moment every time points at the plugin, map or command that runs then. A crash at start-up points at something that loads at start.

  2. Step 2: Read the last lines before the crash

    Read the end of the console output and the newest logs. The server's own logs are in cstrike/logs/. AMX Mod X writes its errors to cstrike/addons/amxmodx/logs/error_YYYYMMDD.log, one file a day, such as error_20261024.log.

    The last plugin, map or file named before the crash is the first suspect.

  3. Step 3: Get a backtrace

    A backtrace lists the functions the server was in when it crashed, with the file each one belongs to. On your own Linux server, add -debug to the hlds_run line. After the next crash, hlds_run runs gdb on the core file and writes the backtrace to debug.log in the server folder.

    hlds_run only finds a core file named core, core.<pid> or hlds_linux.core in the server folder. Many Linux systems send core files to systemd-coredump instead. Then open the last one with coredumpctl gdb and type bt.

    Shell
    ulimit -c unlimited./hlds_run -game cstrike -debug +maxplayers 32 +map de_dust2
  4. Step 4: Read which file crashed

    Start at the top of the backtrace. Skip system libraries such as libc.so.6 and libstdc++.so.6, and look at the first line that names a server file. The table What the backtrace names, below the steps, says what each file means.

    A crash inside amxmodx_mm_i386.so is usually a plugin, not AMX Mod X itself. The plugin crash guide shows how to find which one.

  5. Step 5: Check the Metamod plugins

    Type meta list in the server console. Every plugin should show RUN. A plugin that failed to load, or one you don't recognise, is a suspect.

    Some Metamod plugins must sit at a set place in addons/metamod/plugins.ini, and their readme says where. To test one, put ; in front of its line and restart the server.

    cstrike/addons/metamod/plugins.ini
    linux addons/amxmodx/dlls/amxmodx_mm_i386.so; linux addons/example/example_mm_i386.so
  6. Step 6: Check that everything matches your engine

    Modules and Metamod plugins are built for a certain engine and game library. ReAPI and Metamod-R need ReHLDS. ReHLDS needs the pre-anniversary HLDS from SteamCMD's steam_legacy branch. After you update any of these, update the others to versions that match.

    Run version in the server console to see the engine and its version. A module built for a newer engine than yours can crash the server as soon as it loads.

  7. Step 7: Turn plugins off by halves

    If the backtrace points at AMX Mod X, put ; in front of half the custom plugins in plugins.ini, change the map and wait as long as a crash usually takes. If the crashes stop, the plugin is in the half you turned off; if not, it is in the other half. Repeat with that half until one plugin is left.

    cstrike/addons/amxmodx/configs/plugins.ini
    ; Custom plugins, half turned off for the testplugin_one.amxxplugin_two.amxx;plugin_three.amxx;plugin_four.amxx
  8. Step 8: On xHLDS: read the crash report

    On a crash, xHLDS writes a crash report and one console line: what crashed, the map and the uptime. After the restart, the report goes to Hostsrc's crash service at crash.hostsrc.com. On Hostsrc's network that always happens. Elsewhere it happens only when xhlds_crash_owner lists your SteamID64 in server.cfg. Without it, nothing leaves the machine.

    The crash page says where the crash happened, such as xHLDS, the game, Metamod, AMX Mod X, a plugin or module, Steam or a system library, and what to do. AMX Mod X plugins are named. Signing in to the crash service is open to invited beta testers for now.

    cstrike/server.cfg
    xhlds_crash_owner "76561198000000001"

What the backtrace names

The first server file in the backtrace, after the system libraries, and where to look next. File names are the Linux ones.
File in the backtraceWhat crashedWhat to do
amxmodx_mm_i386.soAMX Mod X, most often while running a pluginFind the plugin: error log, debug mode, turning plugins off by halves
<name>_amxx_i386.soAn AMX Mod X module, such as hamsandwich_amxx_i386.soUpdate the module, or the plugin that calls it
metamod.so or metamod_i386.soMetamod, or a Metamod plugin through itmeta list, then test plugins one by one
<name>_mm_i386.soA Metamod pluginUpdate it or turn it off in addons/metamod/plugins.ini
cs.soThe game library, Counter-Strike or ReGameDLL_CSCheck it matches your engine. A plugin may be calling it wrongly
engine_i486.soThe engineUpdate to the newest release of your engine, then report it to that project with the backtrace
libc.so.6 and other system libraries onlyA system library, called from a line further downRead down to the first server file

Troubleshooting

The console says "Killed", not "Segmentation fault"

The system stopped the server, usually because it ran out of memory. A plugin that keeps allocating memory grows until it reaches the limit. Watch the server's memory use over a few maps. On Hostsrc every plan has 2 GB RAM, and more is an add-on (+512 MB for €1/month).

"error while loading shared libraries" at start-up

A system library is missing, and the server never starts. HLDS is a 32-bit program, so a 64-bit Linux system needs the 32-bit libraries, such as lib32gcc-s1 on Debian and Ubuntu. Install the package that provides the file the line names.

It crashes only on one map

The map may be damaged, or need files the server doesn't have. Take it out of mapcycle.txt, then load it alone with changelevel on an empty server. On ReHLDS and xHLDS, rescount shows how close the map's files are to the engine's precache limits.

The server stops with "Host_Error" instead

A Host_Error is the engine stopping on purpose, and the rest of the line gives the reason, such as a precache limit or a missing file. Fix what it names. It isn't a segmentation fault, so a backtrace won't help.

Will switching to ReHLDS or xHLDS fix it?

Only if the crash is in the engine, which the backtrace shows as engine_i486.so. A plugin or module bug crashes any engine. On xHLDS, the crash report names where it happened, so the plugin is quicker to find.