Is it safe to delete these snaps?
Solution 1
So, there's a couple questions here and I'll try to address them in an order that makes sense:
- What are snaps?
Snaps are a way to package software, like deb packages or flatpaks. They work across linux distros and have become popular because of how easy they are to maintain and use. You can find more here: https://snapcraft.io/
- What are the gnome, code, and core snaps?
Core is required for snap to function, it has the program's core runtime. The gnome snaps are a pack of basic apps (calculator, system-monitor, etc). The base gnome-3-34
snaps are dependencies for the various gnome apps. Code is vscode.
- The snaps in
/var/lib/snapd/snaps
are taking up 2.0 GB of space on my disk right now. I want to clear up space
Snap lets you easily roll-back to previous versions in case you want to. This leads to a lot of disk space being taken up, especially if an app and its dependencies are heavy. The other answer details how to limit this.
- I've installed discord and spotify. Will deleting the discord and spotify snaps lead to any issues with opening those applications
Yes, if discord and spotify are installed via snap removing those files will result in the applications being removed (or broken, in this case).
- I'm not sure if deleting these snaps is safe (if so, can I just run sudo rm -rf *?)
If you delete the snaps properly (through snap remove
) yes, most of them can be removed. Removing files manually with sudo rm
is dangerous. Some programs have files littered around the system and removing only part of them can cause issues and, sometimes, may need a reinstall to fix.
If a package is installed through a manager (snap
in this case), you should always uninstall it via the same manager.
Since you removed files manually, snap can't find all the parts it needs to function and fails. You'll want to reinstall it with the following (note this will likely remove config files for snap and its programs, if that is an issue back them up):
sudo apt purge snapd
sudo apt install snapd
snap install discord spotify code [...]
Solution 2
Yes it is safe to free up some space by deleting the the snap cache in /var/lib/snapd/snaps/
when the folder grows large.
Try this:
sudo apt purge snapd
This should actually remove that dir and all traces of snaps on your system.
More snap versions are stored by the system after snap package updates. Meaning that for each installed snap package that had updates, you could have several revisions stored on your system, thus taking up quite a bit of disk space.
There is a snap option (starting with snapd version 2.34), called refresh.retain
, to set the maximum number of a snap's revisions stored by the system after the next refresh, which can be set to a number between 2 and 20. You can change this from the default value of 3 to 2 by using:
sudo snap set system refresh.retain=2
But what if you want to remove all versions kept on the system for all snap packages that had updates?
Follow This link for more information.
silkthyme
Updated on September 18, 2022Comments
-
silkthyme over 1 year
UPDATE: No, it is not safe to delete these snaps. I deleted them and can no longer open three of my applications. Attempt at opening Visual Studio Code:
~$ code internal error, please report: running "code" failed: cannot find installed snap "code" at revision 33: missing file /snap/code/33/meta/snap.yaml
The snaps in
/var/lib/snapd/snaps
are taking up 2.0 GB of space on my disk right now. I want to clear up space, but I'm not sure if deleting these snaps is safe (if so, can I just runsudo rm -rf *
?)This is what I see when I run
snap list
:code_32.snap gnome-3-28-1804_116.snap gnome-logs_93.snap code_33.snap gnome-3-34-1804_27.snap gnome-system-monitor_135.snap core18_1705.snap gnome-3-34-1804_33.snap gnome-system-monitor_145.snap core18_1754.snap gnome-calculator_730.snap gtk-common-themes_1502.snap core_8935.snap gnome-calculator_748.snap gtk-common-themes_1506.snap core_9066.snap gnome-characters_495.snap partial discord_109.snap gnome-characters_539.snap spotify_36.snap gnome-3-28-1804_110.snap gnome-logs_100.snap spotify_41.snap
What are the
gnome, code,
andcore
snaps?I've installed discord and spotify. Will deleting the
discord
andspotify
snaps lead to any issues with opening those applications?I'm using Ubuntu 18.04.3 LTS.
-
GammaGames almost 4 yearsWhat, did you delete the core snaps too? Probably a good idea to just purge and reinstall snapd at this point. For future reference you can search for packages and discover what they are on the snapcraft site: snapcraft.io
-
GammaGames almost 4 yearsAs for how to reinstall: superuser.com/a/102465/920594
-
silkthyme almost 4 yearsMaybe the problem was I navigated to the
snaps
directory and usedsudo rm -rf
to manually delete each snap, instead of deleting withsudo apt purge snapd
. The reason I didn't use that command is because I wasn't sure if it was safe to delete the wholesnaps
directory. Are you absolutely sure purging and reinstalling snapd is safe? -
GammaGames almost 4 yearsSnaps are just a way to package software, core is the "core" stuff that snapd needs in order to function. Removing files manually is dangerous and can lead to you hosing your system pretty easily, almost everyone has made this mistake at least once so no worries ;)
sudo apt purge snapd
will remove the package and all config files. I'm not 100% certain if it'll be completely successful, but I would definitely try that first. -
silkthyme almost 4 yearsThank you for the answers. I wish people would read my question description instead of only looking at the title. Maybe next time I'll put all my questions in the title.
-
GammaGames almost 4 yearsIf my commands worked I'll write it up in an answer for your questions and submit it, just let me know how it goes.
-
-
silkthyme almost 4 yearsCan you respond to my other questions? > What are the gnome, code, and core snaps? > I've installed discord and spotify. Will deleting the discord and spotify snaps lead to any issues with opening those applications?
-
David Kariuki almost 4 yearsYes you can remove them without issue. If you want to retain any of the cache files in use, check if the folders are empty. If they are proceed to remove them. If they are not empty, check file properties for some of them and look at when they were last accessed. This should tell you if those files have been in use recently by any other software. Should be safe to remove those folders if they haven't been accessed recently. Using your file manager (nautilus, on my system) you can right click on the file, then select Properties. Look for Accessed.
-
silkthyme almost 4 yearsBad news. I removed the discord and spotify snaps as you said, and now I can no longer open those applications. Gonna have to re install.
-
silkthyme almost 4 yearsAlso, now I'm getting this error after trying to reinstall:
snap install discord error: cannot perform the following tasks: - Automatically connect eligible plugs and slots of snap "discord" (internal error: auto-connect of &{"discord:sound-themes" "gtk-common-themes:sound-themes"} failed: snap "gtk-common-themes" has no slot named "sound-themes")
-
David Kariuki almost 4 yearsPlease try purging those packages and try again
-
silkthyme almost 4 yearsCould you clarify what you mean by "purging those packages"? There are no packages to purge! I deleted all my snaps! The problem is those packages no longer exist, not that they need to be purged
-
silkthyme almost 4 yearsThank you so much! I'm not sure if I need to back up config files for snap. Why might I want to?
-
GammaGames almost 4 years@silkthyme You probably don't need to, some apps keep stuff like login information or config settings in your home directory. Apps like Discord or Spotify save everything on their servers anyway, so really the only thing that might be lost in your case is active vscode extensions or themes.
-
silkthyme almost 4 yearsThanks, I see. Where are the config files located?
-
GammaGames almost 4 years@silkthyme They would be somewhere in your home directory, something like
/home/[username]/snap/[app]
. You can find more info here: askubuntu.com/a/762405/831221 -
silkthyme almost 4 yearsI don't know how it's possible, but I didn't do anything and VSCode is back. And I can open it again.