"/system.slice/snapd.service is not a snap cgroup" while attempting to install snap

Hi. I’m unable to install the telegram-desktop snap with the following error:

$ sudo SNAPD_DEBUG=1 snap install telegram-desktop
2024/11/24 18:09:11.880032 logger.go:99: DEBUG: restarting into "/snap/snapd/current/usr/bin/snap"
error: cannot perform the following tasks:
- Run configure hook of "telegram-desktop" snap if present (run hook "configure": /system.slice/snapd.service is not a snap cgroup)

It does work if installed with --devmode though.

Haven’t found other snaps affected by this issue. But, I believe this is not an issue with this snap in particular (this works perfectly on other systems), but on my own laptop. Something with snapd or cgroups might be locally corrupted or some other unexpected condition might be found.

Note there are many reports of not a snap cgroup errors in the forum, but they are all related to running snaps rather than installing them.

I’ve tried with snapd 2.63 on stable as well as 2.66.1 currently on candidate with the same results. Some debugging I’ve collected based on the other error reports with snap run:

$ snap version
snap    2.66.1
snapd   2.66.1
series  16
ubuntu  24.10
kernel  6.11.0-9-generic

$ echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus

$ echo $XDG_RUNTIME_DIR
/run/user/1000

# Check system logs while installing the snap (irrelevant messages filtered out)
$ sudo journalctl --no-pager -f

nov 24 18:35:17 max7 snapd[195168]: api_snaps.go:468: Installing snap "telegram-desktop" revision unset

nov 24 18:35:21 max7 systemd[1]: Mounting snap-telegram\x2ddesktop-6357.mount - Mount unit for telegram-desktop, revision 6357...
nov 24 18:35:21 max7 kernel: loop2: detected capacity change from 0 to 916400
nov 24 18:35:21 max7 systemd[1]: Mounted snap-telegram\x2ddesktop-6357.mount - Mount unit for telegram-desktop, revision 6357.

nov 24 18:35:21 max7 kernel: audit: type=1400 audit(1732484121.610:1764): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.telegram-desktop" pid=248179 comm="apparmor_parser"
nov 24 18:35:21 max7 kernel: audit: type=1400 audit(1732484121.645:1765): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.telegram-desktop.hook.configure" pid=248180 comm="apparmor_parser"
nov 24 18:35:21 max7 kernel: audit: type=1400 audit(1732484121.659:1766): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.telegram-desktop.telegram-desktop" pid=248181 comm="apparmor_parser"

nov 24 18:35:22 max7 kernel: audit: type=1400 audit(1732484122.818:1767): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/snapd/23258/usr/lib/snapd/snap-confine" pid=248873 comm="apparmor_parser"
nov 24 18:35:22 max7 kernel: audit: type=1400 audit(1732484122.818:1768): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/snapd/23258/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=248873 comm="apparmor_parser"

nov 24 18:35:22 max7 kernel: audit: type=1400 audit(1732484122.942:1769): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.telegram-desktop.hook.configure" pid=248877 comm="apparmor_parser"
nov 24 18:35:23 max7 kernel: audit: type=1400 audit(1732484123.018:1770): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.telegram-desktop" pid=248876 comm="apparmor_parser"
nov 24 18:35:23 max7 kernel: audit: type=1400 audit(1732484123.124:1771): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.telegram-desktop.telegram-desktop" pid=248878 comm="apparmor_parser"

nov 24 18:35:23 max7 snapd[195168]: taskrunner.go:299: Change 248 task (Run configure hook of "telegram-desktop" snap if present) failed: run hook "configure": /system.slice/snapd.service is not a snap cgroup
nov 24 18:35:23 max7 kernel: audit: type=1400 audit(1732484123.496:1772): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/snapd/23258/usr/lib/snapd/snap-confine" pid=248933 comm="apparmor_parser"
nov 24 18:35:23 max7 kernel: audit: type=1400 audit(1732484123.496:1773): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/snapd/23258/usr/lib/snapd/snap-confine//mount-namespace-capture-helper" pid=248933 comm="apparmor_parser"

Any suggestions? Thanks!

Hi,

The hook is run directly by snapd so it won’t access your session. Instead, snap run will try to connect to the system bus and create a transient scope by talking to the systemd ‘system’ instance. The log would suggest that it snap run was unable to do so (either create the scope or connect to the bus), which is still weird.

If this is reproducible, you may want to make sure that no weird environment settings are set in snapd process (sudo strings /proc/$(pidof snapd)/environ) and there are no unexpected systemd overrides. You can add an override which would set SNAPD_DEBUG=1 and see if anything useful shows up in the logs. Perhaps dbus traffic from the system bus would be useful too, eg. busctl monitor --system when snap install runs.

This is 100% reproducible on this single laptop with this snap in particular. Added SNAPD_DEBUG=1 to /var/lib/snapd/environment/snapd.conf. Based on the logs, the issue is apparently related to the desktop hook/plugs ("no devices tagged with snap_telegram-desktop_hook_configure, but device cgroup is required, proceeding with setup...").

Any suggestions? Happy to debug :slight_smile: Thanks!

Relevant bits of telegram-desktop’s snapcraft.yaml:

hooks:
  configure:
    command-chain:
      - bin/hooks-configure-desktop
    plugs:
      - desktop

plugs:
  desktop:
    mount-host-font-cache: false
  # Support for common GTK themes
  # https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes

I don’t see anything weird in the environment:

$ strings /proc/$(pidof snapd)/environ
LANG=en_US.UTF-8
LC_ADDRESS=es_AR.UTF-8
LC_IDENTIFICATION=es_AR.UTF-8
LC_MEASUREMENT=es_AR.UTF-8
LC_MONETARY=es_AR.UTF-8
LC_NAME=es_AR.UTF-8
LC_NUMERIC=es_AR.UTF-8
LC_PAPER=es_AR.UTF-8
LC_TELEPHONE=es_AR.UTF-8
LC_TIME=es_AR.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
NOTIFY_SOCKET=/run/systemd/notify
LISTEN_PID=497843
LISTEN_FDS=2
LISTEN_FDNAMES=snapd.socket:snapd.socket
WATCHDOG_PID=497843
WATCHDOG_USEC=300000000
USER=root
INVOCATION_ID=<some random string>
JOURNAL_STREAM=9:1306349
SYSTEMD_EXEC_PID=497843
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/snapd.service/memory.pressure
MEMORY_PRESSURE_WRITE=<some randm string>
SNAPD_DEBUG=1

The telegram-desktop snap from stable (r6357) is currently installed in devmode. Let’s try to refresh to edge in jailmode (r6360) which fails identically.

$ sudo snap refresh telegram-desktop --edge --jailmode
error: cannot perform the following tasks:
- Run configure hook of "telegram-desktop" snap if present (run hook "configure": 
-----
DEBUG: initializing mount namespace: telegram-desktop
DEBUG: setting up device cgroup, mode "required"
DEBUG: libudev has current tags support
DEBUG: no devices tagged with snap_telegram-desktop_hook_configure, but device cgroup is required, proceeding with setup
DEBUG: get bpf object at path /sys/fs/bpf/snap/snap_telegram-desktop_hook_configure
DEBUG: found existing device map
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: found 22 existing entries in devices map
DEBUG: delete key for c 138:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 143:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 136:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:3
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 137:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:5
DEBUG: delete elem in map 9
DEBUG: delete key for c 139:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:9
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:8
DEBUG: delete elem in map 9
DEBUG: delete key for c 234:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 140:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 142:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 10:239
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:7
DEBUG: delete elem in map 9
DEBUG: delete key for c 10:200
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:254
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:255
DEBUG: delete elem in map 9
DEBUG: delete key for c 141:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:2
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:1
DEBUG: delete elem in map 9
DEBUG: load program of type 0xf, 33 instructions
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 195:0
DEBUG: v2 allow c 195:255
DEBUG: v2 allow c 234:0
DEBUG: v2 allow c 195:254
DEBUG: v2 allow c 10:239
DEBUG: v2 allow c 10:200
DEBUG: process in cgroup /system.slice/snapd.service
/system.slice/snapd.service is not a snap cgroup
-----)
$ sudo journalctl -f -u snapd.service -o cat
logger.go:99: DEBUG: Deltas enabled. Adding header Snap-Accept-Delta-Format: xdelta3
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/v2/snaps/refresh, attempt 1, elapsed time=2.02µs
logger.go:99: DEBUG: The retry loop for https://api.snapcraft.io/v2/snaps/refresh finished after 1 retries, elapsed time=1.150572312s, status: 200
logger.go:99: DEBUG: Deltas enabled. Adding header Snap-Accept-Delta-Format: xdelta3
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/v2/snaps/refresh, attempt 1, elapsed time=1.559µs
logger.go:99: DEBUG: The retry loop for https://api.snapcraft.io/v2/snaps/refresh finished after 1 retries, elapsed time=601.668881ms, status: 200
logger.go:99: DEBUG: pid=515525;uid=0;socket=/run/snapd.socket; POST /v2/snaps/telegram-desktop 1.813716467s 202
logger.go:99: DEBUG: Running task 5667 on Do: Ensure prerequisites for "telegram-desktop" are available
logger.go:99: DEBUG: Running task 5686 on Do: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5668 on Do: Download snap "telegram-desktop" (6360) from channel "latest/edge"
logger.go:99: DEBUG: Available deltas returned by store: [{6357 6360 xdelta3 https://api.snapcraft.io/api/v1/snaps/download/jpdoHqMd90M39DdH2JSZbeQxipqHtwLo_6357_6360_xdelta3.delta 9933671 9ecd219c02386fcc307611ac8e390c5d5f7e0e20997407701a8c5fb113cd98e6577825fa39a064b4a4213e7bbe29a3e3}]
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/api/v1/snaps/download/jpdoHqMd90M39DdH2JSZbeQxipqHtwLo_6357_6360_xdelta3.delta, attempt 1, elapsed time=3.417µs
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Download size for https://api.snapcraft.io/api/v1/snaps/download/jpdoHqMd90M39DdH2JSZbeQxipqHtwLo_6357_6360_xdelta3.delta: 9933671
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Download succeeded in 6.726s (1MB/s).
logger.go:99: DEBUG: Successfully downloaded delta for "telegram-desktop" at /var/lib/snapd/snaps/telegram-desktop_6360.snap.xdelta3-6357-to-6360.partial
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Successfully applied delta for "telegram-desktop" at /var/lib/snapd/snaps/telegram-desktop_6360.snap.xdelta3-6357-to-6360.partial, saving 459263129 bytes.
logger.go:99: DEBUG: Running task 5669 on Do: Fetch and check assertions for snap "telegram-desktop" (6360)
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/v2/assertions/snap-revision/f4wxBjDmsv_7e8jvLGyij_TyqRS7vH4jpLU6gpuoNLOgKxDBfQioTr_y9axklCPv?max-format=0, attempt 1, elapsed time=3.467µs
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: The retry loop for https://api.snapcraft.io/v2/assertions/snap-revision/f4wxBjDmsv_7e8jvLGyij_TyqRS7vH4jpLU6gpuoNLOgKxDBfQioTr_y9axklCPv?max-format=0 finished after 1 retries, elapsed time=1.106599841s, status: 200
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/v2/assertions/snap-declaration/16/jpdoHqMd90M39DdH2JSZbeQxipqHtwLo?max-format=6, attempt 1, elapsed time=2.001µs
logger.go:99: DEBUG: The retry loop for https://api.snapcraft.io/v2/assertions/snap-declaration/16/jpdoHqMd90M39DdH2JSZbeQxipqHtwLo?max-format=6 finished after 1 retries, elapsed time=307.673899ms, status: 200
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/v2/assertions/account/EXRxowJU0BSPUYQhLXu58z3mwKY33Hcp?max-format=0, attempt 1, elapsed time=1.911µs
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: The retry loop for https://api.snapcraft.io/v2/assertions/account/EXRxowJU0BSPUYQhLXu58z3mwKY33Hcp?max-format=0 finished after 1 retries, elapsed time=306.426866ms, status: 200
logger.go:99: DEBUG: Retrying https://api.snapcraft.io/v2/assertions/account-key/BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul?max-format=1, attempt 1, elapsed time=2.075µs
logger.go:99: DEBUG: The retry loop for https://api.snapcraft.io/v2/assertions/account-key/BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul?max-format=1 finished after 1 retries, elapsed time=308.720046ms, status: 200
logger.go:99: DEBUG: Running task 5670 on Do: Mount snap "telegram-desktop" (6360)
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: snap "telegram-desktop" (6360) available at "/snap/telegram-desktop/6360"
logger.go:99: DEBUG: Running task 5671 on Do: Run pre-refresh hook of "telegram-desktop" snap if present
logger.go:99: DEBUG: Running task 5672 on Do: Stop snap "telegram-desktop" services
logger.go:99: DEBUG: Running task 5673 on Do: Remove aliases for snap "telegram-desktop"
logger.go:99: DEBUG: Running task 5674 on Do: Make current revision for snap "telegram-desktop" unavailable
logger.go:99: DEBUG: update-desktop-database successful
logger.go:99: DEBUG: Running task 5675 on Do: Copy snap "telegram-desktop" data
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5676 on Do: Setup snap "telegram-desktop" (6360) security profiles
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: checking internal apparmor_parser candidate at /snap/snapd/23258/usr/lib/snapd/apparmor_parser
logger.go:99: DEBUG: checking internal apparmor_parser candidate at /snap/snapd/23258/usr/lib/snapd/apparmor_parser
logger.go:99: DEBUG: Running task 5677 on Do: Make snap "telegram-desktop" (6360) available to the system
logger.go:99: DEBUG: ignoring line 3 ("TryExec=telegram-desktop") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: ignoring line 13 ("DBusActivatable=true") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: ignoring line 15 ("X-GNOME-UsesNotifications=true") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: ignoring line 16 ("X-GNOME-SingleWindow=true") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: update-desktop-database successful
logger.go:99: DEBUG: Running task 5678 on Do: Automatically connect eligible plugs and slots of snap "telegram-desktop"
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5679 on Do: Set automatic aliases for snap "telegram-desktop"
logger.go:99: DEBUG: Running task 5680 on Do: Setup snap "telegram-desktop" aliases
logger.go:99: DEBUG: Running task 5681 on Do: Run post-refresh hook of "telegram-desktop" snap if present
logger.go:99: DEBUG: Running task 5682 on Do: Start snap "telegram-desktop" (6360) services
logger.go:99: DEBUG: Running task 5683 on Do: Clean up "telegram-desktop" (6360) install
logger.go:99: DEBUG: Running task 5684 on Do: Run configure hook of "telegram-desktop" snap if present
logger.go:107: DEBUG: 2024-11-25T11:20:51-03:00 ERROR run hook "configure":
-----
DEBUG: initializing mount namespace: telegram-desktop
DEBUG: setting up device cgroup, mode "required"
DEBUG: libudev has current tags support
DEBUG: no devices tagged with snap_telegram-desktop_hook_configure, but device cgroup is required, proceeding with setup
DEBUG: get bpf object at path /sys/fs/bpf/snap/snap_telegram-desktop_hook_configure
DEBUG: found existing device map
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: found 22 existing entries in devices map
DEBUG: delete key for c 138:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 143:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 136:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:3
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 137:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:5
DEBUG: delete elem in map 9
DEBUG: delete key for c 139:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:9
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:8
DEBUG: delete elem in map 9
DEBUG: delete key for c 234:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 140:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 142:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 10:239
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:7
DEBUG: delete elem in map 9
DEBUG: delete key for c 10:200
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:254
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:255
DEBUG: delete elem in map 9
DEBUG: delete key for c 141:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:2
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:1
DEBUG: delete elem in map 9
DEBUG: load program of type 0xf, 33 instructions
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 195:0
DEBUG: v2 allow c 195:255
DEBUG: v2 allow c 234:0
DEBUG: v2 allow c 195:254
DEBUG: v2 allow c 10:239
DEBUG: v2 allow c 10:200
DEBUG: process in cgroup /system.slice/snapd.service
/system.slice/snapd.service is not a snap cgroup
-----
taskrunner.go:299: Change 254 task (Run configure hook of "telegram-desktop" snap if present) failed: run hook "configure":
-----
DEBUG: initializing mount namespace: telegram-desktop
DEBUG: setting up device cgroup, mode "required"
DEBUG: libudev has current tags support
DEBUG: no devices tagged with snap_telegram-desktop_hook_configure, but device cgroup is required, proceeding with setup
DEBUG: get bpf object at path /sys/fs/bpf/snap/snap_telegram-desktop_hook_configure
DEBUG: found existing device map
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: get next key for map 9
DEBUG: found 22 existing entries in devices map
DEBUG: delete key for c 138:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 143:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 136:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:3
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 137:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:5
DEBUG: delete elem in map 9
DEBUG: delete key for c 139:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:9
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:8
DEBUG: delete elem in map 9
DEBUG: delete key for c 234:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 140:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 142:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 10:239
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:7
DEBUG: delete elem in map 9
DEBUG: delete key for c 10:200
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:254
DEBUG: delete elem in map 9
DEBUG: delete key for c 195:255
DEBUG: delete elem in map 9
DEBUG: delete key for c 141:-1
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:2
DEBUG: delete elem in map 9
DEBUG: delete key for c 5:1
DEBUG: delete elem in map 9
DEBUG: load program of type 0xf, 33 instructions
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 195:0
DEBUG: v2 allow c 195:255
DEBUG: v2 allow c 234:0
DEBUG: v2 allow c 195:254
DEBUG: v2 allow c 10:239
DEBUG: v2 allow c 10:200
DEBUG: process in cgroup /system.slice/snapd.service
/system.slice/snapd.service is not a snap cgroup
-----
logger.go:99: DEBUG: Running task 5682 on Undo: Start snap "telegram-desktop" (6360) services
logger.go:99: DEBUG: Running task 5681 on Undo: Run post-refresh hook of "telegram-desktop" snap if present
logger.go:99: DEBUG: Running task 5680 on Undo: Setup snap "telegram-desktop" aliases
logger.go:99: DEBUG: Running task 5679 on Undo: Set automatic aliases for snap "telegram-desktop"
logger.go:99: DEBUG: Running task 5678 on Undo: Automatically connect eligible plugs and slots of snap "telegram-desktop"
logger.go:99: DEBUG: Running task 5677 on Undo: Make snap "telegram-desktop" (6360) available to the system
logger.go:99: DEBUG: update-desktop-database successful
logger.go:99: DEBUG: Running task 5676 on Undo: Setup snap "telegram-desktop" (6360) security profiles
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: checking internal apparmor_parser candidate at /snap/snapd/23258/usr/lib/snapd/apparmor_parser
logger.go:99: DEBUG: checking internal apparmor_parser candidate at /snap/snapd/23258/usr/lib/snapd/apparmor_parser
logger.go:99: DEBUG: Running task 5675 on Undo: Copy snap "telegram-desktop" data
logger.go:99: DEBUG: Running task 5674 on Undo: Make current revision for snap "telegram-desktop" unavailable
logger.go:99: DEBUG: ignoring line 3 ("TryExec=telegram-desktop") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: ignoring line 13 ("DBusActivatable=true") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: ignoring line 15 ("X-GNOME-UsesNotifications=true") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: ignoring line 16 ("X-GNOME-SingleWindow=true") in source of desktop file "telegram-desktop_telegram-desktop.desktop"
logger.go:99: DEBUG: update-desktop-database successful
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5673 on Undo: Remove aliases for snap "telegram-desktop"
logger.go:99: DEBUG: Running task 5672 on Undo: Stop snap "telegram-desktop" services
logger.go:99: DEBUG: Running task 5671 on Undo: Run pre-refresh hook of "telegram-desktop" snap if present
logger.go:99: DEBUG: Running task 5670 on Undo: Mount snap "telegram-desktop" (6360)
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: Running task 5668 on Undo: Download snap "telegram-desktop" (6360) from channel "latest/edge"
logger.go:99: DEBUG: Running task 5686 on Doing: Monitoring snap "telegram-desktop" to determine whether extra refresh steps are required
logger.go:99: DEBUG: validation sets are still correct after partial refresh

Have you tried capturing system bus traffic around the time the refresh is running?

Yes… but the output is a continuous non-stop flood of messages from multiple unrelated services (mainly NetworkManager stats), and I haven’t been able to pick anything relevant out of that. Are we interested in any peer/service in particular? Didn’t find snapd.service in busctl list btw.

Found another one. The juju snap is installed and working locally on version 3.5.4 (r28520), but I’m unable to update to 3.6.0 (r29130). Something looks really wrong with snaps in this system :-/

$ sudo snap refresh juju
error: cannot perform the following tasks:
- Run post-refresh hook of "juju" snap if present (run hook "post-refresh": 
-----
DEBUG: initializing mount namespace: juju
DEBUG: setting up device cgroup, mode "required"
DEBUG: libudev has current tags support
DEBUG: no devices tagged with snap_juju_hook_post-refresh, but device cgroup is required, proceeding with setup
DEBUG: get bpf object at path /sys/fs/bpf/snap/snap_juju_hook_post-refresh
DEBUG: found existing device map
DEBUG: get next key for map 9
DEBUG: get next key for map 9
...
DEBUG: found 22 existing entries in devices map
DEBUG: delete key for c 234:0
DEBUG: delete elem in map 9
DEBUG: delete key for c 1:9
DEBUG: delete elem in map 9
...
DEBUG: load program of type 0xf, 33 instructions
DEBUG: v2 allow c 1:3
DEBUG: v2 allow c 1:5
...
DEBUG: process in cgroup /system.slice/snapd.service
/system.slice/snapd.service is not a snap cgroup
-----)