Skip to content

Instantly share code, notes, and snippets.

@p3nj
Created December 22, 2025 06:06
Show Gist options
  • Select an option

  • Save p3nj/c5968a343666a3537793cd8b78f4c10e to your computer and use it in GitHub Desktop.

Select an option

Save p3nj/c5968a343666a3537793cd8b78f4c10e to your computer and use it in GitHub Desktop.
Fix AMXModX & Metamod failing to load on modern Linux. Clear executable stack flags with execstack -c.

Fix AMXModX & Metamod Loading on Modern Linux

Problem

When trying to load AMXModX and Metamod (e.g., from KZRU LAN server packages) on modern Linux distributions, the game crashes or fails to load the plugins with errors like:

dlopen failed: cannot enable executable stack

Or the modules simply refuse to load with no clear error message.

Cause

Modern Linux kernels and distributions have security hardening that prevents loading shared libraries with executable stack flags (GNU_STACK marked as RWE). This is a security feature to prevent certain types of exploits.

The AMXModX and Metamod .so files from older packages (like KZRU LAN server) were compiled with executable stack enabled, which modern Linux now blocks by default.

Solution

Clear the executable stack flag from the affected .so files using execstack.

Prerequisites

Install execstack:

# Fedora
sudo dnf install execstack

# Arch Linux (from AUR)
yay -S execstack

# Ubuntu/Debian
sudo apt install execstack

# openSUSE
sudo zypper install execstack

Fix Steps

Navigate to your cstrike addons directory and clear the flags:

cd ~/.local/share/Steam/steamapps/common/Half-Life/cstrike/addons/

# Clear executable stack flag from Metamod
execstack -c metamod/metamod.so

# Clear executable stack flag from AMXModX
execstack -c amxmodx/dlls/amxmodx_mm_i386.so

Verify the Fix

Check that the executable stack flag has been cleared:

# Check Metamod
execstack -q metamod/metamod.so
# Should show: - metamod/metamod.so (the "-" means no executable stack)

# Check AMXModX
execstack -q amxmodx/dlls/amxmodx_mm_i386.so
# Should show: - amxmodx/dlls/amxmodx_mm_i386.so

If you see X instead of -, the flag is still set and needs to be cleared.

Batch Fix All .so Files

If you have multiple plugins, you can clear all of them at once:

cd ~/.local/share/Steam/steamapps/common/Half-Life/cstrike/addons/

# Find and fix all .so files
find . -name "*.so" -exec execstack -c {} \;

# Verify all are fixed
find . -name "*.so" -exec execstack -q {} \;

Understanding the Flags

When running execstack -q:

  • - = No executable stack (safe, will load on modern Linux)
  • X = Executable stack enabled (will be blocked by modern Linux)

Why This Happens

The AMXModX JIT (Just-In-Time) compiler historically required executable stack for generating and executing Pawn bytecode at runtime. While newer versions of AMXModX may have fixed this, older packages (especially KZRU LAN server packages) still have the legacy flag set.

Alternative: Disable SELinux/Security Temporarily (Not Recommended)

You could disable the security check, but this is not recommended as it weakens your system security:

# DON'T DO THIS - shown for educational purposes only
sudo setsebool -P allow_execstack 1

The execstack -c method is the proper fix that maintains system security.

Common File Locations

Plugin File Path
Metamod cstrike/addons/metamod/metamod.so
AMXModX cstrike/addons/amxmodx/dlls/amxmodx_mm_i386.so
Reunion cstrike/addons/reunion/reunion_mm_i386.so
ReHLDS cstrike/addons/rehlds/...
Dproto cstrike/addons/dproto/dproto_i386.so

Tested On

  • Fedora 43 (Kernel 6.17)
  • Should work on any modern Linux distribution with execstack available

References


Last updated: December 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment