Cannot start some apps (apps show up as broken)

Hi everybody,

I have a problem with my snaps. I installed a few apps through snap, but at some point, some of the programs stopped working. I noticed this first with Spotify, which ran ok for a while but suddenly stopped working. When I ran it from a terminal I got something like this:
cannot create cgroup hierarchy /sys/fs/cgroup/devices/snap.spotify.spotify/: Read-only file system
I looked for solutions online, didn’t find anything, so I deleted the snap, installed it from the package and moved on. A month or so later I installed barrier for sharing my mouse and keyboard between my two pcs. It worked great for two months or so when suddenly today it stopped working. Again, I ran it from a terminal to see if it spat out some info and again i got:
cannot create cgroup hierarchy /sys/fs/cgroup/devices/snap.barrier.barrier/: Read-only file system
At first i thought it might be some sort of permission problem but sudoing didnt do anything (these are the permissions for /sys/fs/cgroup/devices:)

drwxr-xr-x  2 root root  40 Feb 10 08:19 devices

I tried running other apps like inkscape:
internal error, please report: running "inkscape" failed: cannot find installed snap "inkscape" at revision 5874: missing file /snap/inkscape/5874/meta/snap.yaml
and the same for gimp:
internal error, please report: running "gimp" failed: cannot find installed snap "gimp" at revision 227: missing file /snap/inkscape/227/meta/snap.yaml

Also, while writing this, I just realized that the output of snap list shows a lot of packages as broken:

Name                  Version             Rev   Tracking  Publisher      Notes
barrier               2.3.2-13-g9080ce45  83    stable    adrianceleste  -
core                  16-2.43.2           8592  stable    canonical*     core
core18                                    1668  stable    canonical*     broken
gimp                                      227   stable    snapcrafters   broken
gnome-3-26-1604                           98    stable/…  canonical*     broken
gnome-3-28-1804                           116   stable    canonical*     broken
gnome-calculator                          544   stable/…  canonical*     broken
gnome-characters                          399   stable/…  canonical*     broken
gnome-logs                                81    stable/…  canonical*     broken
gnome-system-monitor                      127   stable/…  canonical*     broken
gtk-common-themes                         1440  stable/…  canonical*     broken
gtk2-common-themes                        9     stable    canonical*     broken
inkscape                                  5874  stable    inkscape*      broken
pycharm-professional  2019.3.3            183   stable    jetbrains*     classic
rider                 2019.3.2            40    stable    jetbrains*     classic

Pycharm and rider work like intended.
Does anyone have an idea where this might come from? Or what I can do about it?

$ snap version
snap    2.43.2
snapd   2.43.2
series  16
ubuntu  18.04
kernel  5.3.0-28-generic

Cheers!

What is the output of findmnt on your system? You might want to put the output in a pastebin it could be rather large.

its not too bad, here it is:

TARGET                       SOURCE             FSTYPE   OPTIONS
/                            /dev/sda5          ext4     rw,relatime,errors=remount-ro
├─/sys                       sysfs              sysfs    rw,nosuid,nodev,noexec,relatime
│ └─/sys/fs/cgroup           tmpfs              tmpfs    ro,nosuid,nodev,noexec,mode=755
│   └─/sys/fs/cgroup/unified cgroup             cgroup2  rw,nosuid,nodev,noexec,relatime,nsdelegate
├─/proc                      proc               proc     rw,nosuid,nodev,noexec,relatime
├─/dev                       udev               devtmpfs rw,nosuid,relatime,size=8144932k,nr_inodes=2036
│ ├─/dev/pts                 devpts             devpts   rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmo
│ └─/dev/shm                 tmpfs              tmpfs    rw,nosuid,nodev
├─/run                       tmpfs              tmpfs    rw,nosuid,noexec,relatime,size=1633848k,mode=75
│ ├─/run/lock                tmpfs              tmpfs    rw,nosuid,nodev,noexec,relatime,size=5120k
│ ├─/run/snapd/ns            tmpfs[/snapd/ns]   tmpfs    rw,nosuid,noexec,relatime,size=1633848k,mode=75
│ ├─/run/user/1000           tmpfs              tmpfs    rw,nosuid,nodev,relatime,size=1633844k,mode=700
│ └─/run/user/121            tmpfs              tmpfs    rw,nosuid,nodev,relatime,size=1633844k,mode=700
├─/boot                      /dev/sda1          ext4     rw,relatime
├─/snap/barrier/83           /dev/loop8         squashfs ro,nodev,relatime
├─/snap/pycharm-professional/183
│                            /dev/loop10        squashfs ro,nodev,relatime
├─/snap/rider/40             /dev/loop1         squashfs ro,nodev,relatime
├─/snap/core/8592            /dev/loop0         squashfs ro,nodev,relatime
└─/home                      /dev/sda6          ext4     rw,relatime

I, in the meantime, tried to install notepadqq, which installed fine but didnt start with the same error message about cgroup hierarchy
Thanks!

Hmm, you seem to have some missing cgroup mounts in your cgroup heirarchy, for example I see this on a generic bionic VM:

├─/sys                                sysfs      sysfs      rw,nosuid,nodev,noexec,relatime
│ ├─/sys/kernel/security              securityfs securityfs rw,nosuid,nodev,noexec,relatime
│ ├─/sys/fs/cgroup                    tmpfs      tmpfs      ro,nosuid,nodev,noexec,mode=755
│ │ ├─/sys/fs/cgroup/unified          cgroup     cgroup2    rw,nosuid,nodev,noexec,relatime
│ │ ├─/sys/fs/cgroup/systemd          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,xattr,name=systemd
│ │ ├─/sys/fs/cgroup/blkio            cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,blkio
│ │ ├─/sys/fs/cgroup/memory           cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,memory
│ │ ├─/sys/fs/cgroup/hugetlb          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,hugetlb
│ │ ├─/sys/fs/cgroup/rdma             cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,rdma
│ │ ├─/sys/fs/cgroup/freezer          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,freezer
│ │ ├─/sys/fs/cgroup/devices          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,devices
│ │ ├─/sys/fs/cgroup/pids             cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,pids
│ │ ├─/sys/fs/cgroup/cpu,cpuacct      cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,cpu,cpuacct
│ │ ├─/sys/fs/cgroup/perf_event       cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,perf_event
│ │ ├─/sys/fs/cgroup/net_cls,net_prio cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,net_cls,net_prio
│ │ └─/sys/fs/cgroup/cpuset           cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,cpuset

can i add them manually? or is there a way to let snap create them for me?

Yes, try running:

$ sudo mount -t cgroup -o devices none /sys/fs/cgroup/devices
$ sudo mount -t cgroup -o freezer none /sys/fs/cgroup/freezer

Hi!

I tried running the above commands which didnt give me any errors. Then i tried running gimp which gave me the same error as before. Therefore i tried refreshing the snap, which resulted in the following:

$ sudo snap refresh
error: cannot perform the following tasks:
- Setup snap "gimp" (245) security profiles (cannot find installed snap "gimp" at revision 227: missing file /snap/gimp/227/meta/snap.yaml)
- Run post-refresh hook of "gimp" snap if present (run hook "post-refresh": cannot perform operation: mount --rbind /dev /tmp/snap.rootfs_e3Ikrx//dev: No such file or directory)

Then i tried to remove and reinstall the snap, but when running the remove command i get an error:

$ sudo snap remove gimp
error: cannot perform the following tasks:
- Disconnect gimp:x11 from core:x11 (internal error: connection "gimp:x11 core:x11" not found in state)

I accidentally reran the remove command and got a different error message:

$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:desktop-legacy from core:desktop-legacy (internal error: connection "gimp:desktop-legacy core:desktop-legacy" not found in state)

Which made me curious as to what will happen if i rerun it a bunch more times:

$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:unity7 from core:unity7 (internal error: connection "gimp:unity7 core:unity7" not found in state)
$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:opengl from core:opengl (internal error: connection "gimp:opengl core:opengl" not found in state)
$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:home from core:home (internal error: connection "gimp:home core:home" not found in state)
$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:wayland from core:wayland (internal error: connection "gimp:wayland core:wayland" not found in state)
$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:desktop from core:desktop (internal error: connection "gimp:desktop core:desktop" not found in state)
$ sudo snap remove gimp 
error: cannot perform the following tasks:
- Disconnect gimp:network from core:network (internal error: connection "gimp:network core:network" not found in state)
$ sudo snap remove gimp 
gimp removed

so after rerunning it a bunch of times i finally got rid of gimp (for some reason it apparently did something else every time i called it). Then i looked at snap list to verify it wasn’t there anymore, which showed me it was gone. So i tried reinstalling it:

$ sudo snap install gimp 
error: cannot perform the following tasks:
- Run install hook of "gimp" snap if present (run hook "install": cannot perform operation: mount --rbind /dev /tmp/snap.rootfs_ri3p9z//dev: No such file or directory) 

Just to get the same error as before. To me it seems like there might be a problem with the path normalisation (consider /tmp/snap.rootfs_ri3p9z//dev: it seems like there is an extra forward slash in that, which might cause snap to not recognise the path?). Do you have any other ideas?

Thank you for bearing with me. I feel like were getting close to figuring this out.