Last active
March 31, 2023 16:46
-
-
Save rubo77/15366925051dd214b18c306f9389a573 to your computer and use it in GitHub Desktop.
start snap service, delete snap backups, do a refresh and disable it again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script starts the snapd service, deletes old snap images, does a refresh and disables it again | |
# put it in /usr/local/sbin/snap-update and give it executable rights | |
# Note: If you run apt upgrade and there is an update to a package that is managed by snapd, | |
# the upgrade will hang if snapd is still masked, so remember to unmask snapd in that case | |
# and start apt upgrade again | |
set -x | |
systemctl unmask snapd.service | |
systemctl start snapd.service | |
systemctl status --no-pager snapd.service | |
snap refresh | |
LANG=C snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; do | |
snap remove "$snapname" --revision="$revision" | |
done | |
sudo rm /var/lib/snapd/cache/* | |
systemctl mask snapd.service | |
systemctl stop snapd.service | |
sleep 2 | |
kill -9 $(pgrep snapd) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry, but this became too complicated for me. Now I removed snap at all from my Ubuntu machine and switched to other package locations. I will switch back to snap once there is an option to disable automatic updates ;-) . Thank you for your support so far!