Snaps are app packages for desktop, cloud and IoT that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and installable from the Snap Store, the app store for Linux with an audience of millions. This post is a quick snap cheat sheet for Ubuntu that contains the commonly used snap commands, fixes for common snapd service error that I faced and fixed. Hope it helps someone.
Installing snapd
Snappy was introduced with Ubuntu 16.04, so if you’re running that version or later, you’re already good to go.
Find snap packages
Type the following to look for and install the gimp image editor:
ubuntu@ubuntu:~# sudo snap find tautulli Name Version Publisher Notes Summary tautulli v2.9.7 jonnywong16 - A Python based monitoring and tracking tool for Plex Media Server.
Install snap packages
To install one of the packages, use the following command
ubuntu@ubuntu:~# sudo snap install tautulli
List snap packages
Use the snap list command
ubuntu@ubuntu:~# sudo snap list Name Version Rev Tracking Publisher Notes core18 20220309 2349 latest/stable canonical✓ base core20 20220318 1408 latest/stable canonical✓ base lxd 4.0.9-8e2046b 22761 4.0/stable/… canonical✓ - snapd 2.54.4 15183 latest/stable canonical✓ snapd tautulli v2.9.7 1508 latest/stable jonnywong16 -
Update snap packages
You can use the --list
option to check whether updates are available for any of the snap packages installed on your computer.
ubuntu@ubuntu:~# sudo snap refresh --list Name Version Rev Size Publisher Notes tautulli v2.9.7 1508 31MB jonnywong16 -
Manually updating all snaps
Regardless of when a refresh is scheduled, an update refresh can be initiated with the snap refresh command:
ubuntu@ubuntu:~# sudo snap refresh All snaps up to date.
Manually updating one snap
Use the refresh option to manually force a refresh:
ubuntu@ubuntu:~# sudo snap refresh tautulli
Automatically update snaps
Set a time to refresh packages automatically
ubuntu@ubuntu:~# sudo snap refresh --time timer: 00:00~24:00/4 last: today at 00:04 AEST next: n/a
Seems none set. So we set it to update between 4:00-7:00.
ubuntu@ubuntu:~# sudo snap set system refresh.timer=4:00-7:00 ubuntu@ubuntu:~# snap refresh --time timer: 4:00-7:00 last: today at 00:04 AEST next: today at 04:00 AEST
Removing a snap
To uninstall a snap package, use the remove option:
ubuntu@ubuntu:~# sudo snap remove tautulli
Commons Problems
Snap refresh or any command gives you a “error: cannot communicate with server
” error.
ubuntu@ubuntu:~# sudo snap refresh tautulli error: cannot communicate with server: Post http://localhost/v2/snaps/tautulli: dial unix /run/snapd.socket: connect: no such file or directory
Check if snapd service is running:
ubuntu@ubuntu:~# systemctl status snapd.service ● snapd.service - Snap Daemon Loaded: loaded (/lib/systemd/system/snapd.service; disabled; vendor preset: enabled) Active: inactive (dead) TriggeredBy: ● snapd.socket
Seems snapd service is dead for some reason. So we start it.
ubuntu@ubuntu:~# systemctl start snapd
Now check the status of snapd service again:
ubuntu@ubuntu:~# systemctl status snapd ● snapd.service - Snap Daemon Loaded: loaded (/lib/systemd/system/snapd.service; disabled; vendor preset: enabled) Active: active (running) since Fri 2022-04-15 00:04:35 AEST; 1s ago TriggeredBy: ● snapd.socket Main PID: 10722 (snapd) Tasks: 13 (limit: 9025) CGroup: /system.slice/snapd.service └─10722 /usr/lib/snapd/snapd Apr 15 00:04:32 ubuntu systemd[1]: Starting Snap Daemon... Apr 15 00:04:33 ubuntu snapd[10722]: AppArmor status: apparmor is enabled and all features are available Apr 15 00:04:35 ubuntu snapd[10722]: AppArmor status: apparmor is enabled and all features are available Apr 15 00:04:35 ubuntu snapd[10722]: daemon.go:246: started snapd/2.54.4 (series 16; classic) ubuntu/20.04 (arm64) linux/5.4.0-1058-raspi. Apr 15 00:04:35 ubuntu snapd[10722]: daemon.go:339: adjusting startup timeout by 55s (pessimistic estimate of 30s plus 5s per snap) Apr 15 00:04:35 ubuntu systemd[1]: Started Snap Daemon.
Well that fixes the problem. Now enable it at system startup to avoid this problem in future.
ubuntu@ubuntu:~# systemctl enable snapd Created symlink /etc/systemd/system/multi-user.target.wants/snapd.service → /lib/systemd/system/snapd.service.
Summary
- Search snap package:
sudo snap find tautulli
- Install snap package:
sudo snap install tautulli
- List all snap package:
sudo snap list
- Find info about a snap package:
sudo snap info tautulli
- Check if there’s any any updates for snap packages:
sudo snap refresh --list
- Manually update a snap package:
sudo snap refresh tautulli
- Uninstall a snap package:
sudo snap remove tautulli
- Automatically update snap packages:
sudo snap set system refresh.timer=4:00-7:00
- Check snapd service status:
sudo systemctl status snapd
- Start snapd service:
sudo systemctl start snapd
- Enale snapd service at startup:
sudo systemctl enable snapd
That’s it. Nothing fancy but just a collection of most commonly used commands. More here