You start hlds_run and it dies immediately with:
error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
The library is almost certainly installed — but the 32-bit copy the server needs is not. HLDS, ReHLDS, Metamod and the game DLL are all 32-bit binaries, and on a modern 64-bit Linux host the i386 versions of their dependencies are not present by default. This is the most common first-boot error on a fresh server. Here is the fix.
1. Confirm the binary is 32-bit
Verify what you are actually running:
file hlds_linux
It should report ELF 32-bit LSB executable, Intel 80386. A 32-bit binary needs 32-bit (:i386) libraries; the 64-bit libstdc++.so.6 already on your system does not satisfy it, which is why the file "exists" yet is "not found" for this process. The two builds install side by side — the 64-bit copy lives in /usr/lib/x86_64-linux-gnu/ and the 32-bit copy in /usr/lib/i386-linux-gnu/ — and a 32-bit process only ever looks at the latter. Having one does not give you the other.
2. Enable the i386 architecture and update
On Debian/Ubuntu, tell dpkg it may install i386 packages, then refresh:
sudo dpkg --add-architecture i386 sudo apt-get update
Without --add-architecture i386, the i386 packages are not even installable and the next step fails to find them.
3. Install the 32-bit runtime
Install the core 32-bit libraries the server stack needs:
sudo apt-get install -y libstdc++6:i386 libc6:i386 lib32gcc-s1 libncurses5:i386
On RHEL/CentOS/AlmaLinux the equivalent is the .i686 packages:
sudo dnf install -y libstdc++.i686 glibc.i686 libgcc.i686
The :i386 / .i686 suffix is the whole point — it pulls the 32-bit build alongside the 64-bit one, and the loader then finds libstdc++.so.6 for a 32-bit process.
4. Use ldd to find every missing dependency
Do not fix one library and rediscover the next by trial and error. Ask the loader what is missing:
ldd hlds_linux ldd cstrike/dlls/cs.so
Any line ending in => not found is a dependency you still lack. Each corresponds to an :i386 package — install it and re-run ldd until nothing reports not found. Run ldd on the game DLL and on Metamod too, since a metamod.so load failure and a cs.so load failure are frequently the same missing-32-bit-lib problem seen from a different binary.
5. Point LD_LIBRARY_PATH at bundled libraries if needed
Some server packages ship their own copies of certain libraries in the install directory. If a needed library only exists there, tell the loader to look:
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./hlds_run -game cstrike -console +map de_dust2
This is also how the AMXX compiler image resolves its 32-bit amxxpc dependencies. Prefer installing the proper system package where one exists; use LD_LIBRARY_PATH only for libraries genuinely bundled with the server and not available as a package.
6. Make it stick under systemd or Docker
A fix that works in your interactive shell but not when the server runs as a service almost always comes down to environment. A systemd unit does not inherit your login shell's LD_LIBRARY_PATH, so set it in the unit itself:
[Service] WorkingDirectory=/home/cs/hlds Environment=LD_LIBRARY_PATH=/home/cs/hlds:. ExecStart=/home/cs/hlds/hlds_run -game cstrike -console +map de_dust2 +maxplayers 20
For a container, install the :i386 packages in the image build so every rebuild has them — do not install them into a running container, since that change is lost on the next docker compose up --build. Baking the dependency into the Dockerfile is what stops the container exiting immediately on a fresh host.
Common errors
libstdc++.so.6: cannot open shared object file— the 32-bit lib is missing. Installlibstdc++6:i386.libc6:i386won't install / not found — you skippeddpkg --add-architecture i386thenapt-get update.- Fixed one lib, now another is missing — run
lddand install everynot foundat once. ./hlds_linux: No such file or directoryon a file that exists — the 32-bit loader/libs are missing entirely; same fix.- Works from one shell, fails from a service — the service unit lacks your
LD_LIBRARY_PATH; set it in the unit file.
Verification
Re-run the dependency check and confirm nothing is missing:
ldd hlds_linux | grep -i 'not found'
No output means every dependency resolves. Then start the server in the foreground and confirm it reaches a map instead of dying at load:
./hlds_run -game cstrike -console +map de_dust2
A clean boot past the shared-library stage means the 32-bit runtime is complete. If a container keeps exiting at this stage, fold these packages into the image build — see the Docker exits-immediately fix.









