Cannot open snap's installed applications in a virtual session
In some cases, applications installed by snap cannot be started inside a virtual session, or even locally. Error is similar to:
/user.slice/user-1000489.slice/session-c3.scope is not a snap cgroup
This problem occurs on different Linux distributions, in particular it has been reported to NoMachine for Xubuntu 22.04 and Ubuntu 22.04, and doesn't seem to depend on the desktop environment.
A possible workaround, tested on Ubuntu 22.04 and Xubuntu 22.04, is to configure the Grub boot loader as it follows.
sudo vim /etc/default/grub
change from:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash systemd.unified_cgroup_hierarchy=0"
This will disable cgroups v2, see also: https://lists.ubuntu.com/archives/ubuntu-devel/2021-August/041598.html
sudo update-grub
sudo reboot