Ubuntu 22.04 desktop version comes pre-installed with Snap. However, I find it inconvenient to use and the Snap directory in the Home folder is quite distracting. So, I tried uninstalling it but encountered several issues.

Essentially, the uninstall command would look like this:

sudo apt autoremove --purge snapd gnome-software-plugin-snap

However, when executing this command, I encountered a failure with the following error log:

rm: cannot remove '/var/snap/firefox/common/host-hunspell/en_US.aff': Read-only file system
rm: cannot remove '/var/snap/firefox/common/host-hunspell/en_US.dic': Read-only file system

OKAY, let's attempt to remove it ourselves, but unsurprisingly, we encountered another failure due to the 'Read-only file system' error.

We decided to use the lsblk command, which provided the following output:

$ lsblk 
│                                     
├─nvme0n1p4 259:4    0     1G  0 part 
├─nvme0n1p5 259:5    0  29.3G  0 part /var/snap/firefox/common/host-hunspell
│                                     /
├─nvme0n1p6 259:6    0   8.2G  0 part [SWAP]

This QA's top answer was

snap disconnect firefox:host-hunspell

However, in my case, snap has already been removed. I attempted to reinstall it and execute the above command again, but it did not work.

I uninstalled Snap once again and unmounted /var/snap/firefox/common/host-hunspell. Subsequently, I proceeded to delete the corresponding folder.

However, the issue persisted. Upon rebooting the machine, I discovered that the mountpoint reappeared.

After a few discovering, I found a file /etc/systemd/system/var-snap-firefox-common-host\x2dhunspell.mount

Here is the content:

[Unit]
Description=Mount unit for firefox, revision 2356 via mount-control
After=snapd.mounts-pre.target
Before=snapd.mounts.target
Before=local-fs.target

[Mount]
What=/usr/share/hunspell
Where=/var/snap/firefox/common/host-hunspell
Type=
Options=ro,bind,noatime,noexec
LazyUnmount=yes

[Install]
WantedBy=snapd.mounts.target
WantedBy=multi-user.target
X-SnapdOrigin=mount-control

This is the root cause of the mountpoint.

I tried to rename it:

mv /etc/systemd/system/var-snap-firefox-common-host\\x2dhunspell.mount \
   /etc/systemd/system/var-snap-firefox-common-host\\x2dhunspell.mount.fuckoff

After the reboot, everything appears to be functioning well, and it seems safe to remove this file.

Additionally, I noticed the presence of two additional symlinks in multi-user.target.wants and snapd.mounts.target.wants directories.

rm -f /etc/systemd/system/var-snap-firefox-common-host\\x2dhunspell.mount.fuckoff \
    /etc/systemd/system/multi-user.target.wants/var-snap-firefox-common-host\\x2dhunspell.mount \
    /etc/systemd/system/snapd.mounts.target.wants/var-snap-firefox-common-host\\x2dhunspell.mount

All cleaned.

References


Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

Leave a Reply

Your email address will not be published. Required fields are marked *