after Ubuntu 21.10 upgrade: "cannot attach cgroup program" operation not permitted

In Ubuntu 21.10, systemd is being switched to the “unified” cgroup hierarchy (cgroup v2) by default instead of (cgroup v1) in previous releases. Please see the Impish Indri Release Notes

After upgrading, apparmor does not seem to be allowing mounting cgroups version 2 FS which prevents snap based applications from starting properly.

This, however, might be solved by running this command in the terminal:

sudo dpkg-reconfigure apparmor

Select ok when prompted without adding anything.

If that did not work or for some reason you need to keep the legacy cgroup v1 hierarchy, you can select it via this kernel parameter systemd.unified_cgroup_hierarchy=0 at boot time and wait until snap is updated with full support for (cgroup v2).


Is it possible that you are using a Linux kernel that doesn't properly support the unified cgroup hierarchy? I had the same problem as you and it turned out that my GRUB was loading an ancient kernel, instead of a current one.