docker-steam-headless
docker-steam-headless copied to clipboard
[Bug]: No keyboard/mouse input in Sunshine
Describe the Bug
Keyboard/mouse not working when connected with Moonlight to the Sunshine server.
Tracked it down to udevd daemon not running, it was a pain to debug.
Workaround:
sudo /lib/systemd/systemd-udevd --daemon- Restart sunshine.
I am unable to reproduce it on another system, and can't find a error anywhere on the logs. As far as I know it is completely silent except it is obviously not running px aux | grep udevd
This compounds with the fact that udev supervisor unit watches for the PID of udevadm monitor instead of udevd daemon. Maybe creating a exclusive udevd supervisor unit helps?
Regardless, I understand supervisord does not have dependency management. Given the nature of this container it looks like issues like this are going to get worse.
Would migrating to an alternative with support for dependencies such as S6-overlay make sense in the bigger picture? I don't know which path should I take to submit a PR.
Steps to Reproduce
No response
Expected Behavior
No response
Screenshots
No response
Relevant Settings
No response
Version
Build: [2023-11-18 02:38:41] [master] [6cc9f56155f3c7f9fc6bc9c22ef2cbf555029c00] [debian]
Platform
Distribution: Running under systemd-nspawn with jlmkr on TrueNAS Scale Linux Kernel: 5.15.131+truenas GPU Driver versions: | NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7 | Docker: 24.0.7, build afdd53b Docker-compose: v2.21.0
Relevant log output
No response
Hey! Was facing this issue in TrueNAS Scale, here is my thread https://github.com/Steam-Headless/docker-steam-headless/issues/105
TLDR; Enable This,
Thanks for the input, but this is a different environment. I am running a separate docker with compose under systemd-nspawn with jlmkr . Already running steam-headless container with host networking.
NOT using Scale native apps/truecharts. I have shot myself on the foot trusting truecharts too many times. Running manual docker images now or "simple" community charts only, biggest quality of life upgrade ever, and way easier to manage.
Thank you for your service @miguelangel-nubla. Your quick fix solved the same issue I had. Would be nice if we could get an official fix for this though.
Can confirm, this workaround allowed me to use my input devices with the Docker. OS Unraid 6.12.8
I've been running into this same exact issue on Unraid 6.12.0 with Docker. Currently using the latest patch for josh5/steam-headless.
- sudo /lib/systemd/systemd-udevd --daemon
- Restart sunshine.
The command that was mentioned resolved this issue and is now working. Thank you so much! I'm going to save that command for future use just incase it acts up again.
Having the same issue but on Proxmox rather than unRaid, but the fix isn't working for me. Setup is Proxmox > debian LXC with /dev/uinput mounted > docker compose. Steam remote play and VNC work fine, but when connecting via Moonlight/Sunshine I get no response from keyboard or mouse. I can also see that the udevd daemon isn't running at first but even manually starting it with the above command and restarting Sunshine doesn't help.
@leinaht adding this to your config should fix it
lxc.cgroup2.devices.allow: c 13:* rwm
lxc.mount.entry: /dev/input dev/input none bind,optional,create=dir
lxc.hook.pre-start: sh -c "chown 100000:111000 /dev/input"
But sudo /lib/systemd/systemd-udevd --daemon and sunshine restart is still required.
Edit: Publishing my workaround at boot
I am using this service as a workaround at LXC boot, so I don't have to run manually the command.
[Unit]
Description=Wait for Sunshine Application to Start
After=docker.service
Requires=docker.service
[Service]
ExecStart=/root/restart-udev-sunshine-in-container.sh
Type=oneshot
RemainAfterExit=yes
StandardOutput=journal
StandardError=journal
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
Which uses this script /root/restart-udev-sunshine-in-container.sh
#!/bin/bash
# Define the Docker container name as a variable
CONTAINER_NAME="steam-headless-steam-headless-1"
# Wait for the Docker container to start
logger "Waiting for the Docker container '$CONTAINER_NAME' to start..."
while ! docker ps | grep -q "$CONTAINER_NAME"; do
sleep 10 # Check every 10 second
done
logger "Docker container '$CONTAINER_NAME' is running."
# Wait for the "sunshine" application to start
logger "Waiting for the 'sunshine' application to start..."
while ! pgrep -x "sunshine" > /dev/null; do
sleep 10 # Check every 10 second
done
logger "'Sunshine' application has started."
# Run the command after the application has launched
logger "Executing systemd udev daemon inside the Docker container..."
docker exec "$CONTAINER_NAME" sudo /lib/systemd/systemd-udevd --daemon
logger "Executed systemd udev daemon."
# Kill the "sunshine" application
logger "Killing the 'sunshine' application..."
docker exec "$CONTAINER_NAME" killall -9 'sunshine'
logger "'Sunshine' application has been killed. Sunshine will restart."
Just like last comment, I also created a custom script for this, but instead placed the script in the Additional Software directory:
cat <<EOF > /opt/container-data/steam-headless/home/init.d/launch-systemd-udevd.sh
#!/usr/bin/env sh
echo "\e[36m - Ensure 'systemd-udevd' is running...\e[0m"
sudo /lib/systemd/systemd-udevd --daemon >/dev/null 2>&1
EOF
[!TIP] Container's Entrypoint makes sure that scripts in this directory are executable, so no need to do that on our side.
[!IMPORTANT] Sunshine is started by supervisord, which is launched after custom scripts. We don't need to "restart" Sunshine.