Snap run attempts to create a separate scope (a cgroup actually) for the application by talking to org.freedesktop.systemd1.Manager over session bus. In your case, the session bus is unavailable, so a separate cgroup cannot be created thus it is not possible to set up device access rules or identify processes belonging to a snap.
Hwoever, it does appear that the process was in /user.slice/user-1000.slice/session-1.scope cgroup, what suggest that the session was at least partially set up by systemd. Can you check whether DBUS_SESSION_BUS_ADDRESS is set in your environment? (and in the terminal you execute the command). Does /run/user/1000/bus exist and is it a socket?
When installing dbus-user-session (instead of using dbus-launch or dbus-run-session), it works. Why does one way to start the session bus work but not the other?
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:
Update: I just noticed, that there is one exception: cherrytree works also in the VNC session, while chromium, keepassxc, jabref, zoom-client donāt (giving the error message mentioned above).
this problem does not seem to affect unconfined snaps which might explain why cherrytree works.
I have this problem with a nomachine remote xubuntu desktop.
22.04 is not great when snap is broken.
There is a launchpad bug here https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491 where it was decided that it was not a snap problem. Unfortunately, the bug report has not got the attention of anyone who seems to know what the problem is.
You can disable new cgroups with a kernel parameter, which stops the error. I posted that tip in the bug report.
edit: There are now better workarounds at that bug report, and they hint that the login by the remote client is doing something wrong when setting up DBUS_SESSION_BUS_ADDRESS, which should be set by the systemd login flow somewhere. I think by the time the xsession is being set up, the root cause of the problem has already happened.
I came across this thread during my search for a solution for running ubuntu server 22.04 + firefox snap + geckodriver + python veenv + cron
Similar or exactly the same as this post
Your reply was helpful, even if it did not apply to my use-case, because I am not supposed to have (by Ubuntuās design) a running user-DBUS session , when I start scripts via cron.
I ended up removing the default firefox snap (has strict confinement) and installing the devmode snap with:
snap install firefox --devmode
I do not recommend regular users to do this as per the documentation. However, this is enough for my use-case that involves running automated web checks on a set of websites for the next few decades
EDIT: 20220728-1224: there is another proposed solution in the post I linked, which involves using the linger feature of systemd/loginctl. It has much more appeal than using ādevmodeā for production applications
I encounter the same issue with firefox running an a KVM virtual machine with Ubuntu Mate 22.04 LTS while it runs perfectly on a Ubuntu Mate 22.04 running on bare metal.
i aslo encounter this issue with firefox running on Ubuntu 22.04 within an virtualbox machine. I execute update, then firefox is working finely. Maybe a reference?
yep. Worked for me as well. I was launching it(or trying to) from WSL2(Ubuntu-22.04 LTS) and only sudo worked. But your āfixā was a charm. Thanks for that as well.
I am using VNC on Windows for an Ubuntu 22.04 system. I encountered the same error, and doing SSH solved some problems but not all. This is because whenever I want to upload something, it opens the files select window in the host monitor and not in the VNC display. I can see Firefox in the VNC display, but not this file select window that pops up when I want to upload something.
I ran the following command to open firefox in VNC client and a virtual display. I have not connected any monitor to my ubuntu system after this error happened and the upload window still does not appear in VNC virtual display.