[BUG] - Steam user namespace error when launching modded games on Linux
Describe the bug When launching modded games through r2modman on Linux, an error appears stating: "Steam now requires user namespaces to be enabled. This requirement is the same as for Flatpak, which has more detailed information available: https://github.com/flatpak/flatpak/wiki/User-namespace-requirements"
This error prevents games from launching, even when the kernel settings for user namespaces are correctly configured (kernel.unprivileged_userns_clone=1 and user.max_user_namespaces set to a high value).
To Reproduce Steps to reproduce the behavior:
- Install r2modman v3.1.57 AppImage on Linux (Ubuntu/Debian-based)
- Launch r2modman and set up a profile for a Steam game
- Install mods for the game
- Click "Start modded" or "Launch modded"
- See error message about user namespaces
Expected behavior The modded game should launch without errors about user namespaces.
Screenshots
Additional context This issue occurs because Steam requires specific environment variables and permissions to properly utilize user namespaces when launched through r2modman. The kernel settings by themselves are not sufficient.
Solution
Create a custom launcher script for r2modman:
- Create a launcher script at
/usr/local/bin/r2modman-launcher.sh:
#!/bin/bash
# Ensure user namespaces are enabled
if [ "$(sysctl -n kernel.unprivileged_userns_clone)" != "1" ]; then
echo "Enabling unprivileged user namespaces..."
pkexec sysctl -w kernel.unprivileged_userns_clone=1
fi
# Set environment variables that help with namespace compatibility
export STEAM_RUNTIME_PREFER_HOST_LIBRARIES=0
export STEAM_RUNTIME=1
# Tell r2modman to use these variables when launching games
export PRESSURE_VESSEL_ENABLED=1
export STEAM_NAMESPACE_FORCE=1
export PROTON_NAMESPACES=1
# Launch r2modman
exec ~/.local/bin/r2modman-3.1.57.AppImage "$@"
-
Make it executable with
chmod +x /usr/local/bin/r2modman-launcher.sh -
Update the r2modman desktop file to use this launcher instead of directly calling the AppImage
-
Create a system-wide configuration to ensure user namespaces are always enabled:
echo "kernel.unprivileged_userns_clone=1" | sudo tee /etc/sysctl.d/10-user-namespaces.conf
sudo sysctl -p /etc/sysctl.d/10-user-namespaces.conf
It would be helpful if r2modman could include these Steam environment settings by default when launching games on Linux, to avoid the user namespace issues without requiring manual configuration.