The terminology ‘snap’ encompasses two things: Snap the package manager that is used to install packages and snap the installation file. A snap is a compressed file that ships with an application alongside its dependencies. Snaps are usually preferred to the APT package manager since they eliminate dependency issues for the very reason that they come bundled with all the dependencies required for the application to run. In this article, you will learn how to manage snap updates.
Basic snap commands
In the introduction, we have seen what snaps are and their advantages over the traditional APT and deb package managers. Before we get to managing snap updates, let’s have a brief overview of some basic snap commands.
To list the snaps installed on your system, run the command:
$ snap list
If you want to check if a certain snap is available from the snap store, use the syntax:
$ snap find [ package name ]
For example, to check if we can install VLC media player from the snap store, run the command:
$ snap find vlc
If a package is available, the following information will be printed on the terminal giving details about the name , version and Publisher of the package.
To install a snap from the snap store, execute:
$ sudo snap install [ package name ]
For example, to install VLC media player or simply vlc package, run the command.
$ sudo snap install vlc
Manually Manage snap updates
With a brief recap of basic snap commands, let now shift our focus on how to manage snap updates. By default, snaps are automatically updated. An installed snap will usually check for updates close to four times in a day.
Nevertheless, you can manually upgrade a snap to its latest version by executing the command:
$ sudo snap refresh [ package name ]
If all snaps are up to date, you will get the output below indicating that all snaps are up to date.
To update all snaps simply run:
$ sudo snap refresh
To check the last time the package refreshing occurred and the next time it’s going to happen, run the command:
$ snap refresh --time
Manage snaps by controlling Package Updates
The snap package manager extends some level of freedom to users and allows then to determine when and how snaps are updated. This is based on the following options:
refresh.timer defines the schedule and the refresh frequency of installed snap packages. It helps you to modify how frequently snaps are refreshed. In the example below, the system is commanded to perform the snap refresh between 3:00 am and 6:00 am and between 2100hrs and 2345hrs.
$ sudo snap set system refresh.timer=3:00-6:00,21:00-23:45
Thereafter, you can run the snap refresh –time command once more to confirm the set timer.
$ snap refresh --time
refresh.metered option pauses and re-enables the connection when the Network manager daemon detects a metered connection, for example, an LTE link.
To hold the refreshing of snaps, execute the command:
$ sudo snap set system refresh.metered=hold
To resume refreshing, execute:
$ sudo snap set system refresh.metered=null
refresh.retain option sets the maximum number of a snap’s revision retained by the system after the proceeding refresh. This value can be anything between 2 and 20. By default, this value is set to 3 on Ubuntu core while classic Ubuntu systems( e.g Ubuntu 18.04 LTS & Ubuntu 20.04 LTS ) set it to 2.
To set it to a different value, say 5, run the command:
$ sudo snap set system refresh.retain=5
Lastly, we will see how you can monitor your snaps updates. For this, use the
snap changes command.
$ snap changes
And this brings us to the end of this article. We do hope that you can comfortably manage your snap updates without much f a hassle.