Problems running all snaps on 18.04 VM

I’ve been using an LXD VM for development for some time and using a variety of snaps.

Sometime in the last couple of weeks (where I didn’t use it) this has stopped working. For example:

$ clion
internal error, please report: running "clion" failed: transient scope could not be started, job /org/freedesktop/systemd1/job/29 finished with result failed
$ ubuntu-frame
internal error, please report: running "ubuntu-frame" failed: transient scope could not be started, job /org/freedesktop/systemd1/job/32 finished with result failed
$ frame-it.check
internal error, please report: running "frame-it.check" failed: transient scope could not be started, job /org/freedesktop/systemd1/job/38 finished with result failed
$ snap version
snap    2.56.2
snapd   2.56.2
series  16
ubuntu  18.04
kernel  5.15.0-41-generic

I’ve also tried creating a fresh VM, but that exhibits the same behaviour.

Any suggestions?

A bit more information (after finding a previous discussion):

$ journalctl -u snapd --since 10:53
-- Logs begin at Thu 2022-07-21 14:28:59 UTC, end at Mon 2022-07-25 11:08:35 UTC. --
...
-- Reboot --
Jul 25 10:53:34 flutter systemd[1]: Starting Snap Daemon...
Jul 25 10:53:34 flutter snapd[419]: AppArmor status: apparmor is enabled and all features are available
Jul 25 10:53:34 flutter snapd[419]: AppArmor status: apparmor is enabled and all features are available
Jul 25 10:53:34 flutter snapd[419]: overlord.go:263: Acquiring state lock file
Jul 25 10:53:34 flutter snapd[419]: overlord.go:268: Acquired state lock file
Jul 25 10:53:35 flutter snapd[419]: daemon.go:247: started snapd/2.56.2 (series 16; classic) ubuntu/18.04 (amd64) linux/5.15.0-41-generic.
Jul 25 10:53:35 flutter snapd[419]: daemon.go:340: adjusting startup timeout by 1m40s (pessimistic estimate of 30s plus 5s per snap)
Jul 25 10:53:35 flutter systemd[1]: Started Snap Daemon.
Jul 25 10:53:35 flutter snapd[419]: stateengine.go:149: state ensure error: cannot decode new commands catalog: got unexpected HTTP status code 403 via GET to "https://api.snapcraft.io/api/v1/snaps/names?confine
$ journalctl --user --since 10:53
-- Logs begin at Thu 2022-07-21 15:11:08 UTC, end at Mon 2022-07-25 10:53:55 UTC. --
...
-- Reboot --
Jul 25 10:53:40 flutter systemd[549]: Listening on GnuPG cryptographic agent and passphrase cache.
Jul 25 10:53:40 flutter systemd[549]: Listening on GnuPG network certificate management daemon.
Jul 25 10:53:40 flutter systemd[549]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Jul 25 10:53:40 flutter systemd[549]: Listening on GnuPG cryptographic agent and passphrase cache (access for web browsers).
Jul 25 10:53:40 flutter systemd[549]: Reached target Timers.
Jul 25 10:53:40 flutter systemd[549]: Listening on GnuPG cryptographic agent and passphrase cache (restricted).
Jul 25 10:53:40 flutter systemd[549]: Starting D-Bus User Message Bus Socket.
Jul 25 10:53:40 flutter systemd[549]: Reached target Paths.
Jul 25 10:53:40 flutter systemd[549]: Listening on REST API socket for snapd user session agent.
Jul 25 10:53:40 flutter systemd[549]: Listening on D-Bus User Message Bus Socket.
Jul 25 10:53:40 flutter systemd[549]: Reached target Sockets.
Jul 25 10:53:40 flutter systemd[549]: Reached target Basic System.
Jul 25 10:53:40 flutter systemd[549]: Reached target Default.
Jul 25 10:53:40 flutter systemd[549]: Startup finished in 42ms.
Jul 25 10:53:54 flutter systemd[549]: Started D-Bus User Message Bus.
Jul 25 10:53:55 flutter dbus-daemon[956]: [session uid=1000 pid=956] AppArmor D-Bus mediation is enabled
Jul 25 10:53:55 flutter systemd[549]: snap.frame-it.check.959e8660-b032-4b6d-8cd6-141dae6d0c31.scope: Failed to add PIDs to scope's control group: Permission denied
Jul 25 10:53:55 flutter systemd[549]: snap.frame-it.check.959e8660-b032-4b6d-8cd6-141dae6d0c31.scope: Failed with result 'resources'.
Jul 25 10:53:55 flutter systemd[549]: Failed to start snap.frame-it.check.959e8660-b032-4b6d-8cd6-141dae6d0c31.scope.
$ ps -ef|grep -e systemd -e dbus
root          53       1  0 10:53 ?        00:00:00 /lib/systemd/systemd-journald
root          72       1  0 10:53 ?        00:00:00 /lib/systemd/systemd-udevd
systemd+     382       1  0 10:53 ?        00:00:00 /lib/systemd/systemd-networkd
systemd+     383       1  0 10:53 ?        00:00:00 /lib/systemd/systemd-resolved
message+     404       1  0 10:53 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root         413       1  0 10:53 ?        00:00:00 /lib/systemd/systemd-logind
ubuntu       549       1  0 10:53 ?        00:00:00 /lib/systemd/systemd --user
ubuntu       956     549  0 10:53 ?        00:00:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
ubuntu      8367     695  0 11:04 pts/3    00:00:00 grep --color=auto -e systemd -e dbus
$ busctl |grep systemd
:1.0                                   1 systemd         root             :1.0          init.scope                -          -                  
:1.1                                 383 systemd-resolve systemd-resolve  :1.1          systemd-resolved.service  -          -                  
:1.12                                549 systemd         ubuntu           :1.12         user@1000.service         -          -                  
:1.2                                 382 systemd-network systemd-network  :1.2          systemd-networkd.service  -          -                  
:1.4                                 413 systemd-logind  root             :1.4          systemd-logind.service    -          -                  
org.freedesktop.DBus                   1 systemd         root             -             init.scope                -          -                  
org.freedesktop.login1               413 systemd-logind  root             :1.4          systemd-logind.service    -          -                  
org.freedesktop.network1             382 systemd-network systemd-network  :1.2          systemd-networkd.service  -          -                  
org.freedesktop.resolve1             383 systemd-resolve systemd-resolve  :1.1          systemd-resolved.service  -          -                  
org.freedesktop.systemd1               1 systemd         root             :1.0          init.scope                -          -                  

Looks like this actually dates from upgrading the host to 22.04.

On a 20.04 host this works, and on 22.04 it doesn’t.

Anyone else getting here, the answer is:

https://discuss.linuxcontainers.org/t/error-the-image-used-by-this-instance-requires-a-cgroupv1-host-system-when-using-clustering/13885