49

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.

0
20

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
2
  • 1
    refresh.metered=hold only works when NetworkManager detects a metered connection. – codywohlers Oct 31 '20 at 22:47
  • Solution 2 will only hold the updates for at most 60 days. – Merlijn Sebrechts Feb 5 at 17:43
11

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 updates for is 60.

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.

2
  • 1
    I want to prohibit automatic updates while I am using the program which is being updated. To my experience, apps usually crash when they are updated while running (e.g. Chrome). – w-sky Mar 4 at 10:02
  • 1
    Good suggestion @w-sky! You can do this by turning on the experimental "refresh app awareness" option: snapcraft.io/blog/… I updated the answer to include this info. – Merlijn Sebrechts Mar 5 at 9:16
9

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 :).

1
  • This is the only rationale answer. Having something like snap altering the system in an unpredictable way is not only annoying. It is destructive. Like an atomic bomb. Really. I'd rater be struck down by some rogue atomic bomb than something as badly designed as snap on purpose! Thank you very much! Your solution works. – Tino Apr 30 at 16:05
6

It's currently not possible to do so. However, you can schedule the time when the snaps are being automatically updated to your liking with this command:

sudo snap set core refresh.schedule=8:00-20:00

In this case, the updates will happen only once a day between 8pm and 8am (An example).

4
  • ``` snap set core refresh.schedule=20-8 error: cannot perform the following tasks: - Run configure hook of "core" snap (run hook "configure": cannot parse "20": not a valid time) ``` – sergiusens Dec 21 '17 at 16:36
  • that last one worked. – sergiusens Dec 21 '17 at 17:19
  • Yep, this works I just set mine to 18:00-20:00 - which was outside the time that I was currently. After running an sudo snap abort 123 on the current refresh job and a system reboot I no longer had the refresh. – icc97 Jul 31 '20 at 14:26
  • With snapd versions prior to 2.31, replace refresh.timer with refresh.schedule as per snapcraft.io/docs/keeping-snaps-up-to-date – codywohlers Oct 31 '20 at 22:45
6

One workaround may be to install from a version specific channel, i.e. for PyCharm:

snap install pycharm-professional --channel 2018.3/stable --classic

Then the snap will not be updated unless a new patch version to 2018.3 is released.

To see the channels available, use snap info, i.e.

$ snap info pycharm-professional
name:      pycharm-professional
summary:   Python IDE for Professional Developers
publisher: jetbrains✓
contact:   https://www.jetbrains.com/pycharm/documentation/
license:   unset
description: |
  PyCharm Professional Edition is an IDE for professional Python development. It is designed by
  programmers, for programmers, to provide all the tools you need for productive Python, Web and
  Scientific development.
  
  PyCharm Professional Edition is available for a free 30-day evaluation.
  
  Monthly and yearly subscription options are available for companies and individual users. Find out
  more on https://www.jetbrains.com/pycharm/buy/
commands:
  - pycharm-professional
snap-id:      Uqpw0ZWqy6Wh4mgaWE0rxgM5tAGCwf4D
tracking:     stable
refresh-date: 10 days ago, at 09:22 PDT
channels:
  stable:           2019.1.1 2019-04-03 (127) 392MB classic
  candidate:        2019.1.1 2019-04-03 (127) 392MB classic
  beta:             2019.1.1 2019-04-03 (127) 392MB classic
  edge:             2019.1.1 2019-04-03 (127) 392MB classic
  2019.1/stable:    2019.1.1 2019-04-03 (127) 392MB classic
  2019.1/candidate: 2019.1.1 2019-04-03 (127) 392MB classic
  2019.1/beta:      2019.1.1 2019-04-03 (127) 392MB classic
  2019.1/edge:      2019.1.1 2019-04-03 (127) 392MB classic
  2018.3/stable:    2018.3.5 2019-02-27 (121) 355MB classic
  2018.3/candidate: 2018.3.5 2019-02-27 (121) 355MB classic
  2018.3/beta:      2018.3.5 2019-02-27 (121) 355MB classic
  2018.3/edge:      2018.3.5 2019-02-27 (121) 355MB classic
  2018.2/stable:    2018.2.8 2019-04-12 (128) 313MB classic
  2018.2/candidate: 2018.2.8 2019-04-12 (128) 313MB classic
  2018.2/beta:      2018.2.8 2019-04-12 (128) 313MB classic
  2018.2/edge:      2018.2.8 2019-04-12 (128) 313MB classic
  2018.1/stable:    2018.1.6 2018-11-15 (101) 314MB classic
  2018.1/candidate: 2018.1.6 2018-11-15 (101) 314MB classic
  2018.1/beta:      2018.1.6 2018-11-15 (101) 314MB classic
  2018.1/edge:      2018.1.6 2018-11-15 (101) 314MB classic
  2017.3/stable:    2017.3.7 2018-11-15 (100) 344MB classic
  2017.3/candidate: 2017.3.7 2018-11-15 (100) 344MB classic
  2017.3/beta:      2017.3.7 2018-11-15 (100) 344MB classic
  2017.3/edge:      2017.3.7 2018-11-15 (100) 344MB classic
installed:          2019.1.1            (127) 392MB classic

5

The refresh service is launched by systemd and configured in:

  • /lib/systemd/system/snapd.refresh.service
  • /lib/systemd/system/snapd.refresh.timer

If you want to disable the autorefresh, override those configurations in /etc/systemd. Probaby the easiest way is to just set the timer to the frequency you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.