Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Sunshine enabled as systemd user service prevents GNOME Wayland from starting.

Open JordanViknar opened this issue 2 years ago • 7 comments

Describe the Bug

The GPUs seem to be "stolen" by sunshine when logging in, preventing GNOME Wayland from using them.

Additionally, it seems sunshine starts way too early, and asks for the WAYLAND_DISPLAY variable when it has yet to be set. (I can confirm by clicking on the line that this is sent by sunshine.)

image

Expected Behavior

GNOME Wayland starts normally, and sunshine right after the desktop opens, allowing me to use GameStream almost as soon as I'm logged in.

Additional Context

I'm using a PRIME setup on Arch Linux, with sunshine installed using the AUR package.

I can confirm that this issue is caused by sunshine : disabling the sunshine systemd user service fixes the crashing instantly.

I did notice this issue can also be avoided sometimes by running GNOME Xorg first, then GNOME Wayland : the crash won't happen.

Host Operating System

Linux

Operating System Version

Arch Linux (rolling)

Architecture

64 bit

Sunshine Version

0.14.1

GPU Type

Intel + NVIDIA

GPU Model

Intel CoffeeLake-H GT2 [UHD Graphics 630] + NVIDIA GeForce GTX 1060 Mobile

GPU Driver/Mesa Version

Mesa : 22.1.6 - NVIDIA : 515.65.01

Capture Method (Linux Only)

PipeWire/Wayland

Relevant log output

août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Reached target GNOME Wayland Session.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Reached target Session services which should run early before the graphical session is brought up.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Reached target GNOME Shell.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Starting GNOME Remote Desktop...
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Starting Monitor Session leader for GNOME Session...
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started Sunshine is a Gamestream host for Moonlight..
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started Monitor Session leader for GNOME Session.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Reached target Tasks to be run before GNOME Session starts.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Starting GNOME Session Manager (session: gnome)...
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [fps] -- [[30,60,90,120]]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [vt_software] -- [auto]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [amd_quality] -- [default]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [origin_web_ui_allowed] -- [lan]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [gamepad] -- [x360]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [nv_coder] -- [auto]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [nv_preset] -- [default]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [upnp] -- [disabled]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [resolutions] -- [[
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]:     1280x720,
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]:     1920x1080
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: ]]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [origin_pin_allowed] -- [pc]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [nv_rc] -- [auto]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [hevc_mode] -- [0]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [amd_rc] -- [auto]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [vt_coder] -- [auto]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [min_log_level] -- [2]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [key_rightalt_to_key_win] -- [disabled]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [vt_realtime] -- [enabled]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch gnome-session-binary[1286]: WARNING: Could not parse desktop file teams.desktop or it references a not found TryExec binary
août 16 12:14:16 jordan-msi-ge63-arch gnome-session[1286]: gnome-session-binary[1286]: WARNING: Could not parse desktop file teams.desktop or it references a not found TryExec binary
août 16 12:14:16 jordan-msi-ge63-arch gnome-session[1286]: gnome-session-binary[1286]: WARNING: Could not parse desktop file xscreensaver.desktop or it references a not found TryExec binary
août 16 12:14:16 jordan-msi-ge63-arch gnome-session-binary[1286]: WARNING: Could not parse desktop file xscreensaver.desktop or it references a not found TryExec binary
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started GNOME Remote Desktop.
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1221]: The PKCS#11 component was already initialized
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1302]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-d[1221]: The PKCS#11 component was already initialized
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-pkcs11.desktop[1302]: GNOME_KEYRING_CONTROL=/run/user/1000/keyring
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started Application launched by gnome-session-binary.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started Application launched by gnome-session-binary.
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-pkcs11.desktop[1302]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started Application launched by gnome-session-binary.
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Environment variable WAYLAND_DISPLAY has not been defined
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1221]: The Secret Service was already initialized
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-d[1221]: The Secret Service was already initialized
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1303]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-secrets.desktop[1303]: GNOME_KEYRING_CONTROL=/run/user/1000/keyring
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-secrets.desktop[1303]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1304]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-ssh.desktop[1304]: GNOME_KEYRING_CONTROL=/run/user/1000/keyring
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-ssh.desktop[1304]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-ssh.desktop[1304]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1304]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-secrets.desktop[1303]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-daemon[1304]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-ssh.desktop[1304]: GNOME_KEYRING_CONTROL=/run/user/1000/keyring
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-ssh.desktop[1304]: SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
août 16 12:14:16 jordan-msi-ge63-arch gnome-keyring-ssh.desktop[1304]: discover_other_daemon: 1
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Started GNOME Session Manager (session: gnome).
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Reached target GNOME Session Manager is ready.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Starting GNOME Shell on Wayland...
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Starting GNOME Shell on X11...
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: [email protected]: Skipped due to 'exec-condition'.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Condition check resulted in GNOME Shell on X11 being skipped.
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: //////////////////////////////////////////////////////////////////
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: //                                                              //
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: //   Testing for available encoders, this may generate errors.  //
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: //   You can safely ignore those errors.                        //
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: //                                                              //
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: //////////////////////////////////////////////////////////////////
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: Trying encoder [nvenc]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: Screencasting with KMS
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch kernel: input: Logitech Wireless Mouse PID:4038 as /devices/virtual/input/input32
août 16 12:14:16 jordan-msi-ge63-arch kernel: input: Touchscreen passthrough as /devices/virtual/input/input33
août 16 12:14:16 jordan-msi-ge63-arch kernel: input: Keyboard passthrough as /devices/virtual/input/input34
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Error: Failed to gain CAP_SYS_ADMIN
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: Found monitor for DRM screencasting
août 16 12:14:16 jordan-msi-ge63-arch systemd-logind[610]: Watching system buttons on /dev/input/event23 (Keyboard passthrough)
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Running GNOME Shell (using mutter 42.4) as a Wayland display server
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: dri_create_context: requested glthread but driver is missing backgroundCallable V2 extension
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: Color coding [Rec. 601]
août 16 12:14:16 jordan-msi-ge63-arch sunshine[1284]: [2022:08:16:12:14:16]: Info: Color range: [JPEG]
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Device '/dev/dri/card1' prefers shadow buffer
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Added device '/dev/dri/card1' (nvidia-drm) using non-atomic mode setting.
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Failed to open atomic modesetting backend: GDBus.Error:System.Error.EBUSY: Device or resource busy
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: g_hash_table_destroy: assertion 'hash_table != NULL' failed
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Failed to open legacy modesetting backend: GDBus.Error:System.Error.EBUSY: Device or resource busy
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Failed to open gpu '/dev/dri/card0': No suitable mode setting backend found
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Enabling experimental feature 'autoclose-xwayland'
août 16 12:14:16 jordan-msi-ge63-arch gnome-shell[1307]: Failed to setup: No GPUs with outputs found
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: [email protected]: Failed with result 'protocol'.
août 16 12:14:16 jordan-msi-ge63-arch systemd[1207]: Failed to start GNOME Shell on Wayland.

JordanViknar avatar Aug 16 '22 10:08 JordanViknar

Can you edit your issue and paste the log as text instead of an image?

ReenigneArcher avatar Aug 16 '22 14:08 ReenigneArcher

Same happens to me with KDE. If I enable the service, when I login from SDDM, I get dropped to a TTY. Disabling the sunshine service then rebooting lets me login fine. Starting the service once I'm logged in also works fine.

Host Operating System Linux

Operating System Version Arch Linux (rolling)

Desktop Environment KDE

Architecture 64 bit

Sunshine Version 0.14.1

GPU Type AMD

GPU Model 6700 XT

GPU Driver/Mesa Version Mesa : 22.1.6-1 GPU: amdgpu 22.0.0-1

Capture Method (Linux Only) PipeWire/Wayland

nisegami avatar Aug 17 '22 14:08 nisegami

Can you edit your issue and paste the log as text instead of an image?

Sure. I will do it as soon as I can (and don't forget about it). This is an image that I took from GNOME's logging application, but I can very likely use journalctl to grab the log as text.

JordanViknar avatar Aug 17 '22 14:08 JordanViknar

Can you edit your issue and paste the log as text instead of an image?

I added the logs as text. Full this time, just in case.

JordanViknar avatar Aug 18 '22 14:08 JordanViknar

Update the systemd unit file in the [Unit] section and add [email protected]. Then it works! image

lsjostro avatar Sep 26 '22 13:09 lsjostro

Sorry for the delay, I missed the notification. It seems quite logical of a fix. I'll try it as soon as I can.

JordanViknar avatar Oct 01 '22 12:10 JordanViknar

I'll try it as soon as I can.

proceeds to completely forget

Anyways, I'm now going to do it. Sorry for the delay.

JordanViknar avatar Oct 09 '22 09:10 JordanViknar

I forgot to reply again, but I can confirm that this fix works. I have now both Sunshine and GNOME Wayland running. Thank you ! :smile:

(Not closing yet, until the issue is fixed in an actual release/commit.)

JordanViknar avatar Oct 22 '22 10:10 JordanViknar

(Not closing yet, until the issue is fixed in an actual release/commit.)

I don't see how we can add this since not everyone is using GNOME/Wayland. Best that could happen is docs are updated. PRs are welcome if you want to help out with that.

ReenigneArcher avatar Oct 22 '22 16:10 ReenigneArcher

I've run into this issue myself when using wayland on Plasma. To add to the conversation above, another solution that's more generic would be to set WantedBy to xdg-desktop-autostart.target under [Install] - this should make it run when other autostart apps run, after the user has logged in.

HomerSp avatar Feb 06 '23 08:02 HomerSp

This had been driving me crazy for a whole month until this morning I figured out Sunshine was the cause.

Notakas avatar Mar 20 '23 09:03 Notakas

This issue has been fixed and will be available in the next release.

LizardByte-bot avatar Mar 20 '23 14:03 LizardByte-bot

This has not been solved, or we have a regression. On arch linux after fighting a LOT with GDM, I figured this issue here was what was keeping wayland from loading for me. Adding the: [email protected]

as suggested above fixed it for me.

felipejfc avatar Nov 05 '23 04:11 felipejfc