Skip to main content

Prepare an Ubuntu Server host

Use Ubuntu Server 22.04 LTS or a newer LTS release. This guide explains how to prepare an Ubuntu Server host to run Steam Headless.

1. System Baseline Verification​

Verify that your Ubuntu Server installation meets the minimum kernel version (≥ 5.6) and uses unified cgroups v2:

uname -r
stat -fc %T /sys/fs/cgroup
  • Kernel: Ubuntu Server 24.04 defaults to Linux 6.8+, and Ubuntu Server 22.04 defaults to Linux 5.15+. Both satisfy the pidfd_getfd system call requirement.
  • cgroups: The output of stat must return cgroup2fs.

2. Install Docker Engine​

Install Docker Engine from Docker's official Ubuntu APT repository. Steam Headless needs Docker Engine 28.0.0 or higher for the writable-cgroups=true option.

Avoid Ubuntu Server snap Docker

Do not install Docker via Ubuntu Server snap (sudo snap install docker). Snap's strict confinement sandbox prevents the container from accessing host GPU render nodes, creating private cgroups, and mounting virtual input devices. Always install Docker's official .deb packages from its APT repository.

Step 2.1: Register the Official Docker APT Repository​

Install the required prerequisites and download Docker's official GPG signing key:

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 2.2: Install Docker Packages​

Update your package index and install Docker Engine, containerd, and the Compose plugin:

sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

Step 2.3: Enable and Verify Docker​

Enable and start the Docker daemon:

sudo systemctl enable --now docker

Verify that Docker is running:

sudo docker ps

You should see a table of running containers without an error.


3. Kernel Device Nodes (uinput, uhid, fuse)​

Steam Headless requires three kernel device nodes to emulate gaming input devices and handle user-space filesystems:

  • uinput: Virtual keyboard, pointer, and basic gamepad creation.
  • uhid: User-space HID controller emulation for virtual Xbox and PlayStation controllers.
  • fuse: Filesystem in Userspace for AppImages and game launcher utilities.

Modern Ubuntu Server installations automatically manage static device nodes and on-demand module loading via systemd-udevd.

Confirm that the device nodes are present:

ls -l /dev/uinput /dev/uhid /dev/fuse
  • Expected output: All three paths should be present as character devices.

If any path is missing, load its module and check again:

sudo modprobe uinput
sudo modprobe uhid
sudo modprobe fuse
ls -l /dev/uinput /dev/uhid /dev/fuse

If that fixed the problem, load the modules automatically after every restart:

printf '%s\n' uinput uhid fuse | sudo tee /etc/modules-load.d/steam-headless-devices.conf >/dev/null

Steam Headless includes its own input service. Do not install a separate host input broker, and do not add host /dev/input or /run/udev mounts to your container. Those paths are intentionally kept private so one gaming desktop cannot see another desktop's input devices.


4. Kernel Resource Limits (Inotify & Memory Map Capacity)​

Desktop applications, browser sessions, and Steam client processes watch hundreds of files, while modern 3D game engines allocate thousands of distinct virtual memory areas via Proton. Standard Ubuntu Server quotas (128 inotify instances and 65,530 memory maps on Ubuntu Server 22.04 LTS) will rapidly exhaust, causing container services and games to crash.

Step 4.1: Persist Kernel Tuning​

Create /etc/sysctl.d/90-steam-headless.conf with the standard 1,024-instance default (recommended for up to three concurrent Steam Headless containers) and Valve's SteamOS baseline of 1,048,576 memory mappings. If you plan to run four or more containers, choose a higher value from the inotify sizing table.

cat <<'EOF' | sudo tee /etc/sysctl.d/90-steam-headless.conf >/dev/null
fs.inotify.max_user_instances = 1024
vm.max_map_count = 1048576
EOF

Step 4.2: Apply Configuration​

Apply the settings across your host:

sudo sysctl --system

Verify that the active values match:

sysctl fs.inotify.max_user_instances vm.max_map_count
  • Expected output:
    fs.inotify.max_user_instances = 1024
    vm.max_map_count = 1048576

5. AppArmor Security Configuration​

Ubuntu Server enables AppArmor by default.

Docker's default docker-default AppArmor profile restricts the mount-propagation system calls required by systemd during container initialisation. You do not need to modify system-wide AppArmor profiles on your Ubuntu Server host; the Docker Compose deployment templates provided in later sections configure the necessary container security options automatically.


6. GPU Driver Configuration​

Steam Headless only requires the host kernel driver and firmware. Do not install desktop gaming packages, Mesa userspace, or Steam on the Ubuntu Server host.

Option A: Intel Graphics (VA-API)​

Intel integrated and discrete GPUs use the in-kernel i915 or xe drivers provided by Ubuntu Server.

  1. Ensure standard firmware packages are installed:
    sudo apt-get install -y linux-firmware
  2. Verify the render node exists:
    ls -l /dev/dri/renderD128

Option B: AMD Radeon Graphics​

AMD Radeon GPUs use the open-source in-kernel amdgpu driver.

  1. Ensure firmware packages are installed:
    sudo apt-get install -y linux-firmware
  2. Verify the render node exists:
    ls -l /dev/dri/renderD*

Option C: NVIDIA GeForce Graphics​

NVIDIA GPUs require a compatible NVIDIA driver stack, Kernel Mode Setting (nvidia_drm.modeset=1), and the NVIDIA Container Toolkit. Ubuntu Server prefers NVIDIA's open GPU kernel modules on supported modern cards and uses the proprietary kernel modules only for older cards that need them.

Mixed NVIDIA GPU Generations

If your server runs multiple NVIDIA graphics cards from different generations (for example, an older GTX 1050 Ti alongside a newer RTX 4060):

  • Automatic proprietary driver selection: The Linux kernel can only load one NVIDIA driver module at a time. Because open GPU kernel modules cannot support pre-Turing cards, mixed-generation systems must use the proprietary driver branch that supports all installed cards (such as nvidia-driver-580).
  • Handled automatically by Ubuntu Server: Running sudo ubuntu-drivers install automatically inspects all detected GPUs, determines the highest shared proprietary driver branch, and installs it without manual version negotiation.

1. Install the NVIDIA driver​

Ubuntu Server's driver utility detects your graphics card and selects a compatible package. For GTX 16-series and RTX cards, it prefers the open kernel module flavour. For GTX 900-series, GTX 10-series, and TITAN V cards, it selects a compatible proprietary legacy branch.

ubuntu-drivers devices
sudo ubuntu-drivers install

2. Enable Kernel Mode Setting (nvidia_drm.modeset=1)​

KWin's virtual Wayland session uses Generic Buffer Management (GBM). This requires kernel mode setting to be explicitly enabled:

  1. Edit /etc/default/grub and add nvidia_drm.modeset=1 to GRUB_CMDLINE_LINUX_DEFAULT:
    sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="\(.*\)"/GRUB_CMDLINE_LINUX_DEFAULT="\1 nvidia_drm.modeset=1"/' /etc/default/grub
  2. Update the GRUB configuration and reboot:
    sudo update-grub
    sudo reboot
  3. After rebooting, verify modesetting:
    cat /sys/module/nvidia_drm/parameters/modeset
    • Expected output: Y.

3. Initialise NVIDIA device nodes at boot​

Loading the NVIDIA kernel modules does not necessarily create /dev/nvidia-modeset or the unified-memory device nodes on a headless server. Install this startup helper to detect every NVIDIA graphics card, use its actual device minor, and ask nvidia-modprobe to create the required nodes before Docker starts:

sudo curl -fsSL https://steamheadless.com/scripts/steam-headless-nvidia-init \
-o /usr/local/sbin/steam-headless-nvidia-init
sudo chmod 0755 /usr/local/sbin/steam-headless-nvidia-init

Create and start the systemd service:

sudo tee /etc/systemd/system/steam-headless-nvidia-devices.service >/dev/null <<'EOF'
[Unit]
Description=Initialise NVIDIA device nodes for Steam Headless
After=systemd-modules-load.service
Before=docker.service containerd.service

[Service]
Type=oneshot
ExecCondition=/usr/local/sbin/steam-headless-nvidia-init --check
ExecStart=/usr/local/sbin/steam-headless-nvidia-init
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now steam-headless-nvidia-devices.service

Confirm the service, modules, modeset setting, and device files before creating the container:

systemctl --no-pager status steam-headless-nvidia-devices.service
lsmod | grep -E '^nvidia(_modeset|_drm|_uvm)?'
cat /sys/module/nvidia_drm/parameters/modeset
ls -l /dev/nvidia-modeset /dev/nvidia-uvm /dev/nvidia-uvm-tools

The service must report active (exited), all four NVIDIA modules must appear, the modeset command must print Y, and all three device paths must exist.

4. Install the NVIDIA Container Toolkit​

Configure NVIDIA's official package repository:

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \
sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg

curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

Configure Docker to register the NVIDIA runtime and restart the daemon:

sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

7. Verification Checklist​

Run this command sequence on your Ubuntu Server host to confirm complete preparation:

echo "=== 1. Docker Version ==="
sudo docker version --format 'Engine Version: {{.Server.Version}}'

echo "=== 2. cgroup v2 ==="
stat -fc 'cgroup filesystem: %T' /sys/fs/cgroup

echo "=== 3. DRM Render Node ==="
ls -l /dev/dri/renderD*

echo "=== 4. Virtual Input & FUSE Nodes ==="
ls -l /dev/uinput /dev/uhid /dev/fuse

echo "=== 5. Kernel Limits (Inotify & vm.max_map_count) ==="
sysctl fs.inotify.max_user_instances vm.max_map_count

If all tests return expected values, your Ubuntu Server host is ready for deployment.


→ Next step: Choose a Deployment Method.