snap package failing: /user.slice/user-1000.slice/session-1.scope is not a snap cgroup

Suddenly, snap packages are failing to run in my system with following error:

/user.slice/user-1000.slice/session-1.scope is not a snap cgroup

OS: Debian 11

Kernel: 5.10.0-12-amd64

$ SNAPD_DEBUG=1 snap run slack

2022/03/23 18:48:37.614818 tool_linux.go:204: DEBUG: restarting into "/snap/snapd/current/usr/bin/snap"
2022/03/23 18:48:37.625495 cmd_run.go:1026: DEBUG: executing snap-confine from /snap/snapd/15177/usr/lib/snapd/snap-confine
2022/03/23 18:48:37.625874 cmd_run.go:433: DEBUG: SELinux not enabled
2022/03/23 18:48:37.626049 tracking.go:46: DEBUG: creating transient scope snap.slack.slack
2022/03/23 18:48:37.626597 tracking.go:186: DEBUG: using session bus
2022/03/23 18:48:37.627860 tracking.go:294: DEBUG: StartTransientUnit failed with "org.freedesktop.DBus.Error.Spawn.ChildExited": [Process org.freedesktop.systemd1 exited with status 1]
2022/03/23 18:48:37.627986 cmd_run.go:1198: DEBUG: snapd cannot track the started application
2022/03/23 18:48:37.627996 cmd_run.go:1199: DEBUG: snap refreshes will not be postponed by this process
DEBUG: umask reset, old umask was  022
DEBUG: security tag: snap.slack.slack
DEBUG: executable:   /usr/lib/snapd/snap-exec
DEBUG: confinement:  non-classic
DEBUG: base snap:    core18
DEBUG: ruid: 1000, euid: 0, suid: 0
DEBUG: rgid: 1000, egid: 1000, sgid: 1000
DEBUG: apparmor label on snap-confine is: /snap/snapd/15177/usr/lib/snapd/snap-confine
DEBUG: apparmor mode is: enforce
DEBUG: creating lock directory /run/snapd/lock (if missing)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock directory /run/snapd/lock
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: opening lock file: /run/snapd/lock/.lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: acquiring exclusive lock (scope (global), uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: ensuring that snap mount directory is shared
DEBUG: unsharing snap namespace directory
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: releasing lock 5
DEBUG: opened snap-update-ns executable as file descriptor 5
DEBUG: opened snap-discard-ns executable as file descriptor 6
DEBUG: creating lock directory /run/snapd/lock (if missing)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock directory /run/snapd/lock
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: opening lock file: /run/snapd/lock/slack.lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: acquiring exclusive lock (scope slack, uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: initializing mount namespace: slack
DEBUG: setting up device cgroup
DEBUG: libudev has current tags support
DEBUG: device /sys/devices/pci0000:00/0000:00:02.0/drm/card0 has matching current tag
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: get bpf object at path /sys/fs/bpf/snap/snap_slack_slack
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: found existing device map
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: found 20 existing entries in devices map
DEBUG: delete key for c 143:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:8
DEBUG: delete elem in map 8
DEBUG: delete key for c 10:239
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:7
DEBUG: delete elem in map 8
DEBUG: delete key for c 138:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 142:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 137:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 141:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:0
DEBUG: delete elem in map 8
DEBUG: delete key for c 226:0
DEBUG: delete elem in map 8
DEBUG: delete key for c 140:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:9
DEBUG: delete elem in map 8
DEBUG: delete key for c 139:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:2
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:5
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:3
DEBUG: delete elem in map 8
DEBUG: delete key for c 226:128
DEBUG: delete elem in map 8
DEBUG: delete key for c 136:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:1
DEBUG: delete elem in map 8
DEBUG: delete key for c 10:200
DEBUG: delete elem in map 8
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: load program of type 0xf, 33 instructions
DEBUG: set_effective_identity uid:0 (change: no), gid:1000 (change: yes)
DEBUG: v2 allow c 1:3
DEBUG: v2 allow c 1:5
DEBUG: v2 allow c 1:7
DEBUG: v2 allow c 1:8
DEBUG: v2 allow c 1:9
DEBUG: v2 allow c 5:0
DEBUG: v2 allow c 5:1
DEBUG: v2 allow c 5:2
DEBUG: v2 allow c 136:4294967295
DEBUG: v2 allow c 137:4294967295
DEBUG: v2 allow c 138:4294967295
DEBUG: v2 allow c 139:4294967295
DEBUG: v2 allow c 140:4294967295
DEBUG: v2 allow c 141:4294967295
DEBUG: v2 allow c 142:4294967295
DEBUG: v2 allow c 143:4294967295
DEBUG: v2 allow c 10:239
DEBUG: v2 allow c 10:200
DEBUG: inspecting type of device: /dev/dri/card0
DEBUG: v2 allow c 226:0
DEBUG: device /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-1 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-DP-1
DEBUG: device /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-1
DEBUG: device /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-2 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-HDMI-A-2
DEBUG: device /sys/devices/pci0000:00/0000:00:02.0/drm/renderD128 has matching current tag
DEBUG: inspecting type of device: /dev/dri/renderD128
DEBUG: v2 allow c 226:128
DEBUG: process in cgroup /user.slice/user-1000.slice/session-1.scope
/user.slice/user-1000.slice/session-1.scope is not a snap cgroup

From the snapd log I think the root issue is:

2022/03/23 18:48:37.627860 tracking.go:294: DEBUG: StartTransientUnit failed with "org.freedesktop.DBus.Error.Spawn.ChildExited": [Process org.freedesktop.systemd1 exited with status 1]

What steps can I take to solve this issue? Some additional information:

$ snap --version

snap    2.54.4
snapd   2.54.4
series  16
debian  11
kernel  5.10.0-12-amd64

$ systemctl --version

systemd 247 (247.3-6)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified

$ sudo systemct status dbus.service

 dbus.service - D-Bus System Message Bus
     Loaded: loaded (/lib/systemd/system/dbus.service; static)
     Active: active (running) since Wed 2022-03-23 18:17:36 MDT; 34min ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
   Main PID: 551 (dbus-daemon)
      Tasks: 1 (limit: 18764)
     Memory: 2.3M
        CPU: 1.785s
     CGroup: /system.slice/dbus.service
             └─551 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

Mar 23 18:17:36 sboban-desktop systemd[1]: Started D-Bus System Message Bus.
Mar 23 18:17:37 sboban-desktop dbus-daemon[551]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service' requested by ':1.11' >
Mar 23 18:17:37 sboban-desktop dbus-daemon[551]: [system] Successfully activated service 'org.freedesktop.timedate1'
Mar 23 18:17:44 sboban-desktop dbus-daemon[551]: [system] Activating via systemd: service name='org.freedesktop.RealtimeKit1' unit='rtkit-daemon.service' requested by ':1.16' (uid=1000 pid=8>
Mar 23 18:17:44 sboban-desktop dbus-daemon[551]: [system] Successfully activated service 'org.freedesktop.RealtimeKit1'
Mar 23 18:18:10 sboban-desktop dbus-daemon[551]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service' requested by ':1.11' >
Mar 23 18:18:10 sboban-desktop dbus-daemon[551]: [system] Successfully activated service 'org.freedesktop.timedate1'
Mar 23 18:18:18 sboban-desktop dbus-daemon[551]: [system] Activating via systemd: service name='org.freedesktop.UPower' unit='upower.service' requested by ':1.36' (uid=1000 pid=1192 comm="/u>
Mar 23 18:18:18 sboban-desktop dbus-daemon[551]: [system] Successfully activated service 'org.freedesktop.UPower'

$ systemctl --user dbus.service

dbus.service - D-Bus User Message Bus
     Loaded: loaded (/usr/lib/systemd/user/dbus.service; static)
     Active: active (running) since Wed 2022-03-23 18:17:44 MDT; 36min ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
   Main PID: 877 (dbus-daemon)
      Tasks: 1 (limit: 18764)
     Memory: 1.1M
        CPU: 5ms
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/dbus.service
             └─877 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

Mar 23 18:17:44 sboban-desktop systemd[846]: Started D-Bus User Message Bus.

$ sudo systemctl status [email protected]$(id -u)

 [email protected] - User Manager for UID 1000
     Loaded: loaded (/lib/systemd/system/[email protected]; static)
     Active: active (running) since Wed 2022-03-23 18:17:44 MDT; 37min ago
       Docs: man:[email protected](5)
   Main PID: 846 (systemd)
     Status: "Startup finished in 774ms."
      Tasks: 9
     Memory: 41.1M
        CPU: 484ms
     CGroup: /user.slice/user-1000.slice/[email protected]
             ├─app.slice
             │ ├─dbus.service
             │ │ └─877 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
             │ ├─pipewire.service
             │ │ ├─866 /usr/bin/pipewire
             │ │ └─878 /usr/bin/pipewire-media-session
             │ └─pulseaudio.service
             │   └─867 /usr/bin/pulseaudio --daemonize=no --log-target=journal
             └─init.scope
               ├─846 /lib/systemd/systemd --user
               └─847 (sd-pam)

Mar 23 18:17:44 sboban-desktop systemd[846]: Reached target Sockets.
Mar 23 18:17:44 sboban-desktop systemd[846]: Reached target Basic System.
Mar 23 18:17:44 sboban-desktop systemd[1]: Started User Manager for UID 1000.
Mar 23 18:17:44 sboban-desktop systemd[846]: Started Multimedia Service.
Mar 23 18:17:44 sboban-desktop systemd[846]: Starting Sound Service...
Mar 23 18:17:44 sboban-desktop systemd[846]: Started D-Bus User Message Bus.
Mar 23 18:17:44 sboban-desktop pipewire[866]: Failed to receive portal pid: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get PID of name 'org.freedesktop.portal.Desktop': no such name
Mar 23 18:17:45 sboban-desktop systemd[846]: Started Sound Service.
Mar 23 18:17:45 sboban-desktop systemd[846]: Reached target Main User Target.
Mar 23 18:17:45 sboban-desktop systemd[846]: Startup finished in 774ms.

Let me know if you need any more information. Any kind of help will be appreciated. Thank you.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Building and Installing a newer kernel solved the issue. In my case it was v5.18-rc1-390-gf45ba67eb74a from net-next branch. Other newer kernels might work too.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply