How to Install and Use Snap Packages in Ubuntu

3 min


A tutorial on how to find, install and maintain snap packages in Ubuntu.

Snappy (in short, Snap) packages are transactional packages developed by Canonical for Ubuntu for its line of solution offerings. Due to its transactional nature, snap packages can be used in across Linux Distributions. Snap packages are handy due to their atomic update in nature for critical industrial use cases such as IoT.

The packages can be found and installed via the command line, primarily from a web store called Snapcraft. The snap packages can also be downloaded from this store as .snap files, containing all the dependencies needed inside the .snap package.

The installed snap software is installed in their respective folders and doesn’t interfere with the rest of the system. That means if you have installed software via typical apt-get install xyz and installed the same software by installing xyz.snap, then both versions of the same software can co-exist on your PC without interfering with each other.

In contrast, Flatpak also has a similar concept and offers much more robust offerings, mainly for GUI-driven apps.

This article will show you how to perform basic operations with snap via the command line.

How to install and manage Snap packages in Ubuntu

1. Find a Snap Package

To find a snap package, run the below command. It will give you a list of all available snap packages, their version and description.

snap find
snap find

You can give the name as an argument to find a specific snap package.

snap find name_of_package
snap find name

2. Install a Snap Package from Command Line

To install a snap package, run the below command with the snap package name.

sudo snap install name-of-the-package
snap install

The command will install the package with all of its dependencies in your system. In addition, you can also see the progress of your installation.

After installation, you can launch the application directly from the application menu.

3. Updating Snap Package

You can update an installed snap package by using the below command:

sudo snap refresh name-of-the-package
snap refresh

4. List your installed snaps

To list down all the snap packages installed in your system, use the below command;

snap list
snap list

5. Removing (or uninstalling) a snap package

To remove a snap package from your system, run the below command:

sudo snap remove name-of-the-package
snap remove

6. View Snap Activity

To view the recent changes done using snap in your system, run the below command. This will give the installed/updated activity list in those snap packages with the date and time stamps.

snap changes
snap changes

7. 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 the 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.
snap err

Ideally, when you do the same when installing via the apt install command, apt will take care when you run it for the second time.

To solve this error, follow these steps:

  • Run the below command to find out the ID of the error installation.
snap changes
snap changes abort
  • As you can see, ID=7 is the installation which I aborted. Now, run the below command with the ID.
sudo snap abort 7
snap abort
  • This will abort the pending change that still has a pending task. Now you can continue installing the same package or a different package.

Closing Notes

In this article, you learned some fundamental commands for managing snap packages in the Ubuntu system via the terminal. This should get you started for now. Also, for more common tasks such as install and remove – you can visit snapcraft.io and use install methods there. Further documentation about snap is available in the official reference.


Arindam

Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments