Problems with releasing fclones-gui: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied

I’m trying to publish fclones-gui as a snap:

I managed to upload it, got the approval for DBus name, but when I try to install it, I’m still getting:

$ snap refresh fclones-gui
fclones-gui v0.1.3+git1.988f58d from Piotr Kołaczkowski (pkolaczk-u) refreshed

$ fclones-gui
Failed to register: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Connection ":1.3532" is not allowed to own the service "pkolaczk.fclones" due to AppArmor policy

What am I doing wrong?

BTW: If I install it with --dev-mode flag, it launches fine.

Hey there the problem arises due to the fact that you arent using upstream dbus id to fix this error change the dbus id to the upstream one, it will fix that, also try to use snappy-debug in future as it will highlight the upstream dbus id and also help in detecting errors with snap confinement things like plugs etc.

For anyone having a similar problem - I’ve found the solution.

My snapcraft.yaml was ok. The problem was the app setting wrong application id on GTK4 initialization.

    let relm = RelmApp::new("io.github.pkolaczk.Fclones");

Looks like this id passed here must much the name in the snapcraft.yaml dbus slot.

I don’t understand, what do you mean by “upstream dbus id” ? After fixing the app id in the app binary, it works fine now. No change to snapcraft.yaml was needed.

Good ,sometimes when we use custom dbus ids different from upstream one it occurs so i thought you have the same use case, anyway good to see you got a fix for it.