Bug 433388 - Snap apps don't run anymore on Plasma Wayland 5.21
Summary: Snap apps don't run anymore on Plasma Wayland 5.21
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.21.0
Platform: Snap Linux
: HI crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression, wayland
Depends on:
Blocks:
 
Reported: 2021-02-21 14:50 UTC by Nicola Jelmorini
Modified: 2021-03-02 11:59 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Jelmorini 2021-02-21 14:50:46 UTC
SUMMARY
The snap apps I have installed on my system don't run anymore since the upgrade to Plasma Wayland 5.21. It's important to say that all the snap apps worked perfectly until the version 5.20 of Plasma Wayland.

STEPS TO REPRODUCE
1. Choose the snap app you want to run
2. Click the launcher

OBSERVED RESULT
IF you wait for the main window of the app to open, nothing happen.
If you run the launcher command in a terminal, you can see the error messages. 
Here some examples:
1) KeePassXC
----------------------- ERROR MESSAGES ----------------------------------------
env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/keepassxc_keepassxc.desktop /snap/bin/keepassxc %f
No protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :1
Could not connect to any X display.


2) Standard Notes
----------------------- ERROR MESSAGES ----------------------------------------
env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/standard-notes_standard-notes.desktop /snap/bin/standard-notes %U
No protocol specified
fish: Job 1, 'env BAMF_DESKTOP_FILE_HINT=/var…' terminated by signal SIGSEGV (Address boundary error)


3) Firefox
----------------------- ERROR MESSAGES ----------------------------------------
env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/firefox_firefox.desktop /snap/bin/firefox %u
No protocol specified
Unable to init server: Impossibile connettersi: Connection refused
Error: cannot open display: :1



EXPECTED RESULT
The snap apps should simply run as they run until the Plasma Wayland 5.20 version.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: KDE Neon / KDE Plasma
(available in About System)
KDE Plasma Version: 5.21.0
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Nicola Jelmorini 2021-02-22 16:47:22 UTC
I can add that only snap apps with a GUI have this issue. Snap that use only the terminal run correctly.
Comment 2 Nate Graham 2021-02-22 20:43:09 UTC
If you use the CLI, but run the app using `kstart5`, does the issue still happen?
Comment 3 Vlad Zahorodnii 2021-02-22 21:23:25 UTC
It seems like an Xauthority issue.
Comment 4 Vlad Zahorodnii 2021-02-22 21:29:17 UTC
Could it be that the Xauthority file is not forwarded to snap applications?
Comment 5 David Edmundson 2021-02-22 22:26:33 UTC
Yes, or they run with a private /tmp
Comment 6 Vlad Zahorodnii 2021-02-25 13:24:32 UTC
I've installed snap on my system. X11 snap applications work as expected both in git master and 5.21.

```
~
❯ env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/firefox_firefox.desktop /snap/bin/firefox
/usr/share/libdrm/amdgpu.ids: No such file or directory
Gtk-Message: 15:19:56.118: Failed to load module "window-decorations-gtk-module"
Gtk-Message: 15:19:56.118: Failed to load module "colorreload-gtk-module"
[GFX1-]: glxtest: libpci missing

###!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost


~ 9s
❯ 
```

Could it be an installation issue? or maybe neon doesn't ship some of the Xauthority patches in Plasma/5.21? As far as I understand, the contents of the host XAUTHORITY file is copied to snap.

https://github.com/snapcore/snapd/blob/da5b5bb893e6bc733d63da561892901dcb42d934/cmd/snap/cmd_run.go#L534
Comment 7 Vlad Zahorodnii 2021-02-25 13:29:17 UTC
https://github.com/snapcore/snapd/blob/da5b5bb893e6bc733d63da561892901dcb42d934/cmd/snap/cmd_run.go#L581

If I understand code correctly, snapd wants the host XAUTHORITY file to be in /tmp? If that's true, is snapd too nitpicky?
Comment 8 Vlad Zahorodnii 2021-02-25 13:37:27 UTC
Aha, if snap can't migrate the Xauthority file, it will just use the host authority file. 

@Nicola can you please check what value the XAUTHORITY environment variable has?

   echo $XAUTHORITY
Comment 9 Nicola Jelmorini 2021-02-25 16:19:48 UTC
(In reply to Vlad Zahorodnii from comment #8)
> Aha, if snap can't migrate the Xauthority file, it will just use the host
> authority file. 
> 
> @Nicola can you please check what value the XAUTHORITY environment variable
> has?
> 
>    echo $XAUTHORITY

This is the output:
➤ echo $XAUTHORITY 
/run/user/1000/xauth_OtrFRQ
Comment 10 David Edmundson 2021-03-02 11:59:39 UTC
This has been fixed upstream:

https://github.com/snapcore/snapd/commit/11264948f151a3573249f19a9dbd4c48666efa8c