I have added KDE plasma integration to my snap in order for it to look at home on KDE, however when trying to open a file, the native file picker produces an error (see screenshot). I get these AppArmour denials from snappy-debug
:
Time: Jun 21 20:20:27
Log: apparmor="DENIED" operation="dbus_signal" bus="session" path="/" interface="org.kde.KDirNotify" member="leftDirectory" mask="send" name="org.freedesktop.DBus" pid=6289 label="snap.yuzu.yuzu" peer_pid=1397 peer_label="unconfined"
DBus access
= AppArmor =
Time: Jun 21 20:20:27
Log: apparmor="DENIED" operation="dbus_signal" bus="session" path="/" interface="org.kde.KDirNotify" member="enteredDirectory" mask="send" name="org.freedesktop.DBus" pid=6289 label="snap.yuzu.yuzu" peer_pid=1397 peer_label="unconfined"
DBus access
= AppArmor =
Time: Jun 21 20:20:27
Log: apparmor="DENIED" operation="dbus_signal" bus="session" path="/" interface="org.kde.KDirNotify" member="leftDirectory" mask="send" name="org.freedesktop.DBus" pid=6289 label="snap.yuzu.yuzu" peer_pid=1397 peer_label="unconfined"
DBus access
= AppArmor =
Time: Jun 21 20:20:27
Log: apparmor="DENIED" operation="dbus_signal" bus="session" path="/" interface="org.kde.KDirNotify" member="enteredDirectory" mask="send" name="org.freedesktop.DBus" pid=6289 label="snap.yuzu.yuzu" peer_pid=1397 peer_label="unconfined"
DBus access
= AppArmor =
Time: Jun 21 20:20:27
Log: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/KLauncher" interface="org.kde.KSlaveLauncher" member="requestSlave" mask="send" name="org.kde.klauncher5" pid=6289 label="snap.yuzu.yuzu" peer_pid=1361 peer_label="unconfined"
DBus access
![klauncherError](https://forum.snapcraft.io/images/transparent.png)
Snapcraft.yaml: https://github.com/Nightmayr/yuzu-snap/blob/master/snap/snapcraft.yaml
Tested on Kubuntu 20.04
From the klauncher man page: “klauncher is a daemon responsible for service activation in KDE. It operates closely together with the kdeinit master process to start new processes. KDE applications communicate with klauncher via DCOP to start new applications or services.”
Naively adding the DBus accesses for klauncher to snapd would allow immediate confinement escape so klauncher and snapd would need to integrate in some manner for this to work with strict confinement (this is not entirely dissimilar to the issues gvfs/gio face).
The simple answer to your question is “don’t use klauncher” but I understand that isn’t helpful. There are other KDE applications in the store so perhaps the KDE snap developers can comment?
Thanks @jdstrand, I managed to find a workaround and it was a case of your simple answer of “don’t use klauncher”. The addition I made was to add the environment variable KDE_FORK_SLAVES: 1
. With the variable set the klauncher error disappeared but a new error of being unable to find the kioslave5
binary appeared. I tried setting KF5_LIBEXEC_DIR: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libexec/kf5"
but this didn’t help even though most examples I’ve seen use this variable to allow discovery of the binary. What worked for me was appending the directory to PATH, PATH: "$PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libexec/kf5"
I managed to find out about this by looking at the VLC snapcraft.yaml: https://github.com/videolan/vlc/tree/master/extras/package/snap.
They seem to set these variables in a wrapper script vlc-snap-wrapper.sh
The end result is that the native file picker works in KDE with these changes.
1 Like
@galgalesh - I wonder if The kde-neon extension or similar should be updated to make this easier for people?
I think this is already fixed in the kde-neon extension. Apps created with that extension have the native file chooser by default on kde and I haven’t encountered that error message.
VLC and OP’s app don’t use that extension.