docker-steam-headless icon indicating copy to clipboard operation
docker-steam-headless copied to clipboard

Rootless docker/podman support

Open IvanCharcos opened this issue 1 year ago • 3 comments

Is your feature request related to a problem?

No response

What is your feature request?

Hello,

I was wondering if there is a way to make this container work for rootless container environments. From the documentation, it looks like we need to sudo.

My containers are all rootless so it would be nice to have Steam Headless support it.

Are there any workarounds?

No response

Additional Context

No response

IvanCharcos avatar Aug 21 '24 13:08 IvanCharcos

One thing I had to do was update overlay/etc/cont-init.d/30-configure_udev.sh to do a permissions check:

if [[ -e /dev/uinput ]]; then
  permissions=$(stat -c "%a" /dev/uinput)
  if [[ "$permissions" != "666" ]]; then
    print_step_header "Ensure the default user has permission to r/w on input devices"
    chmod 0666 /dev/uinput
  else
    print_step_header "User already has write permission on input devices"
  fi
 fi

This got around the error when starting.

To get nvidia visible to podman-compose:

podman-compose --podman-run-args="--device=nvidia.com/gpu=all" up  --force-recreate

I still get errors though.

[steam-headless] | 2025-01-08 18:17:58,238 INFO supervisord started with pid 1
[steam-headless] | 2025-01-08 18:17:59,241 INFO spawned: 'dbus' with pid 349
[steam-headless] | 2025-01-08 18:17:59,244 INFO spawned: 'udev' with pid 350
[steam-headless] | 2025-01-08 18:17:59,245 INFO spawned: 'xorg' with pid 351
[steam-headless] | 2025-01-08 18:17:59,246 INFO spawned: 'audiostream' with pid 352
[steam-headless] | 2025-01-08 18:17:59,248 INFO spawned: 'frontend' with pid 353
[steam-headless] | 2025-01-08 18:17:59,249 INFO spawned: 'pulseaudio' with pid 355
[steam-headless] | 2025-01-08 18:17:59,250 INFO spawned: 'x11vnc' with pid 356
[steam-headless] | 2025-01-08 18:17:59,252 INFO spawned: 'desktop' with pid 359
[steam-headless] | PULSEAUDIO: Starting pulseaudio service
[steam-headless] | 2025-01-08 18:17:59,259 WARN exited: frontend (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:17:59,270 INFO reaped unknown pid 374 (exit status 0)
[steam-headless] | 2025-01-08 18:17:59,312 WARN exited: udev (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:00,313 INFO success: dbus entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[steam-headless] | 2025-01-08 18:18:00,315 INFO spawned: 'udev' with pid 391
[steam-headless] | 2025-01-08 18:18:00,316 INFO success: xorg entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[steam-headless] | 2025-01-08 18:18:00,316 INFO success: audiostream entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[steam-headless] | 2025-01-08 18:18:00,317 INFO spawned: 'frontend' with pid 392
[steam-headless] | 2025-01-08 18:18:00,317 INFO success: pulseaudio entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[steam-headless] | 2025-01-08 18:18:00,317 INFO success: x11vnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[steam-headless] | 2025-01-08 18:18:00,317 INFO success: desktop entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[steam-headless] | 2025-01-08 18:18:00,327 WARN exited: frontend (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:00,380 WARN exited: udev (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:02,383 INFO spawned: 'udev' with pid 417
[steam-headless] | 2025-01-08 18:18:02,384 INFO spawned: 'frontend' with pid 418
[steam-headless] | 2025-01-08 18:18:02,393 WARN exited: frontend (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:02,445 WARN exited: udev (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:06,292 INFO spawned: 'udev' with pid 457
[steam-headless] | 2025-01-08 18:18:06,294 INFO spawned: 'frontend' with pid 458
[steam-headless] | 2025-01-08 18:18:06,304 WARN exited: frontend (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:06,348 INFO gave up: frontend entered FATAL state, too many start retries too quickly
[steam-headless] | 2025-01-08 18:18:06,356 WARN exited: udev (exit status 1; not expected)
[steam-headless] | 2025-01-08 18:18:07,357 INFO gave up: udev entered FATAL state, too many start retries too quickly
[steam-headless] | 2025-01-08 18:18:09,269 WARN exited: xorg (exit status 11; not expected)
[steam-headless] | 2025-01-08 18:18:09,271 INFO spawned: 'xorg' with pid 491
[steam-headless] | 2025-01-08 18:18:10,272 INFO success: xorg entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
^C[steam-headless] | 2025-01-08 18:18:17,279 WARN received SIGINT indicating exit request
[steam-headless] | 2025-01-08 18:18:17,279 INFO waiting for dbus, xorg, audiostream, pulseaudio, x11vnc, desktop to die

jtmcdole avatar Jan 08 '25 05:01 jtmcdole

@jtmcdole I managed to run this compose with your uinput fix I use rootless Podman with docker compose v2

Issues I noticed so far:

  • Max resolution 2048x1152@60Hz, can't go WQHD
  • Desktop is laggy
  • Downloading a game, will try running it
  steam:
    image: josh5/steam-headless:latest
    container_name: steam
    restart: always
    # shm_size: ${SHM_SIZE}
    ipc: host # Could also be set to 'shareable'
    ulimits:
      nofile:
        soft: 1024
        hard: 524288
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
      - SYS_NICE
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined

    # GPU PASSTHROUGH
    # deploy:
    #   resources:
    #     reservations:
    #       # Enable support for NVIDIA GPUs.
    #       # 
    #       # Ref: https://docs.docker.com/compose/gpu-support/#enabling-gpu-access-to-service-containers
    #       devices:
    #         - capabilities: [gpu]
    #           device_ids: ["${NVIDIA_VISIBLE_DEVICES}"]

    # NETWORK:
    ## NOTE:  With this configuration, if we do not use the host network, then physical device input
    ##        is not possible and your USB connected controllers will not work in steam games.
    network_mode: host
    hostname: ${NAME}
    extra_hosts:
      - "${NAME}:127.0.0.1"
    
    # ENVIRONMENT:
    ## Read all config variables from the .env file
    environment:
      # System
      - TZ=${TZ}
      - USER_LOCALES=${USER_LOCALES}
      - DISPLAY=${DISPLAY}
      # - DISPLAY_REFRESH="120"
      # - DISPLAY_SIZEW="2560"
      # - DISPLAY_SIZEH="1440"
      # User
      - PUID=${PUID}
      - PGID=${PGID}
      - UMASK=${UMASK}
      - USER_PASSWORD=${USER_PASSWORD}
      # Mode
      - MODE=${MODE}
      # Web UI
      - WEB_UI_MODE=${WEB_UI_MODE}
      - ENABLE_VNC_AUDIO=${ENABLE_VNC_AUDIO}
      - PORT_NOVNC_WEB=${PORT_NOVNC_WEB}
      - NEKO_NAT1TO1=${NEKO_NAT1TO1}
      # Steam
      - ENABLE_STEAM=${ENABLE_STEAM}
      - STEAM_ARGS=${STEAM_ARGS}
      # Sunshine
      - ENABLE_SUNSHINE=${ENABLE_SUNSHINE}
      - SUNSHINE_USER=${SUNSHINE_USER}
      - SUNSHINE_PASS=${SUNSHINE_PASS}
      # Xorg
      - ENABLE_EVDEV_INPUTS=${ENABLE_EVDEV_INPUTS}
      - FORCE_X11_DUMMY_CONFIG=${FORCE_X11_DUMMY_CONFIG}
      # Nvidia specific config
      - NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES}
      - NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES}
      - NVIDIA_DRIVER_VERSION=${NVIDIA_DRIVER_VERSION}

    # DEVICES:
    devices:
      - "nvidia.com/gpu=all"
      # Use the host fuse device [REQUIRED].
      - /dev/fuse
      # Add the host uinput device [REQUIRED].
      - /dev/uinput
      # Add NVIDIA HW accelerated devices [OPTIONAL].
      # NOTE: If you use the nvidia container toolkit, this is not needed.
      #       Installing the nvidia container toolkit is the recommended method for running this container
      #- /dev/nvidia0
      #- /dev/nvidiactl
      #- /dev/nvidia-modeset
      #- /dev/nvidia-uvm
      #- /dev/nvidia-uvm-tools
      #- /dev/nvidia-caps/nvidia-cap1
      #- /dev/nvidia-caps/nvidia-cap2
    # Ensure container access to devices 13:*
    # device_cgroup_rules:
    #   - 'c 13:* rmw'

    # VOLUMES:
    volumes:

      # The location of your home directory.
      - ./steam_headless/home/:/home/default/:rw

      # The location where all games should be installed.
      # This path needs to be set as a library path in Steam after logging in.
      # Otherwise, Steam will store games in the home directory above.
      - ./steam_headless/games/:/mnt/games/:rw

      # The Xorg socket.
      - ./steam_headless/.X11-unix/:/tmp/.X11-unix/:rw

      # Pulse audio socket.
      - ./steam_headless/pulse/:/tmp/pulse/:rw
 
      # I put the fix here to avoid rebuilding the image
      - ./steam_headless/overlay/etc/cont-init.d/:/etc/cont-init.d:rw

0xCA avatar May 06 '25 20:05 0xCA

Issues I encountered after trying some games:

  • The games themselves run excellent, top FPS, max graphics
  • Web streaming is very bad, regardless of quality and compression settings in the browser
  • Image is laggy and audio is several seconds behind
  • Firs-Person games are absolutely unplayable with mouse: camera spins like crazy on the slightest mouse movement
  • I'm in the same LAN as the server, so not a network issue

Update:

I tried Steam Remote Play

  • It's MUCH, MUCH better
  • Almost no lags
  • Proper mouse controls
  • There is an issue with audio choppiness (pulseaudio delay is too short?)
  • Half-Life 2 shows black screen when streamed via SRP. Audio works, controls work, but there is no video.

Update 2:

Portal RTX requires Proton and works really well via SRP

0xCA avatar May 06 '25 21:05 0xCA