20

Ubuntu 16.04 - has a /snap/core folder with subfolders of revisions. Do I need the /snap folder at all?

Can I just remove it (and how)?

0

3 Answers 3

16

Snap is package management tool which was Canonical's new package management tool. And this snap package management used by Ubuntu Software Center--I know this because I never use the snap tool but I have 13+ snap folders. That is the reason /snap folder exist, I guess.

And tool name is snapd. So when you want to install or uninstall package, you should use command like this:

sudo apt autoremove snapd

or

sudo apt autoremove --purge snapd

If you are installing software package with apt command or synaptic package manager, you don't need snapd package. So you can remove it.

Ubuntu Software Center will use 'snapd'--that's what happen to me. But after removed snapd, Software Center won't use snapd, it seems.

13

The /snap folder isn't a traditional folder full of files. So you don't really delete the contents of that folder and get space back (if that's what you're expecting). This folder is used when snaps are installed. If for example you installed the Spotify snap then you'd end up with a /var/lib/snapd/snaps/spotify_6.snap file which contains the compressed application and libraries. This gets mounted under /snap/spotify/6 and symlinked as /snap/spotify/current.

The files haven't been uncompressed to that directory, they're just mounted and read at runtime. You can see this with mount | grep spotify, like this:-

/var/lib/snapd/snaps/spotify_6.snap on /snap/spotify/6 type squashfs (ro,nodev,relatime)

The same goes for the core runtime snap, which lives in the same location, and is mounted in a similar way. By default on a clean install of Ubuntu there are no snaps installed, even core. However as soon as you install a snap, you get the core snap pulled in, which contains the runtime low level dependencies needed by all snaps.

While you could unmount the directory and delete the core snap, you'd break all install snaps doing this, and the system will make it hard for you to do that as a result.

6
  • OK, I just like a clean system, and based on your explanation I have no need for snap. I may have tried to install something in the past, but presently don't have any snap, so I do not need any residual snap files on the system. No, the issue is not space, just pureness. I'll remove the /snap directory from a different boot.
    – Janos
    Jan 28, 2018 at 2:22
  • 11
    I was able to completely remove it with sudo apt purge snapd ubuntu-core-launcher squashfs-tools
    – Janos
    Jan 28, 2018 at 2:51
  • 1
    Thanks for this comment @Janos. I had 2GB of useless trash in my server removed.
    – marbel
    Oct 27, 2018 at 14:41
  • 2
    Great! Now I start to understand the snap philosophy, mounting snap packages, etc. My problem is that I used the "Software" program to install and remove stuff and. This, in many instances, created a loit of "snaps". My /var/lib/snapd is full of previously installed and uninstalled programs. My machine start to look line a Vindooz bloatware. I only have presently dosbox, illogically buried away in my ~/snap/dosbox-jz folder. Now, thanks to your latest posting I simply installed dosbox with apt, and will get rid of all traces of snap. Thx!
    – Janos
    Jan 22, 2019 at 14:16
  • 1
    @Janos It was only necessary for me to use sudo apt purge snapd in Ubuntu 18.10 to remove the /snap/ directory. Mar 9, 2019 at 4:56
6

The instruction

sudo apt purge snapd ubuntu-core-launcher squashfs-tools

also gets rid of the useless /dev/loop mounts.

3
  • Checked my system and apt purge reports that ubuntu-core-launcher and squashfs-tools packages are not installed, but thanks for your attention. My system is now clean and nimble.
    – Janos
    Oct 11, 2019 at 2:57
  • Be wary of this answer. If you've installed any applications using the "Ubuntu Software" app then this is likely to break those installations.
    – plowman
    Mar 21, 2023 at 22:10
  • Thanks @plowman Appreciate the warning. Aug 24, 2023 at 10:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .