How can I update all Snap packages?
By Sebastian Wright
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 5 Answers
sudo snap refresh Will do this. It is part of snapd 2.0.8, which landed 2016-06-13 in xenial-updates.
snap refresh --listOnly lists the updates without refreshing the packages.
snap info <snap name>Can show which versions are available for a particular package.
9According to Snap tutorial Snaps are automatically updated in the background once per day.
3Generally, you don't need to do anything.
snapd, in Ubuntu installs, will automatically check for updates. That's a key feature of snaps.
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 Try running snap with sudo:
sudo snap refresh 0 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") }}' 2