511

I know that I can update a snap package using

sudo snap refresh <package>

But is there a way to update all snaps, like

sudo apt dist-upgrade
Andrew M
  • 2,398

10 Answers10

699
sudo snap refresh 

Will do this. It is part of snapd 2.0.8, which landed 2016-06-13 in xenial-updates.

snap refresh --list

Only lists the updates without refreshing the packages.

snap info <snap name>

Can show which versions are available for a particular package.


You can also update a specific application if the other method fails

sudo snap refresh <Application>

Example usage:

sudo snap refresh slack --classic
The Dan
  • 113
Zygmunt Krynicki
  • 7,599
  • 1
  • 13
  • 8
77

According to Snap tutorial Snaps are automatically updated in the background once per day.

However, if you don't close the application it will not be updated and you will receive daily notifications to do so.

chrisvdb
  • 1,013
34

Generally, you don't need to do anything.

snapd, in Ubuntu installs, will automatically check for updates several times each day. That's a key feature of snaps.

  • Exception: Applications cannot be updated while running, which means that long-lived applications (like web browsers) might not update automatically. In Ubuntu 22.04 and newer releases, snapd will warn you daily about your 2-week window to quit, update, and restart.

Here's how to determine how often snapd will automatically check for updates: (source)

$ snap refresh --time
timer: 00:00~24:00/4        <------ "/4" means refresh every 4 hours.
last: today at 17:15 CDT
next: today at 21:45 CDT
user535733
  • 68,493
18

For me the issue was with snap store. It booted on start hence it could never update itself.

so I ran to verify that snap-store is the issue

 sudo snap refresh 
 snap refresh --list
 snap refresh --time

The fix was to kill the process and then update:

 sudo killall snap-store
 sudo snap refresh 
Snake_py
  • 281
  • 2
  • 5
13

Try running snap with sudo:

sudo snap refresh
Eliah Kagan
  • 119,640
7

Try this in /usr/bin/update-snaps:

#!/bin/bash
ROOT_UID="0"

#Check if run as root
if [ "$UID" -ne "$ROOT_UID" ] ; then
        echo "You must be root to do that!"
        exit 1
fi

snap list | awk -F" " '{if ($1 && NR>1) { system("snap refresh " $1 " 2>/dev/null") }}'
Pablo Bianchi
  • 17,371
carlos
  • 87
3

What I did it was: In terminal (ubuntu 22.10)

~$ snap-store

You get

enter image description here

And that is all.

Edit: In my new machine, I get a windows and I must go to the button "Manage..." for updates snaps

wmora2
  • 183
2

Updates the Snap packages

If what we want is to check if there is an update of an app and install it, the command will be the following, where APPLICATION corresponds to the program we want to update:

sudo snap refresh APPLICATION

For example, if we want update Firefox, the command would be sudo snap refresh firefox.

What I and maybe some of you are wondering is: "Who updates only one package from the terminal?" Surely someone will, but I usually update everything. The Snap equivalent of sudo apt update && sudo apt upgrade, Is the following:

By not indicating any package, what it will do is search for all the Snaps that we have installed, it will check if there is a new version and it will install it.

List updates without installing them

The third command I was talking about may be interesting if you only want to install some packages. It would be the following:

This can help us, for example, if we are waiting for an update like May water, we see that it is and then we want to install the app we expected and some other, avoiding installing everything if it turns out that there is a lot to install. In this way, we would save time. In this article you have other options that we can use with the «snap» command.

Kokizzu
  • 518
2

An alternative way that worked for me was to go to the search bar and search for snap store, open that up, go to the update tab, then press update.

1

With Slack (and some other apps) it's a little more tricky because they run in the background and start automatically on reboot. Be sure to close the app in the background and ensure that it has not started automatically on reboot if you wish to update. Here's a command to stop slack as an example of such a program:

sudo kill -9 $(pidof slack)

After that you can run the update of the specific app:

sudo snap refresh slack --classic

to have it take effect.

Here's a handy copy and paste one-liner:

sudo kill -9 $(pidof slack);sudo snap refresh slack --classic

Might even put that in a shutdown script to fully automate.

Dan Gurin
  • 111
  • 1