Howto free up space properly on my /var/lib/snapd filesystem when snapd is unavailable?

Solution 1:

Run

sudo rm /var/lib/snapd/cache/*

to clear the cache, that should give you some free space.

Solution 2:

You can remove all unused version of snap packages. You can create script file and make it executable or just copy & paste it in the console.

Note you need sudo rights for it.

#!/bin/sh
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' |
while read pkg revision; do
    sudo snap remove "$pkg" --revision="$revision"
done

If the snap remove command does not work because the snapd server is not run, you should free some space manually. You can remove an old version of a snap package file.

e.g. user ha two Chromium snaps, chromium_1781.snap and chromium_1801.snap. Just manually remove the older version using:

sudo rm /var/lib/snapd/snaps/chromium_1781.snap

And try to run the snapd service.

Also you can clean you file logs to get free space by this command:

journalctl --vacuum-size=100M