Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Unable to run Sunshine Flatpak on Fedora atomic desktops with Wayland (Kinoite 40, Silverblue 40, Aurora, Bluefin)

Open wiseindy opened this issue 1 year ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your issue described in the documentation?

  • [X] I have read the documentation

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

I've been trying to run the Sunshine flatpak on Fedora atomic desktops running Wayland, however, I keep seeing this error even after following this guide here https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/setup.html#install

Attention! Sunshine detected these errors during startup. We STRONGLY RECOMMEND fixing them before streaming.

    Fatal: You must run [sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))] for KMS display capture to work! If you installed from AppImage or Flatpak, please refer to the official documentation: https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/setup.html#install
    Fatal: Unable to find display or encoder during startup.
    Fatal: Please check that a display is connected and powered on. 

I've also searched and read through other issues (e.g. https://github.com/LizardByte/Sunshine/issues/2840), however, nothing has worked for me.

The flatpak works on X11, but not on Wayland.

I've tried the latest release as well as the pre-releases with no luck.

Expected Behavior

Sunshine flatpak should run on Wayland

Additional Context

No response

Host Operating System

Linux

Operating System Version

Fedora Kinoite 40

Architecture

64 bit

Sunshine commit or version

v2024.730.191523

Package

Linux - flatpak

GPU Type

Intel

GPU Model

Intel UHD Graphics 630

GPU Driver/Mesa Version

Mesa Intel(R) UHD Graphics 630 (CFL GT2)

Capture Method

None

Config

default

Apps

No response

Relevant log output

[2024:08:02:13:30:14]: Info: Sunshine version: v2024.730.191523
[2024:08:02:13:30:14]: Error: Couldn't load cuda: -1
[2024:08:02:13:30:14]: Info: Found display [/run/flatpak/wayland-0]
[2024:08:02:13:30:14]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2024:08:02:13:30:14]: Info: Found interface: wl_output(61) version 4
[2024:08:02:13:30:14]: Warning: Missing Wayland wire for wlr-export-dmabuf
[2024:08:02:13:30:14]: Error: Failed to gain CAP_SYS_ADMIN
[2024:08:02:13:30:14]: Info: /dev/dri/card0 -> i915
[2024:08:02:13:30:14]: Error: Failed to gain CAP_SYS_ADMIN
[2024:08:02:13:30:14]: Error: Couldn't get handle for DRM Framebuffer [127]: Probably not permitted
[2024:08:02:13:30:14]: Fatal: You must run [sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))] for KMS display capture to work!
If you installed from AppImage or Flatpak, please refer to the official documentation:
https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/setup.html#install
[2024:08:02:13:30:14]: Info: Found display [/run/flatpak/wayland-0]
[2024:08:02:13:30:14]: Info: Found display [/run/flatpak/wayland-0]
[2024:08:02:13:30:14]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2024:08:02:13:30:14]: Info: Found interface: wl_output(61) version 4
[2024:08:02:13:30:14]: Info: Resolution: 2560x1440
[2024:08:02:13:30:14]: Info: Offset: 0x0
[2024:08:02:13:30:14]: Info: Logical size: 2560x1440
[2024:08:02:13:30:14]: Info: Name: HDMI-A-2
[2024:08:02:13:30:14]: Info: Found monitor: HP Inc. OMEN by HP 27/CNK7201MB7   
[2024:08:02:13:30:14]: Info: -------- Start of KMS monitor list --------
[2024:08:02:13:30:14]: Warning: Mismatch on expected Resolution compared to actual resolution: 0x0 vs 2560x1440
[2024:08:02:13:30:14]: Info: Monitor 0 is HDMI-A-2: HP Inc. OMEN by HP 27/CNK7201MB7   
[2024:08:02:13:30:14]: Info: --------- End of KMS monitor list ---------
[2024:08:02:13:30:14]: Error: Unable to initialize capture method
[2024:08:02:13:30:14]: Error: Platform failed to initialize
[2024:08:02:13:30:14]: Warning: Gamepad ds5 is disabled due to Permission denied
[2024:08:02:13:30:14]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:08:02:13:30:14]: Info: Trying encoder [nvenc]
[2024:08:02:13:30:14]: Info: System tray created
[2024:08:02:13:30:15]: Info: Encoder [nvenc] failed
[2024:08:02:13:30:15]: Info: Trying encoder [vaapi]
[2024:08:02:13:30:15]: Info: Encoder [vaapi] failed
[2024:08:02:13:30:15]: Info: Trying encoder [software]
[2024:08:02:13:30:15]: Info: Encoder [software] failed
[2024:08:02:13:30:15]: Fatal: Unable to find display or encoder during startup.
[2024:08:02:13:30:15]: Fatal: Please check that a display is connected and powered on.
[2024:08:02:13:30:15]: Error: Video failed to find working encoder
[2024:08:02:13:30:15]: Info: Configuration UI available at [https://localhost:47990]
[2024:08:02:13:30:15]: Info: Adding avahi service Sunshine
[2024:08:02:13:30:16]: Info: Avahi service Sunshine successfully established.

wiseindy avatar Aug 02 '24 17:08 wiseindy

What is the command you used to start Sunshine?

ReenigneArcher avatar Aug 02 '24 17:08 ReenigneArcher

First I run setcap (got this from https://github.com/LizardByte/Sunshine/issues/2840), followed by flatpak run

sudo setcap cap_sys_admin+p $(readlink -f $(find /var/lib/flatpak/app -name sunshine | grep /bin/sunshine))
flatpak run dev.lizardbyte.app.Sunshine

wiseindy avatar Aug 02 '24 17:08 wiseindy

I have no idea if that command works. I expect it doesn't due to the sandboxing of flatpak.

This is the command in our docs for the pre-release.

sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') \
  flatpak run dev.lizardbyte.app.Sunshine

https://docs.lizardbyte.dev/projects/sunshine/en/master/about/setup.html#install

ReenigneArcher avatar Aug 02 '24 18:08 ReenigneArcher

Yeah I tried that too. Sunshine doesn't start

$ sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') \
  flatpak run dev.lizardbyte.app.Sunshine
bwrap: Can't find source path /run/user/1000/pulse/native: Permission denied

The path does indeed exist

$ ls /run/user/1000/pulse/native
/run/user/1000/pulse/native
$ pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 91
Tile Size: 65472
User Name: redacted
Host Name: redacted
Server Name: PulseAudio (on PipeWire 1.0.7)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_00_1f.3.analog-stereo
Default Source: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
Cookie: ef46:e3d8

$ (pactl info | awk '/Server String/{print$3}')
/run/user/1000/pulse/native

I've tried giving additional permissions to Sunshine flatpak via Flatseal, tried a reboot as well. No luck

wiseindy avatar Aug 02 '24 18:08 wiseindy

Sorry, I don't know. Maybe @istori1 has some idea?

ReenigneArcher avatar Aug 02 '24 18:08 ReenigneArcher

No worries, thank you for helping!

For the bwrap issue, I came across this https://github.com/LizardByte/Sunshine/discussions/569#discussioncomment-8654055, but it didn't help sadly

$ cp /usr/bin/bwrap /home/<user>/writable/dir/

$ sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') FLATPAK_BWRAP=/home/<user>/writable/dir/bwrap flatpak run dev.lizardbyte.app.Sunshine
bwrap: Can't find source path /run/user/1000/pulse/native: Permission denied

It's this combination of Flatpak + Wayland + Atomic desktop which is proving to be a challenge. Switching to X11 or a non-atomic desktop works.

Are there any reports of the above combination working for anyone?

wiseindy avatar Aug 02 '24 18:08 wiseindy

Atomic desktop

Honestly, I've never heard of it.

ReenigneArcher avatar Aug 02 '24 21:08 ReenigneArcher

Atomic desktop

Honestly, I've never heard of it.

It's basically an operating system with much of the root filesystem locked down as read-only

AesaraB avatar Aug 10 '24 22:08 AesaraB

Are there any reports of the above combination working for anyone?

You forgot to grant bwrap setuid

chmod u+s /home/<user>/writable/dir/bwrap

There is also a custom variant of bwrap in COPR but I haven't tried it yet. It has instructions for rpm-ostree based distros. https://copr.fedorainfracloud.org/coprs/34n0s/bubblewrap-suid/

XT-Martinez avatar Sep 21 '24 03:09 XT-Martinez

I've inadvertently mirrored this issue here - https://github.com/LizardByte/Sunshine/issues/3181

I do not know how to consolidate.

If you have an intel iGPU, use it instead to nip this issue.

It is making the AMD encoder unusable - I would rather haul my gaming pc around with me than put up with this incredibly blurry result.

skunk-funk avatar Sep 27 '24 21:09 skunk-funk

I'm working on adding an automated copr build here: https://github.com/LizardByte/Sunshine/pull/3239

If there's any fedora/copr experts here, I could use some assistance with a few things.

ReenigneArcher avatar Sep 29 '24 17:09 ReenigneArcher

I wouldn't suggest using flatpak on an atomic os, as you can't run the additional install steps. Instead you should use the RPMs.

For the RPMs:

The atomic desktop issue was fixed by https://github.com/LizardByte/Sunshine/pull/3050

Also...

LizardByte now has copr repos you can use to install Sunshine. Currently fedora 39-41 and rawhide are supported for aarch64 and x86_64. All builds also have cuda support (v12.6.2).

https://docs.lizardbyte.dev/projects/sunshine/en/master/md_docs_2getting__started.html#fedora

Note: stable will be empty until the next stable release.

Anyway, closing this as I don't believe there is anything we can do to make flatpak work on atomic desktops.

ReenigneArcher avatar Oct 07 '24 02:10 ReenigneArcher

Think I have the same issue.

This flatpak used to work great last year on Fedora Silverblue 39 (aka Fedora Atomic Workstation, rpm-ostree based) for Steam etc and without needing any extra rpmfusion RPMs.

Now it no longer works on Fedora Silverblue 40:

sudo -i PULSE_SERVER=unix:/run/user/$(id -u)/pulse/native flatpak run dev.lizardbyte.app.Sunshine
bwrap: Can't find source path /run/user/1000/pulse/native: Permission denied

When I leave out PULSE_SERVER, it starts OK and has no sound, but also the video feed on the client shows as a black screen. This might be related to new Wayland screen sharing features and permissions, so there looks to be 2 separate issues with video and sound.

jwmullally avatar Oct 09 '24 20:10 jwmullally

@jwmullally if you're using the beta, the video issue is probably from https://github.com/LizardByte/Sunshine/issues/3268

ReenigneArcher avatar Oct 10 '24 01:10 ReenigneArcher

I'm on openSUSE Tumbleweed and get this exact bwrap error.

lavadrop avatar Oct 20 '24 19:10 lavadrop

After hours trying to make it work I see now it won't run on bluefin (from fedora silverblue 40). The flatpak's flathub page should have a disclaimer.

fpatrick avatar Oct 25 '24 20:10 fpatrick

I don't know what bluefin is, but we have a copr repo (in beta) for fedora 39-42. https://copr.fedorainfracloud.org/coprs/lizardbyte

We already have disclaimers in the docs that you should use the package for your distro if available. But if you want a more clear disclaimer, the flathub package will be synced with our repo on the next stable release. So any updates here will update there: https://github.com/LizardByte/Sunshine/tree/master/packaging/linux/flatpak

PRs are welcome to help improve.

ReenigneArcher avatar Oct 25 '24 20:10 ReenigneArcher

I don't know what bluefin is, but we have a copr repo (in beta) for fedora 39-42. https://copr.fedorainfracloud.org/coprs/lizardbyte

We already have disclaimers in the docs that you should use the package for your distro if available. But if you want a more clear disclaimer, the flathub package will be synced with our repo on the next stable release. So any updates here will update there: https://github.com/LizardByte/Sunshine/tree/master/packaging/linux/flatpak

PRs are welcome to help improve.

I saw disclaimer to avoid flatpak if possible, but In immutable distros such as bluefin and bazzite the way to install any application is through flatpak or distrobox/toolbox (or adding layers which is bad practice).

Thanks for the infos.

fpatrick avatar Oct 25 '24 23:10 fpatrick

I am currently having the same issue in Kubuntu 24.10, sunshine version v2024.1108.41533 setcat command doesn't seem to be working properly. I've tried

sudo setcap cap_sys_admin+p /home//.local/share/flatpak/app/dev.lizardbyte.app.Sunshine/x86_64/master/35bbf3aa84d38c6ff8634d929278777a20e422719dbc3e34f532738b79937e41/files/bin/sunshine-v2024.1108.41533

from

find ~ -name sunshine

Even though I check the result like this

❯ sudo getcap /home/<my-user>/.local/share/flatpak/app/dev.lizardbyte.app.Sunshine/x86_64/master/35bbf3aa84d38c6ff8634d929278777a20e422719dbc3e34f532738b79937e41/files/bin/sunshine-v2024.1108.41533
/home/<my-user>/.local/share/flatpak/app/dev.lizardbyte.app.Sunshine/x86_64/master/35bbf3aa84d38c6ff8634d929278777a20e422719dbc3e34f532738b79937e41/files/bin/sunshine-v2024.1108.41533 cap_sys_admin=p

When flatpak installed at user level, at system paths change but same result

dramirezRT avatar Nov 08 '24 09:11 dramirezRT

This issue also applies to Bazzite. It too is an Atomic Fedora setup, using the Steam OS tooling to give x86 users a SteamDeck like experience on handhelds and PCs.

bugs181 avatar Nov 15 '24 18:11 bugs181

This issue also applies to Bazzite. It too is an Atomic Fedora setup, using the Steam OS tooling to give x86 users a SteamDeck like experience on handhelds and PCs.

On bazzite you can run: ujust setup-sunshine

It install a working version of sunshine.

fpatrick avatar Nov 15 '24 18:11 fpatrick

On bazzite you can run: ujust setup-sunshine

It install a working version of sunshine.

Just a heads up that sunshine has been broken on the ujust Bazzite installer for ~6 months, hence why people have been trying to look for alternative install methods

NovaCyntax avatar Dec 15 '24 19:12 NovaCyntax

This issue seems to be with btrfs when used on Fedora.

https://gitlab.com/btrfs-assistant/btrfs-assistant/-/issues/105

ReenigneArcher avatar Feb 02 '25 23:02 ReenigneArcher

While it is not a direct answer to flatpak version of sunshine's issue. I was running the following command to setup sunshine on bluefin:

$ sudo dnf copr enable lizardbyte/beta
$ sudo rpm-ostree install Sunshine

After a reboot(tweaking ostree requires rebooting), I can simply run sunshine in a terminal to start sunshine and everything just works.

The only quirk is that I'm running on latest bluefin with Fedora Silverblue 42, I couldn't locate Sunshine package with lizardbyte/stable(maybe stable channel is missing binary package for Fedora 42)? But when I switch to beta channel everything just works.

xxuejie avatar May 20 '25 04:05 xxuejie

The only quirk is that I'm running on latest bluefin with Fedora Silverblue 42, I couldn't locate Sunshine package with lizardbyte/stable(maybe stable channel is missing binary package for Fedora 42)? But when I switch to beta channel everything just works.

It's due to the timing of the releases. We haven't created a stable release since we added support for F42

ReenigneArcher avatar May 20 '25 15:05 ReenigneArcher

The only quirk is that I'm running on latest bluefin with Fedora Silverblue 42, I couldn't locate Sunshine package with lizardbyte/stable(maybe stable channel is missing binary package for Fedora 42)? But when I switch to beta channel everything just works.

It's due to the timing of the releases. We haven't created a stable release since we added support for F42

Yeah that makes sense, thanks for confirming.

xxuejie avatar May 21 '25 00:05 xxuejie