Snap package startup failed

Hi, Snap package startup failed after ubuntu reinstall from 18.04 to 22.04 with the private home director retained. I cannot start any snap packages such as firefox after the system was reinstalled.

Error Info:

lg@lg:~$ SNAPD_DEBUG=1 snap run firefox
2022/12/27 17:30:08.771819 tool_linux.go:204: DEBUG: restarting into "/snap/snapd/current/usr/bin/snap"
2022/12/27 17:30:08.795784 logger.go:184: DEBUG: -- snap startup {"stage":"start", "time":"1672133408.795779"}
2022/12/27 17:30:08.801366 cmd_run.go:1037: DEBUG: executing snap-confine from /snap/snapd/17883/usr/lib/snapd/snap-confine
2022/12/27 17:30:08.801903 cmd_run.go:440: DEBUG: SELinux not enabled
2022/12/27 17:30:08.802277 tracking.go:46: DEBUG: creating transient scope snap.firefox.firefox
2022/12/27 17:30:08.802296 tracking.go:189: DEBUG: session bus is not available: cannot find session bus
2022/12/27 17:30:08.802301 cmd_run.go:1224: DEBUG: snapd cannot track the started application
2022/12/27 17:30:08.802309 cmd_run.go:1225: DEBUG: snap refreshes will not be postponed by this process
2022/12/27 17:30:08.802321 logger.go:184: DEBUG: -- snap startup {"stage":"snap to snap-confine", "time":"1672133408.802319"}
DEBUG: -- snap startup {"stage":"snap-confine enter", "time":"1672133408.803857"}
DEBUG: umask reset, old umask was   02
DEBUG: security tag: snap.firefox.firefox
DEBUG: executable:   /usr/lib/snapd/snap-exec
DEBUG: confinement:  non-classic
DEBUG: base snap:    core20
DEBUG: ruid: 1000, euid: 0, suid: 0
DEBUG: rgid: 1000, egid: 1000, sgid: 1000
DEBUG: apparmor label on snap-confine is: /snap/snapd/17883/usr/lib/snapd/snap-confine
DEBUG: apparmor mode is: enforce
DEBUG: -- snap startup {"stage":"snap-confine mount namespace start", "time":"1672133408.804216"}
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/firefox.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 firefox, uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: initializing mount namespace: firefox
DEBUG: setting up device cgroup
DEBUG: libudev has current tags support
DEBUG: device /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.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_firefox_firefox
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 1:9
DEBUG: delete elem in map 8
DEBUG: delete key for c 143:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 139:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 140:-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 10:239
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:8
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:3
DEBUG: delete elem in map 8
DEBUG: delete key for c 10:200
DEBUG: delete elem in map 8
DEBUG: delete key for c 137:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 226:0
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:7
DEBUG: delete elem in map 8
DEBUG: delete key for c 136:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:5
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:2
DEBUG: delete elem in map 8
DEBUG: delete key for c 142:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 226:128
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:1
DEBUG: delete elem in map 8
DEBUG: delete key for c 138:-1
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:01.0/0000:01:00.0/drm/card0/card0-DP-1 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-1
DEBUG: device /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-2 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-2
DEBUG: device /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-3 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-3
DEBUG: device /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-4 has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-DP-4
DEBUG: device /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/renderD128 has matching current tag
DEBUG: inspecting type of device: /dev/dri/renderD128
DEBUG: v2 allow c 226:128
DEBUG: device /sys/devices/virtual/mem/full has matching current tag
DEBUG: inspecting type of device: /dev/full
DEBUG: v2 allow c 1:7
DEBUG: process in cgroup /user.slice/user-1000.slice/session-4.scope
/user.slice/user-1000.slice/session-4.scope is not a snap cgroup

Try to fix with:

sudo apt-get install dbus-user-session && systemctl --user start dbus.service

Get the following error:

lg@lg:~$ sudo apt-get install dbus-user-session
[sudo] password for lg: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
dbus-user-session is already the newest version (1.12.20-2ubuntu4.1).
The following packages were automatically installed and are no longer required:
  libflashrom1 libftdi1-2
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
lg@lg:~$ systemctl --user status dbus.service 
Unit dbus.service could not be found.

System info:

lg@lg:~$ snap version
snap    2.57.6
snapd   2.57.6
series  16
ubuntu  22.04
kernel  5.15.0-56-generic

Anymore log info needed, let me know. Thanks in advance!

have you tried creating a fresh testuser ? smells like there are broken bits and pieces in your carried over config/caches/etc that you kept in your retained home …

Thanks for reply. I tried to start firefox with a newly created user, and got the same error as previous.

DEBUG: session bus is not available: cannot find session bus
/user.slice/user-1000.slice/session-4.scope is not a snap cgroup