[CachyOS] Systemd Environment Different from Terminal #1118
|
Hello, I'm having some trouble running Sunshine through the systemd service file. If Sunshine is started manually from my terminal, it is able to correctly detect my wayland session using kwingrab. However, if it's started from the systemd file (even if the service is ran using my own user/group), it's not able to detect my current display or possible encoders. I imagine there's some way to add Sunshine to the proper scope to see what it needs to from inside systemd, but I'm not familiar enough with Wayland to understand what's wrong (or at least I couldn't find anyone mentioning this). Any help is appreciated :) I've added the logs and systemd service configuration below. Systemd Service FileSystemd LogTerminal Log |
Replies: 1 comment 1 reply
|
The key line in your log is this one: Your unit is a system service (
The fix is to run Sunshine as a user service. The package already ships one: # remove your system unit
sudo systemctl disable --now sunshine.service
sudo rm /etc/systemd/system/sunshine.service # or wherever you put it
sudo systemctl daemon-reload
# use the shipped user unit
systemctl --user enable --now app-dev.lizardbyte.app.Sunshine( To keep your vmon stop script, add it through a drop-in rather than editing the shipped unit: systemctl --user edit app-dev.lizardbyte.app.Sunshine[Service]
ExecStopPost=/home/myUser/.local/bin/sunshine-stop-vmon.shYou can check what the service sees with |
The key line in your log is this one:
Your unit is a system service (
User=myUserjust changes the uid it runs as). System services start in the system manager's environment, so they never get your session'sWAYLAND_DISPLAY,XDG_RUNTIME_DIRor session D-Bus address. Without those, kwingrab can't find KWin, and every encoder test fails after it because there is no display to test against. In the terminal it works because your shell has those variables.graphical-session.targetalso only exists in the user manager, soAfter=/WantedBy=graphical-session.targetin a system unit never does what you want.The fix is to run Sunshine as a user service. The…