Cannot launch snap applications with cgroup v2

I get the same errors trying to run any SNAP in Ubuntu 22.04 when logged in in a VNC server session (uid=1038):

/user.slice/user-1038.slice/session-30.scope is not a snap cgroup

Everything works fine if I’m logged in on that PC directly. However, inside a vnc-session I cannot run any SNAP. The GNOME-session is started with the following ~/.vnc/xstartup:

#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
export DESKTOP_SESSION=/usr/share/xsessions/ubuntu.desktop
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
dbus-launch --exit-with-session /usr/bin/gnome-session --systemd --session=ubuntu

I’ve tried to use dbus-user-session instead of dbus-launch but that didn’t change anything. The same happens if I run a XFCE4-session:

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/startxfce4
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
x-window-manager &

Any ideas what I should add to the session startup to make SNAPs work?

1 Like