474

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
0

10 Answers 10

642
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
10
  • 3
    You need to do sudo snap refresh
    – user677955
    Apr 25, 2019 at 4:03
  • 13
    @Boris, snap prompts you for your password if you don't include sudo so it's not entirely necessary. Nov 7, 2019 at 22:53
  • 1
    @SpookyGengar no it doesn't: $ snap refresh error: access denied (try with sudo) Nov 26, 2019 at 21:29
  • 4
    @RickyNelson On my 18.04 it does prompt me without using sudo
    – John
    Jan 10, 2020 at 2:18
  • 1
    @SpookyGengar @John I'm on Ubuntu 19.10 with snapd 2.43.3 and it doesn't prompt me, it just says error: access denied (try with sudo).
    – user677955
    Feb 25, 2020 at 22:25
73

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.

4
  • 2
    However, I was checking Firefox today which said "Updates disabled by your system administrator" (strange since I am the only user and I just installed my OS three days ago). snap refresh firefox was the only way to get the latest security patches.
    – John
    Jan 10, 2020 at 2:20
  • Interesting. Please add a comment if you ever find out why that's the case...
    – chrisvdb
    Jan 10, 2020 at 3:11
  • 3
    However, if you don't close the application it will not be updated and you will receive daily notifications to do so.
    – thanos.a
    Jun 1, 2022 at 14:08
  • 2
    Still can't fix that annoying update issue. we're 5 years later (or 1 depending on the comment). snap has been rolled out to mayer public distro's, and i still have to update in 3 places and close apps. once that was the big selling point of linux upgrading without closing (rebooting).
    – Nijboer IT
    May 10, 2023 at 9:43
29

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
2
  • My next is seven days ago. Should I be bothered? My timer is the same as yours, but in the source link there is the info refresh 4 times a day, which is every 6 hours.So if my Pc is never on for 6 hours, I will never get an update. So I have to change the config..
    – Timo
    Oct 17, 2020 at 20:06
  • 1
    @Timo please open a new question if your issue persists. We're not going to diagnose that underlying cause of your symptom here.
    – user535733
    Oct 24, 2020 at 10:17
16

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 
2
  • 1
    this one worked for me
    – Joel
    Apr 30, 2023 at 23:03
  • killing the snap-store and then doing a refresh also helped me. My pc is not on very long as a home PC, so the snaps don't always get time to update, I think.
    – Adesso
    Feb 22 at 19:38
12

Try running snap with sudo:

sudo snap refresh
0
6

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") }}'
1
  • 6
    This is not necessary any more.
    – dholbach
    Jun 14, 2016 at 7:11
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.

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.

2

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

~$ snap-store

You get

enter image description here

And that is all

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .