How to stop snapd from auto-updating?
Snap packages are a good way to get access to much more software than before. You can now get as snap packages Skype, LibreOffice latest, GIMP latest, all JetBrains IDEs or even games.
All these are installed using the Ubuntu Software application and it's not necessary to use the command line.
The important question for you is this, do you really need to disable snap packages?
To temporarily disable snap packages (until reboot or if you run with start
):
sudo systemctl stop snapd.service
To permanently disable snap packages:
sudo systemctl stop snapd.service
sudo systemctl disable snapd.service
To reenable snap packages:
sudo systemctl reenable snapd.service
sudo systemctl start snapd.service
You can disable autostart for the service by clicking on the start button then search for "Startup Applications" and change the setting like this.
If these answers did't help out you may do next:
sudo systemctl mask snapd.service
- Completely disable the service by linking it to /dev/null; you cannot start the service manually or enable the service.sudo systemctl unmask snapd.service
- Removes the link to /dev/null and restores the ability to enable and or manually start the service
If you will need update a snap program you can unmask and start the service, then use command snap refresh
You can stop and mask your snapd service with:
systemctl mask snapd.service
systemctl stop snapd.service
And then use this script, which will give you the possibility to update your snaps easily ever still:
#!/bin/bash
# this script unmasks and starts the snapd service, do a refresh and disables it again
set -x
systemctl unmask snapd.service
systemctl start snapd.service
systemctl status --no-pager snapd.service
snap refresh
systemctl mask snapd.service
systemctl stop snapd.service
sleep 2
kill -9 $(pgrep snapd)
Put it in /usr/local/sbin/snap-update
and give it executable rights with chmod +x
.
Then you can just run:
sudo snap-update
I created a gist for it here that also deletes the old snaps, after new ones are installed.
Note: If you run the apt
auto updater and there is an update to a package that is managed by snapd
, it will hang if snapd is masked, so remember to unmask snapd in that case and start apt upgrade
again