Can I turn off automatic updates of snap apps? [duplicate]

Is it possible to disable autorefresh in snap? This link says that Snaps are updated automatically in the background to the latest version, every day. Some snaps (e.g. vlc) are built daily, and it makes no sense to install them every day.


Solution 1:

It is at the time of this writing not possible (officially), which has stirred quite a debate. Better ways to control updates on the desktop are still being discussed.

Solution 1

Block the store in your /etc/hosts/ file:

127.0.0.1 api.snapcraft.io

For me what worked was sudo nano /etc/hosts, copy-pasted the line, then I hit F2, then Y, then ENTER.

Solution 2

Disable automatic updating if the network connection is metered.

First, go to your network settings.

Network settings

Then, click on the cog wheels on the right side of both of your network interfaces and tick "restrict background data usage" - this marks the connection as being metered.

Restrict background data

Finally, open a terminal and type (docs):

sudo snap set system refresh.metered=hold

Solution 2:

There are a couple of options, depending on what you want exactly.

An update broke my application!

Run snap revert package-name to go back to the previous version of that application. You will stay on that version until the next version of the app gets released. If the next version is broken too, you can run snap revert again.

I want to stick with an older version of the app

Many software in the snap store uses tracks for major software releases. Most snaps default to using the latest/stable track, which will give you the latest updates of the application once they are released but users can choose a different track to stick with a specific version.

For the CLion IDE, for example, you can see the supported tracks by running snap info clion. You can switch to a different track by running snap refresh clion --channel=2020.2/stable. You will stay on that track until you manually change to a different track. You will still get automatic updates for the application but depending on which track you choose, you will only get the minor updates for that specific version of the software.

Publishers decide whether or not to enable tracks in their snap, so if a snap you like doesn't have a track for the version you need, be sure to contact the publisher!

I want to check updates before I install them

In this case, you probably want to change the refresh timer. For example, the following option sets the refresh timer to the last Friday of the month, from 23:00 to 1:00 the next day. This gives you a lot of time to check the updates and install them manually.

sudo snap set system refresh.timer=fri5,23:00-01:00

You can use the CLI tools or the snap store to see which updates are available.

I want to hold all updates until after my big presentation

The "hold" option is what you need. You specify an exact date and snap will hold any updates until that date. For example, this holds updates for the next 30 days.

sudo snap set system refresh.hold="$(date --date='today+30 days' --iso-8601=seconds)"

Note: the maximum number of days you can hold the updates for is 90.

I want to disable updates when I'm paying for my download bandwidth

By default, snap will not update when NetworkManager detects a metered connection such as an LTE/3G/4G. If NetworkManager does not detect it correctly, you can set it manually.

I want to disable updates while the application is running.

This is an experimental feature you can turn on by running the following command:

snap set core experimental.refresh-app-awareness=true

For more info, see snap refresh awareness and update inhibition

I want to do something else!

See the Controlling updates docs for more options.

Do you need another configuration option? Join the discussion in how to control snap updates on the desktop.

Solution 3:

Stop (will restart on boot), then disable the snapd daemon:

sudo systemctl stop snapd.service
sudo systemctl mask snapd.service

Note ( systemctl ): mask is a stronger version of disable.

To re-enable and refresh:

sudo systemctl unmask snapd.service
sudo systemctl start  snapd.service
sudo snap refresh

refresh will refresh all snaps in the system.

This is a summary of much better answers than any given here. For some reason ~that~ question was marked as duplicate pointing back to this one :).