Skip to content

[Bug]: Sunshine virtual input devices are exposed in sysfs but missing in /dev/input, causing Moonlight keyboard/mouse input failure and Xorg restart/crash loops #231

Description

@pin00b

Describe the Bug

After a recent NVIDIA driver / container restart scenario, the container starts far enough that WebVNC and Moonlight video streaming can work, but Moonlight keyboard and mouse input are unavailable.

The root cause appears to be that Sunshine creates virtual input devices visible under /sys/class/input/event*/device/name, for example:
Mouse passthrough Mouse passthrough (absolute) Keyboard passthrough

but the matching character device nodes are not reliably present under /dev/input/ inside the container.

When Xorg tries to attach these Sunshine virtual input devices via udev, it sees the sysfs entries and attempts to use /dev/input/event5, /dev/input/event6, and /dev/input/event7, but those nodes may not exist. This causes errors such as:
evdev: Keyboard passthrough: Unable to open evdev device "/dev/input/event7" (No such file or directory). PreInit returned 2 for "Keyboard passthrough" evdev: Mouse passthrough: Unable to open evdev device "/dev/input/event5" (No such file or directory).

In some startup orders, this also leads to repeated Xorg restarts / crash loops and repeated:
Fatal server error: Server is already active for display 55

A manual workaround is to recreate the missing /dev/input/event* nodes from the major/minor numbers in /sys/class/input/event*/dev, install/use the evdev Xorg input config, and restart Xorg after the nodes exist. After that, Moonlight keyboard and mouse input works.

Steps to Reproduce

  1. Run the steam-headless container with Sunshine enabled and NVIDIA GPU acceleration.
  2. Start or restart the container after the recent NVIDIA driver / environment change.
  3. Connect via WebVNC.
  4. Connect via Moonlight.
  5. Observe that video output works, but keyboard/mouse input from Moonlight does not work.
  6. Inside the container, check Sunshine virtual input devices:
for e in /sys/class/input/event*; do
  [ -e "$e/device/name" ] || continue
  name="$(cat "$e/device/name" 2>/dev/null)"
  dev="$(cat "$e/dev" 2>/dev/null)"
  echo "$(basename "$e") dev=$dev name=$name"
done

Example output:

event5 dev=13:69 name=Mouse passthrough
event6 dev=13:70 name=Mouse passthrough (absolute)
event7 dev=13:71 name=Keyboard passthrough
  1. Compare with /dev/input:
    ls -la /dev/input

  2. Check Xorg logs:

grep -nEi "Keyboard passthrough|Mouse passthrough|Unable to open|Failed to create|No such device|Server is already active|Fatal server error" \
  /var/log/Xorg.55.log /home/default/.cache/log/xorg.err.log 2>/dev/null | tail -120

Expected Behavior

Sunshine’s virtual keyboard/mouse/touch input devices should be usable by Xorg inside the container without manual intervention.

When Sunshine creates virtual input devices, the corresponding /dev/input/event* character nodes should exist, have usable permissions, and Xorg should attach them successfully.

Moonlight keyboard and mouse input should work after container start/restart.

Xorg should not enter a restart/crash loop because of stale/missing Sunshine input device nodes.

Screenshots

na

Relevant Settings

steam-headless container
Sunshine enabled
Xorg display: :55
WebVNC enabled
Moonlight client used for streaming/input
NVIDIA GPU acceleration

Relevant effective workaround:

mkdir -p /etc/X11/xorg.conf.d
cp -f /usr/share/X11/xorg.conf.d/10-evdev.conf /etc/X11/xorg.conf.d/10-evdev.conf

Ensure Xorg input auto-add is not disabled:
sed -i "/AutoAddDevices/d;/AutoEnableDevices/d" /etc/X11/xorg.conf

Create missing device nodes from sysfs:

mkdir -p /dev/input

for e in /sys/class/input/event*; do
  [ -e "$e/device/name" ] || continue
  name="$(cat "$e/device/name" 2>/dev/null || true)"

  case "$name" in
    *passthrough*|*Sunshine*)
      ev="$(basename "$e")"
      dev="$(cat "$e/dev")"
      maj="${dev%:*}"
      min="${dev#*:}"
      path="/dev/input/$ev"

      rm -f "$path"
      mknod "$path" c "$maj" "$min"
      chown root:input "$path" 2>/dev/null || chown root:root "$path"
      chmod 660 "$path"
      ;;
  esac
done

Then restart Xorg/desktop/x11vnc after the nodes exist while keeping Sunshine available. After this, logs show successful attachment:

Using input driver 'evdev' for 'Mouse passthrough'
XINPUT: Adding extended input device "Mouse passthrough"
Using input driver 'evdev' for 'Keyboard passthrough'
XINPUT: Adding extended input device "Keyboard passthrough"

Version

josh5/steam-headless:latest; Sunshine version: 2025.924.154138 commit: 86188d47a7463b0f73b35de18a628353adeaa20e Package Publisher: LizardByte

Platform

Distribution: <output of: . /etc/os-release; echo "${NAME} - ${VERSION}">
Linux Kernel: <output of: uname -rpio>
GPU Driver versions: <output of: nvidia-smi | grep 'Version:'>
Docker: <output of: docker -v>
Docker-compose: <output of: docker compose -v>

Host: Unraid-based system
Container: steam-headless
GPU: NVIDIA
Streaming client: Moonlight
WebVNC: works
Moonlight video: works
Moonlight keyboard/mouse input: broken until /dev/input nodes are recreated and Xorg reattaches them via evdev

Relevant log output

/sys/class/input/event5/device/name -> Mouse passthrough
/sys/class/input/event6/device/name -> Mouse passthrough (absolute)
/sys/class/input/event7/device/name -> Keyboard passthrough

Broken state:
(II) config/udev: Adding input device Keyboard passthrough (/dev/input/event7)
(**) Keyboard passthrough: Applying InputClass "evdev keyboard catchall"
(II) Using input driver 'evdev' for 'Keyboard passthrough'
(**) evdev: Keyboard passthrough: Device: "/dev/input/event7"
(EE) evdev: Keyboard passthrough: Unable to open evdev device "/dev/input/event7" (No such file or directory).
(EE) PreInit returned 2 for "Keyboard passthrough"

(II) config/udev: Adding input device Mouse passthrough (/dev/input/event5)
(**) Mouse passthrough: Applying InputClass "evdev pointer catchall"
(II) Using input driver 'evdev' for 'Mouse passthrough'
(**) evdev: Mouse passthrough: Device: "/dev/input/event5"
(EE) evdev: Mouse passthrough: Unable to open evdev device "/dev/input/event5" (No such file or directory).
(EE) PreInit returned 2 for "Mouse passthrough"

Working state after manually recreating /dev/input/event5, /dev/input/event6, and /dev/input/event7:
(II) config/udev: Adding input device Mouse passthrough (/dev/input/event5)
(**) Mouse passthrough: Applying InputClass "evdev pointer catchall"
(II) Using input driver 'evdev' for 'Mouse passthrough'
(**) evdev: Mouse passthrough: Device: "/dev/input/event5"
(--) evdev: Mouse passthrough: Vendor 0xbeef Product 0xdead
(--) evdev: Mouse passthrough: Found 12 mouse buttons
(--) evdev: Mouse passthrough: Found relative axes
(II) evdev: Mouse passthrough: Configuring as mouse
(II) XINPUT: Adding extended input device "Mouse passthrough" (type: MOUSE)

(II) config/udev: Adding input device Keyboard passthrough (/dev/input/event7)
(**) Keyboard passthrough: Applying InputClass "evdev keyboard catchall"
(II) Using input driver 'evdev' for 'Keyboard passthrough'
(**) evdev: Keyboard passthrough: Device: "/dev/input/event7"
(--) evdev: Keyboard passthrough: Vendor 0xbeef Product 0xdead
(--) evdev: Keyboard passthrough: Found keys
(II) evdev: Keyboard passthrough: Configuring as keyboard
(II) XINPUT: Adding extended input device "Keyboard passthrough" (type: KEYBOARD)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions