Is there an existing issue for this?
Is your issue described in the documentation?
Is your issue present in the nightly release?
Describe the Bug
With the Flatpak release, auto-start is not possible by default, and permissions are unclear.
Documentation mentions that is preferred to install as root, but then systemd user service runs as normal user.
The example start line is "sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') flatpak run dev.lizardbyte.sunshine" requiring manually starting it and entering password every time.
Additionally the default application for normal and high quality are not working either from the flatpak version.
Expected Behavior
Easy waty to start/stop and use the flatpak release. (Seems to be the best option for most distributions, tested on Fedora 37 myself)
Additional Context
As a test to improve the situation, I created the following improvements, but not there yet completely.
Created /usr/local/bin/sunshine:
#!/bin/bash
if [ -n "$1" ]; then
/usr/bin/flatpak kill dev.lizardbyte.sunshine
else
PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') flatpak run dev.lizardbyte.sunshine
fi
Changed ~/.config/systemd/user/sunshine.service to:
[Unit]
Description=Sunshine is a self-hosted game stream host for Moonlight.
PartOf=graphical-session.target
StartLimitIntervalSec=500
StartLimitBurst=20
Wants=default.target
After=default.target
[Service]
ExecStart=/usr/bin/sudo /usr/local/bin/sunshine
NoNewPrivileges=false
Type=simple
Restart=on-failure
RestartSec=10s
ExecStop=/usr/bin/sudo /usr/local/bin/sunshine --stop
[Install]
WantedBy=default.target
Added these lines to visudo:
USERNAME ALL= NOPASSWD: /usr/local/bin/sunshine
Tested also with graphical-session.target instead of default.target, but both don't give auto-start after enabling:
systemctl --user enable sunshine
Manually executing start/stop works fine now as user without the need to enter password:
systemctl --user start sunshine
and
systemctl --user stop sunshine
works fine with these changes now.
Don't understand why its still not auto-starting upon user login? What I'm missing here?
For the resolution change, I would like to have 2 applications, 1 offering a 4K stream, and 1 offering a 2K stream with wayland on gnome.
I created the following scripts that allow changing the resolution of the system unattended:
sudo dnf install ydotool
sudo systemctl --user enable --now ydotool
/home/dries/Apps/Scripts/2k.sh
#!/bin/bash
/home/dries/.cargo/bin/gnome-randr modify -p --mode 1920x1080@60.000 --scale 1 HDMI-3 && sleep 1 && ydotool key 28:1 28:0
/home/dries/Apps/Scripts/4k.sh
#!/bin/bash
/home/dries/.cargo/bin/gnome-randr modify -p --mode 3840x2160@60.000 --scale 2 HDMI-3 && sleep 1 && ydotool key 28:1 28:0
However I still fail to execute these script from within the flatpak sandbox.
I changed the settings with Flatseal to give access to these scripts:

But somehow this isn't enough to start these scripts from within sunshine:

Any ideas what I'm missing here to get it started from within sunshine flatpak?
Additionally, can my attempts to improve the flatpak installation be added to the flatpak installer somehow? Or can an alternative be added that would result in the same improved user experience that would allow for auto-start from userspace but running with sudo/root privileges as the actual user? Could the scripts for resolution change be integrated somehow?
As a sidenote: I discoceverd this project because my son is gaming, and really like the project. In such a way that I'm trying to use it for every day general remote desktop, as it is the best remote desktop solution with hardware acceleration support and delivering an amazing capable desktop as if you would be working locally! despite other generic remote desktop solutions were typical the hardware acceleration is missing, and such high resolution and low latencies are not reachable at all.
Host Operating System
Linux
Operating System Version
Linux, Fedora 37 Flatpak
Architecture
64 bit
Sunshine commit or version
0.20.0
Package
Linux - flatpak
GPU Type
Nvidia
GPU Model
amdgpu,nouveau
GPU Driver/Mesa Version
23.0.3
Capture Method (Linux Only)
KVM
Config
fps = [30,60]
resolutions = [
1920x1080,
3840x2160
]
Apps
{
"env": {
"PATH": "$(PATH):$(HOME)\/.local\/bin"
},
"apps": [
{
"name": "Desktop",
"image-path": "desktop.png",
"prep-cmd": [
{
"do": "\/home\/dries\/Apps\/Scripts\/4k.sh",
"undo": ""
},
{
"do": "",
"undo": ""
},
{
"do": "",
"undo": ""
}
],
"exclude-global-prep-cmd": "false",
"working-dir": ""
},
{
"name": "Low Res Desktop",
"image-path": "desktop.png",
"prep-cmd": [
{
"do": "\/home\/dries\/Apps\/Scripts\/2k.sh",
"undo": ""
}
],
"exclude-global-prep-cmd": "false",
"working-dir": ""
},
{
"name": "Steam Big Picture",
"detached": [
"flatpak-spawn --host setsid steam steam:\/\/open\/bigpicture"
],
"image-path": "steam.png"
}
]
}
Relevant log output
[2023:06:04:11:56:40]: Info: Sunshine version: 0.20.0
[2023:06:04:11:56:40]: Error: Couldn't load cuda: -1
[2023:06:04:11:56:40]: Warning: Couldn't expose some properties for card: /dev/dri/card0
[2023:06:04:11:56:40]: Error: Environment variable WAYLAND_DISPLAY has not been defined
[2023:06:04:11:56:40]: Info: Detecting monitors
[2023:06:04:11:56:40]: Info: Detected monitor 0: XWAYLAND0, connected: true
[2023:06:04:11:56:40]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:06:04:11:56:40]: Info: Trying encoder [nvenc]
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Error: Failed to create a CUDA device: Operation not permitted
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Error: Failed to create a CUDA device: Operation not permitted
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Error: Failed to create a CUDA device: Operation not permitted
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Error: Failed to create a CUDA device: Operation not permitted
[2023:06:04:11:56:40]: Info: Encoder [nvenc] failed
[2023:06:04:11:56:40]: Info: Trying encoder [vaapi]
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Info: Screencasting with KMS
[2023:06:04:11:56:40]: Info: Found monitor for DRM screencasting
[2023:06:04:11:56:40]: Info: SDR color coding [Rec. 709]
[2023:06:04:11:56:40]: Info: Color range: [JPEG]
[2023:06:04:11:56:40]: Warning: vaapi: hevc missing sps->vui parameters
[2023:06:04:11:56:40]: Info:
[2023:06:04:11:56:40]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2023:06:04:11:56:40]: Info:
[2023:06:04:11:56:40]: Info: Found encoder vaapi: [h264_vaapi, hevc_vaapi]
[2023:06:04:11:56:40]: Info: Configuration UI available at [https://localhost:47990]
[2023:06:04:11:56:40]: Info: Adding avahi service Sunshine
[2023:06:04:11:56:41]: Info: Avahi service Sunshine successfully established.
[2023:06:04:11:56:49]: Info: Web UI: [127.0.0.1] -- not authorized
[2023:06:04:11:57:15]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:06:04:11:57:15]: Info: Trying encoder [nvenc]
[2023:06:04:11:57:15]: Info: Screencasting with KMS
[2023:06:04:11:57:15]: Info: Found monitor for DRM screencasting
[2023:06:04:11:57:15]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:57:15]: Info: Color range: [JPEG]
[2023:06:04:11:57:15]: Error: Failed to create a CUDA device: Operation not permitted
[2023:06:04:11:57:15]: Info: Screencasting with KMS
[2023:06:04:11:57:15]: Info: Found monitor for DRM screencasting
[2023:06:04:11:57:15]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:57:15]: Info: Color range: [JPEG]
[2023:06:04:11:57:15]: Error: Failed to create a CUDA device: Operation not permitted
[2023:06:04:11:57:15]: Info: Encoder [nvenc] failed
[2023:06:04:11:57:15]: Info: Trying encoder [vaapi]
[2023:06:04:11:57:15]: Info: Screencasting with KMS
[2023:06:04:11:57:15]: Info: Found monitor for DRM screencasting
[2023:06:04:11:57:15]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:57:15]: Info: Color range: [JPEG]
[2023:06:04:11:57:15]: Info: Screencasting with KMS
[2023:06:04:11:57:15]: Info: Found monitor for DRM screencasting
[2023:06:04:11:57:15]: Info: SDR color coding [Rec. 601]
[2023:06:04:11:57:15]: Info: Color range: [JPEG]
[2023:06:04:11:57:15]: Info: Screencasting with KMS
[2023:06:04:11:57:15]: Info: Found monitor for DRM screencasting
[2023:06:04:11:57:15]: Info: SDR color coding [Rec. 709]
[2023:06:04:11:57:15]: Info: Color range: [JPEG]
[2023:06:04:11:57:15]: Warning: vaapi: hevc missing sps->vui parameters
[2023:06:04:11:57:15]: Info:
[2023:06:04:11:57:15]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2023:06:04:11:57:15]: Info:
[2023:06:04:11:57:15]: Info: Found encoder vaapi: [h264_vaapi, hevc_vaapi]
[2023:06:04:11:57:15]: Info: Executing Do Cmd: [/home/dries/Apps/Scripts/4k.sh]
[2023:06:04:11:57:15]: Error: Couldn't run [/home/dries/Apps/Scripts/4k.sh]: System: No such file or directory
Is there an existing issue for this?
Is your issue described in the documentation?
Is your issue present in the nightly release?
Describe the Bug
With the Flatpak release, auto-start is not possible by default, and permissions are unclear.
Documentation mentions that is preferred to install as root, but then systemd user service runs as normal user.
The example start line is "sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') flatpak run dev.lizardbyte.sunshine" requiring manually starting it and entering password every time.
Additionally the default application for normal and high quality are not working either from the flatpak version.
Expected Behavior
Easy waty to start/stop and use the flatpak release. (Seems to be the best option for most distributions, tested on Fedora 37 myself)
Additional Context
As a test to improve the situation, I created the following improvements, but not there yet completely.
Created /usr/local/bin/sunshine:
Changed ~/.config/systemd/user/sunshine.service to:
Added these lines to visudo:
USERNAME ALL= NOPASSWD: /usr/local/bin/sunshineTested also with graphical-session.target instead of default.target, but both don't give auto-start after enabling:
systemctl --user enable sunshine
Manually executing start/stop works fine now as user without the need to enter password:
works fine with these changes now.
Don't understand why its still not auto-starting upon user login? What I'm missing here?
For the resolution change, I would like to have 2 applications, 1 offering a 4K stream, and 1 offering a 2K stream with wayland on gnome.
I created the following scripts that allow changing the resolution of the system unattended:
sudo dnf install ydotool
sudo systemctl --user enable --now ydotool
/home/dries/Apps/Scripts/2k.sh
/home/dries/Apps/Scripts/4k.sh
However I still fail to execute these script from within the flatpak sandbox.

I changed the settings with Flatseal to give access to these scripts:
But somehow this isn't enough to start these scripts from within sunshine:

Any ideas what I'm missing here to get it started from within sunshine flatpak?
Additionally, can my attempts to improve the flatpak installation be added to the flatpak installer somehow? Or can an alternative be added that would result in the same improved user experience that would allow for auto-start from userspace but running with sudo/root privileges as the actual user? Could the scripts for resolution change be integrated somehow?
As a sidenote: I discoceverd this project because my son is gaming, and really like the project. In such a way that I'm trying to use it for every day general remote desktop, as it is the best remote desktop solution with hardware acceleration support and delivering an amazing capable desktop as if you would be working locally! despite other generic remote desktop solutions were typical the hardware acceleration is missing, and such high resolution and low latencies are not reachable at all.
Host Operating System
Linux
Operating System Version
Linux, Fedora 37 Flatpak
Architecture
64 bit
Sunshine commit or version
0.20.0
Package
Linux - flatpak
GPU Type
Nvidia
GPU Model
amdgpu,nouveau
GPU Driver/Mesa Version
23.0.3
Capture Method (Linux Only)
KVM
Config
fps = [30,60] resolutions = [ 1920x1080, 3840x2160 ]Apps
{ "env": { "PATH": "$(PATH):$(HOME)\/.local\/bin" }, "apps": [ { "name": "Desktop", "image-path": "desktop.png", "prep-cmd": [ { "do": "\/home\/dries\/Apps\/Scripts\/4k.sh", "undo": "" }, { "do": "", "undo": "" }, { "do": "", "undo": "" } ], "exclude-global-prep-cmd": "false", "working-dir": "" }, { "name": "Low Res Desktop", "image-path": "desktop.png", "prep-cmd": [ { "do": "\/home\/dries\/Apps\/Scripts\/2k.sh", "undo": "" } ], "exclude-global-prep-cmd": "false", "working-dir": "" }, { "name": "Steam Big Picture", "detached": [ "flatpak-spawn --host setsid steam steam:\/\/open\/bigpicture" ], "image-path": "steam.png" } ] }Relevant log output