A tutorial on how to find, install and maintain snap packages in Ubuntu.
Ubuntu 16.04 LTS Xenial Xerus comes with the new style of package management called Snappy or in-short snap. Snappy packages are transactional packages developed by Canonical for Ubuntu. Due to its transactional nature, snap packages can be used in across Linux Distributions. Snap packages are very useful due to its atomic update in nature. The packages can be found and installed via command line. The snap packages also can be downloaded from websites as .snap files and it contains all the dependencies needed inside the .snap package. The installed snap softwares are installed in their respective folders and doesn’t interfere with rest of the system. That means, if you have installed a software via typical
apt-get install xyz and installed the same software via installing xyz.snap, then both the version of the same software can co-exist in your PC without interfering with each other.
As of today not much softwares are packaged in snap, but some of them are available. Here’s how to find them and install them.
Find a Snap Package
To find a snap package, run below command. It will give you a list of all available snap packages, their version and description.
To find a specific snap packages you can give the name as argument.
snap find name
Install a Snap Package from Command Line
To install a snap package, run below command with snap package name.
sudo snap install name-of-the-package
The chosen snap package will be installed using its all dependencies and progress can be seen in the terminal as well.
After installation, you can launch the application directly from Dash/Application menu.
Updating Snap Package
You can update an installed snap package by using below command:
sudo snap refresh name-of-the-package
List your installed snaps
To list down all the snap packages installed in your system, use below command;
Removing a snap package
To remove a snap package from your system, simply run below command:
sudo snap remove name-of-the-package
View Snap Activity
To view the recent changes done using snap in your system, run below command. This will give the list of installed/update activity in those snap packages with date time stamp.
Handling Snap Errors
There are some errors you may encounter while installing/maintaining snap packages. E.g. while downloading a snap package via command
snap install, if you press
CTRL+C for abort, then you may get below error while trying for the second time and so on. This is so bad that you can’t even install any other snap packages.
error: can't install "notes": snap "ubuntu-core" has changes in progress.
Ideally when you do the same when installing via apt install command, apt will take care when you run it for the second time. There is a bug (Bug#1592074) open as of writing this article for the expectation of rolling back the changes while aborting a snap installation.
To solve this error, follow these steps:
- Run below command to find out the ID of the error installation.
- As you can see, ID=7 is the installation which I aborted. Now, run below command with the ID.
sudo snap abort 7
- This will abort the pending change that still has pending task. Now you can continue installing the same package or different package.
Drop a comment if you are facing any trouble using snap packages.