Can't remove snap: read-only file system

Hello, i am really new to using snap, started yesterday. Can’t remove discord with snap remove, is there any other way to remove it?

Picture:
discord_uninstall

1 Like

You can try to remove the ~/snap/discord directory yourself, but the error message indicates that ~/snap/discord/121/data-dir is somehow on a read only filesystem.

It points to a file inside the /snap folder which will indeed be read-only.

alan@robot:~$ ls -la snap/discord/121
total 24
drwxr-xr-x 5 alan alan 4096 Feb 18 10:33 .
drwxr-xr-x 7 alan alan 4096 Feb 18 10:33 ..
drwx------ 9 alan alan 4096 Sep 17  2020 .config
-rw-rw-r-- 1 alan alan   31 Feb 18 10:33 .last_revision
drwxrwxr-x 3 alan alan 4096 Jun 14  2020 .local
drwx------ 3 alan alan 4096 Jun 14  2020 .pki
lrwxrwxrwx 1 alan alan   33 Feb 18 10:33 .themes -> /snap/discord/121/data-dir/themes

Hmm, I think that go standard library does the wrong thing here. If I’m reading the correctly, it descends the directory first and then tries to clean it up. So in this case, it would descend .themes first, try to remove entries inside, hit EROFS because we’re in the snap now and fail, see https://github.com/golang/go/blob/dev.boringcrypto.go1.16/src/os/removeall_at.go#L58 for reference.

Yes because it uses squashfs file system. I also tried to remove one more app and same problem, also getting refresh errors.

27   Error   today at 13:37 CET      today at 13:37 CET      Remove "spotify" snap
28   Error   today at 13:44 CET      today at 13:46 CET      Refresh snaps "joplin-desktop", "spotify"

Unless it’s exactly the same error with read only fs, I suggest to start a new topic and attach the output of snap change 27 (and 28).

Reinstalled snap and now it works very fine but not really sure what happened first time.

In my case, I could not get rid of the snap installation of firefox under Ubuntu 22.04. The command sudo snap remove --purge firefox, got aborted as shown below:

error: cannot perform the following tasks: Remove data for snap “firefox” (2077) (unlinkat /var/snap/firefox/common/host-hunspell/en_US.dic: read-only file system)

Following johnk1’s recommendation, I reinstalled snap, but the error did not go away, when I tried again. This time, I decided to unmount the offending point:

sudo umount /var/snap/firefox/common/host-hunspell

I finally could remove the snap version of firefox.

firefox removed

1 Like
$ sudo snap remove --purge firefox
error: cannot perform the following tasks:
- Remove data for snap "firefox" (1943) (unlinkat /var/snap/firefox/common/host-hunspell/en_ZA.dic: read-only file system)

Verify that indeed /var/snap/firefox/common/host-hunspell is mounted as an ext4 file system using lsblk -fe7 -o+ro

If so, stop the Firefox service

$ sudo systemctl stop var-snap-firefox-common-host\\x2dhunspell.mount
$ sudo systemctl disable var-snap-firefox-common-host\\x2dhunspell.mount 
Removed /etc/systemd/system/default.target.wants/var-snap-firefox-common-host\x2dhunspell.mount.
Removed /etc/systemd/system/multi-user.target.wants/var-snap-firefox-common-host\x2dhunspell.mount.

Then the uninstall command should work:

sudo snap remove firefox

thanks very muck! firefox removed with umount /var/snap/firefox/common/host-hunspell