canonical / snapd-desktop-integration

User session helpers for snapd
GNU General Public License v3.0
15 stars 10 forks source link

Service snapd-desktop-integration reloads every 2 seconds #71

Open hvbakel opened 1 year ago

hvbakel commented 1 year ago

On an up to date Ubuntu 22.04.3 installation the snapd-desktop-integration service reloads every 2 seconds, spamming journalctl with the following messages:

Aug 12 08:45:11 hostname systemd[4446]: snap.snapd-desktop-integration.snapd-desktop-integration.service: Scheduled restart job, restart counter is at 169.
Aug 12 08:45:11 hostname systemd[4446]: Stopped Service for snap application snapd-desktop-integration.snapd-desktop-integration.
Aug 12 08:45:11 hostname systemd[4446]: Started Service for snap application snapd-desktop-integration.snapd-desktop-integration.
Aug 12 08:45:11 hostname snapd-desktop-i[1704533]: Failed to do gtk init. Waiting for a new session with desktop capabilities.
Aug 12 08:45:11 hostname snapd-desktop-i[1704533]: Checking session /org/freedesktop/login1/session/_3272...
Aug 12 08:45:11 hostname snapd-desktop-i[1704533]: Is a desktop session! Forcing a reload.
Aug 12 08:45:11 hostname snapd-desktop-i[1704533]: Loop exited. Forcing reload.

Based on forum threads I could find (e.g. https://askubuntu.com/questions/1443676/snapd-desktop-integration-syslog-spam) it looks like this issue should be solved with the version released earlier this year, but with v0.9 from the stable or candidate channel the issue seems to persist even when running in a graphical desktop session.

Ziris85 commented 6 months ago

Marking myself as affected by this too. For me, it seems to crop up specifically if I choose Ubuntu on Xorg during login (which is necessary in my case because xscreensaver doesn't seem to work properly on wayland at present). I found this reddit post about an issue with firefox that I was having that seemed to be related to this, and the suggested fix there was to restart the machine after selecting the Xorg option. Sure enough, after rebooting my system, both those repeated integration error messages stopped and firefox started working again. That sort of leads me to believe that the issue isn't with this or any one particular snap, but maybe with snapd in general on Xorg displays?

sergio-costas commented 1 month ago

Mmm... good point the Ubuntu on Xorg detail... checking it...

sergio-costas commented 1 month ago

I'm still unable to reproduce this bug. Can you check the logs? (open a terminal and type sudo journalctl, then go to the end -it will take a while- and check what shows when it is relaunched; or another way is to type sudo journalctl -f, which will show in realtime the new events... see if it shows something related to snapd-desktop-integration when it relaunches).

guruevi commented 1 month ago

Still happens on Ubuntu 22.04.4 LTS. This just repeat endlessly, there are no other logs between. This happens after a desktop is launched. Here are all the logs when this begins:

[code] Jul 31 10:15:20 nsc-sidon-vm gsd-media-keys[3665]: Failed to grab accelerator for keybinding settings:screen-brightness-down Jul 31 10:15:21 nsc-sidon-vm gsd-media-keys[3665]: Unable to inhibit keypresses: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied Jul 31 10:15:21 nsc-sidon-vm gnome-shell[3449]: GNOME Shell started at Wed Jul 31 2024 10:15:20 GMT-0400 (EDT) Jul 31 10:15:21 nsc-sidon-vm gnome-shell[3449]: Registering session with GDM Jul 31 10:15:21 nsc-sidon-vm systemd[2982]: snap.snapd-desktop-integration.snapd-desktop-integration.service: Scheduled restart job, restart counter is at 1. Jul 31 10:15:21 nsc-sidon-vm systemd[2982]: Stopped Service for snap application snapd-desktop-integration.snapd-desktop-integration. Jul 31 10:15:21 nsc-sidon-vm systemd[2982]: Started Service for snap application snapd-desktop-integration.snapd-desktop-integration. Jul 31 10:15:21 nsc-sidon-vm snapd-desktop-i[3929]: Failed to do gtk init. Waiting for a new session with desktop capabilities. Jul 31 10:15:21 nsc-sidon-vm snapd-desktop-i[3929]: Checking session /org/freedesktop/login1/session/_32... Jul 31 10:15:21 nsc-sidon-vm snapd-desktop-i[3929]: Checking session /org/freedesktop/login1/session/c1... Jul 31 10:15:21 nsc-sidon-vm snapd-desktop-i[3929]: Checking session /org/freedesktop/login1/session/c2... Jul 31 10:15:21 nsc-sidon-vm snapd-desktop-i[3929]: Is a desktop session! Forcing a reload. Jul 31 10:15:21 nsc-sidon-vm snapd-desktop-i[3929]: Loop exited. Forcing reload. Jul 31 10:15:21 nsc-sidon-vm NetworkManager[996]: [1722435321.6087] agent-manager: agent[be451185c8a432e0,:1.124/org.gnome.Shell.NetworkAgent/1316130666]: agent registered Jul 31 10:15:21 nsc-sidon-vm systemd[1]: Started crash report submission. Jul 31 10:15:21 nsc-sidon-vm sssd_nss[1153]: Enumeration requested but not enabled Jul 31 10:15:21 nsc-sidon-vm whoopsie[3935]: [10:15:21] Using lock path: /var/lock/whoopsie/lock Jul 31 10:15:21 nsc-sidon-vm systemd[1]: whoopsie.service: Deactivated successfully. Jul 31 10:15:22 nsc-sidon-vm gsd-color[3684]: failed to create device: could not check org.freedesktop.color-manager.create-device for auth: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying Jul 31 10:15:22 nsc-sidon-vm systemd[1]: Started crash report submission. Jul 31 10:15:22 nsc-sidon-vm systemd[1]: polkit.service: Main process exited, code=dumped, status=11/SEGV Jul 31 10:15:22 nsc-sidon-vm systemd[1]: polkit.service: Failed with result 'core-dump'. Jul 31 10:15:22 nsc-sidon-vm systemd[1]: polkit.service: Consumed 1.680s CPU time. Jul 31 10:15:22 nsc-sidon-vm whoopsie[3938]: [10:15:22] Using lock path: /var/lock/whoopsie/lock Jul 31 10:15:22 nsc-sidon-vm systemd[1]: whoopsie.service: Deactivated successfully. Jul 31 10:15:22 nsc-sidon-vm geoclue[2569]: Service not used for 60 seconds. Shutting down.. Jul 31 10:15:22 nsc-sidon-vm systemd[1]: geoclue.service: Deactivated successfully. Jul 31 10:15:23 nsc-sidon-vm systemd[1]: realmd.service: Deactivated successfully. Jul 31 10:15:23 nsc-sidon-vm systemd[2982]: snap.snapd-desktop-integration.snapd-desktop-integration.service: Scheduled restart job, restart counter is at 2. Jul 31 10:15:23 nsc-sidon-vm systemd[2982]: Stopped Service for snap application snapd-desktop-integration.snapd-desktop-integration. Jul 31 10:15:23 nsc-sidon-vm systemd[2982]: Started Service for snap application snapd-desktop-integration.snapd-desktop-integration. Jul 31 10:15:23 nsc-sidon-vm snapd-desktop-i[3993]: Failed to do gtk init. Waiting for a new session with desktop capabilities. Jul 31 10:15:23 nsc-sidon-vm snapd-desktop-i[3993]: Checking session /org/freedesktop/login1/session/_32... Jul 31 10:15:23 nsc-sidon-vm snapd-desktop-i[3993]: Checking session /org/freedesktop/login1/session/c1... Jul 31 10:15:23 nsc-sidon-vm snapd-desktop-i[3993]: Checking session /org/freedesktop/login1/session/c2... Jul 31 10:15:23 nsc-sidon-vm snapd-desktop-i[3993]: Is a desktop session! Forcing a reload. Jul 31 10:15:23 nsc-sidon-vm snapd-desktop-i[3993]: Loop exited. Forcing reload. Jul 31 10:15:24 nsc-sidon-vm kernel: [ 119.937484] [UFW BLOCK] IN=enp6s18 OUT= MAC=01:00:5e:00:00:01:00:de:fb:41:bf:42:08:00 SRC=10.221.129.251 DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=41883 PROTO=2 Jul 31 10:15:25 nsc-sidon-vm dbus-daemon[3080]: [session uid=1316130666 pid=3078] Activating service name='org.gnome.Terminal' requested by ':1.68' (uid=1316130666 pid=4033 comm="/usr/bin/gnome-terminal.real " label="unconfined") Jul 31 10:15:25 nsc-sidon-vm dbus-daemon[3080]: [session uid=1316130666 pid=3078] Successfully activated service 'org.gnome.Terminal' Jul 31 10:15:25 nsc-sidon-vm systemd[2982]: snap.snapd-desktop-integration.snapd-desktop-integration.service: Scheduled restart job, restart counter is at 3. Jul 31 10:15:25 nsc-sidon-vm systemd[2982]: Stopped Service for snap application snapd-desktop-integration.snapd-desktop-integration. Jul 31 10:15:25 nsc-sidon-vm systemd[2982]: Started Service for snap application snapd-desktop-integration.snapd-desktop-integration. Jul 31 10:15:26 nsc-sidon-vm kernel: [ 121.570750] kauditd_printk_skb: 16 callbacks suppressed Jul 31 10:15:26 nsc-sidon-vm kernel: [ 121.570752] audit: type=1400 audit(1722435326.003:2321): apparmor="DENIED" operation="capable" class="cap" profile="/usr/lib/snapd/snap-confine" pid=4079 comm="snap-confine" capability=12 capname="net_admin" Jul 31 10:15:26 nsc-sidon-vm kernel: [ 121.570758] audit: type=1400 audit(1722435326.003:2322): apparmor="DENIED" operation="capable" class="cap" profile="/usr/lib/snapd/snap-confine" pid=4079 comm="snap-confine" capability=38 capname="perfmon" Jul 31 10:15:26 nsc-sidon-vm snapd-desktop-i[4141]: Failed to do gtk init. Waiting for a new session with desktop capabilities. Jul 31 10:15:26 nsc-sidon-vm snapd-desktop-i[4141]: Checking session /org/freedesktop/login1/session/_32... Jul 31 10:15:26 nsc-sidon-vm snapd-desktop-i[4141]: Checking session /org/freedesktop/login1/session/c1... Jul 31 10:15:26 nsc-sidon-vm snapd-desktop-i[4141]: Checking session /org/freedesktop/login1/session/c2... Jul 31 10:15:26 nsc-sidon-vm snapd-desktop-i[4141]: Is a desktop session! Forcing a reload. Jul 31 10:15:26 nsc-sidon-vm snapd-desktop-i[4141]: Loop exited. Forcing reload. Jul 31 10:15:28 nsc-sidon-vm systemd[2982]: snap.snapd-desktop-integration.snapd-desktop-integration.service: Scheduled restart job, restart counter is at 4.[/code]

sergio-costas commented 1 month ago

Mmm... it is failing to initialize gtk... that's odd...

sergio-costas commented 1 month ago

Do you have the last version of snapd? (sudo snap refresh snapd) Can you check if all the interfaces in snapd-desktop-integration are connected? (sudo snap connections snapd-desktop-integration)

guruevi commented 1 month ago

snapd says it is up-to-date.

The only one that doesn't have a plug: dbus - snapd-desktop-integration:snapd-desktop-integration -

The rest is fine (it won't format properly here) Interface Plug Slot Notes content[gnome-42-2204] snapd-desktop-integration:gnome-42-2204 gnome-42-2204:gnome-42-2204 - content[gtk-3-themes] snapd-desktop-integration:gtk-3-themes gtk-common-themes:gtk-3-themes - content[icon-themes] snapd-desktop-integration:icon-themes gtk-common-themes:icon-themes - content[sound-themes] snapd-desktop-integration:sound-themes gtk-common-themes:sound-themes - dbus - snapd-desktop-integration:snapd-desktop-integration - desktop snapd-desktop-integration:desktop :desktop - desktop-legacy snapd-desktop-integration:desktop-legacy :desktop-legacy - gsettings snapd-desktop-integration:gsettings :gsettings - login-session-observe snapd-desktop-integration:login-session-observe :login-session-observe - opengl snapd-desktop-integration:opengl :opengl - snap-themes-control snapd-desktop-integration:snap-themes-control :snap-themes-control - system-files snapd-desktop-integration:snap :system-files - wayland snapd-desktop-integration:wayland :wayland - x11 snapd-desktop-integration:x11 :x11 -

sergio-costas commented 1 month ago

Ok, I can reproduce it in a virtual machine... odd...

sergio-costas commented 1 month ago

Odd... I rebooted the VM and now it does work fine...

sergio-costas commented 1 month ago

Can you try this from a terminal?

systemctl --user stop snap.snapd-desktop-integration.snapd-desktop-integration.service
systemctl --user start snap.snapd-desktop-integration.snapd-desktop-integration.service

and see if that fixes it, at least for the current session?

AlexBurdu commented 1 month ago

Restarting doesn't do the trick for me. It seems to restart itself anyway

Aug  4 16:16:34 burdu systemd[4625]: Stopped Service for snap application snapd-desktop-integration.snapd-desktop-integration.
Aug  4 16:16:34 burdu systemd[4625]: Started Service for snap application snapd-desktop-integration.snapd-desktop-integration.
Aug  4 16:16:34 burdu chrome-remote-desktop[23063]: 2024-08-04 16:16:34,313:INFO:wait() returned (32930,256)
Aug  4 16:16:34 burdu chrome-remote-desktop[23063]: 2024-08-04 16:16:34,313:INFO:Waiting before relaunching
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Failed to do gtk init. Waiting for a new session with desktop capabilities.
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Checking session /org/freedesktop/login1/session/c5...
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Is a desktop session! Forcing a reload.
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Checking session /org/freedesktop/login1/session/_39...
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Checking session /org/freedesktop/login1/session/c2...
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Checking session /org/freedesktop/login1/session/_38...
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Checking session /org/freedesktop/login1/session/_35...
Aug  4 16:16:34 burdu snapd-desktop-i[32983]: Loop exited. Forcing reload.

I am connecting remotely to the machine and was trying to set up chrome remote desktop, which doesn't seem to work and I'm guessing the 2 issues are related.

uname -a

Linux burdu 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
sergio-costas commented 2 weeks ago

Oh, ok... so you are connecting remotely... Can you specify how are you connecting? SSH with -X? Other...?

berdario commented 1 week ago

FYI, I see this error with Sway (I upgraded to Ubuntu 24.04.1, but I installed Sway ex novo, so it's a default Sway configuration)

For now, I'm just sticking with i3 (while I keep using Sway on Nixos)

guruevi commented 1 week ago

I see the error while using XRDP (which is X + VNC) or X2Go (uses SSH). Both can be installed natively and work pretty much out of the box. Although I don’t see how that would be a problem as XRDP is just rendering the desktop locally and has nothing to do with snaps.

sergio-costas commented 1 week ago

snapd-desktop-integration is a systemd user daemon that needs to have access to the screen (it uses Gtk). To avoid having it relaunching over and over again when a ssh connection is made, it checks if the current session is graphical. If not, it waits until the user opens a graphical session. And when there is a graphical session, it launches a child that does gtk_init(). For some reason, the daemon recognizes Sway as a graphical session, but can't launch a graphical instance on it. The same for XRDP.