1. Home
  2. Linux
  3. How to use and install snap packages on Linux

How To Use And Install Snap Packages On Linux

On Linux, there are many different ways to install software. There are Debian packages, Redhat RPM packages, the Arch Linux user repository, the Gentoo Portage tree, AppImages, tar.gz archives with static binary files, and the list goes on. Still, with as many ways to install software on Linux, there are still many problems present. For example: when developing professional software for Linux, it’s very hard to get it on every single Linux distribution. The people at Ubuntu are committed to solving this issue. Their solution ; Snap packages. Here’s a look at the need for Snap Packages on Linux, and how to use and install them.

SPOILER ALERT: Scroll down and watch the video tutorial at the end of this article.

Why Snap Packages Were Developed

Often times developers find themselves packaging their programs in many different package types, and get discouraged. It takes time to make all of these package files, and as a result, lots of programs don’t make it onto Linux. This is why the people at Ubuntu developed Snap packages. A snap is something that can be installed from the snap store, and inside the “snap” is everything the program is required to run.

This means that everything the app needs (libraries, binary files, image files, audio files and programs) are self contained and can run independent of the system. This ensures that no matter what, the program will run despite how outdated, or misconfigured the host system is. This Effectively makes it possible to install snaps on any Linux distribution, and makes it a “universal installer” that any developer, big or small, can pick up and even make their own snap store!

Installing Snapd and getting it running

Snapd is the technology that helps snaps run on Linux. The company behind snaps has worked with other Linux distribution makers so that the popular and most used Linuxes can run and install snaps with ease. Here’s how to get it running

Note: Ubuntu users, as well as those using a Linux distribution based on Ubuntu will not need to install Snapd.

Debian testing/unstable

sudo apt install snapd

Fedora

sudo dnf install snapd
sudo systemctl enable --now snapd.socket

Arch Linux

sudo pacman -S snapd
sudo systemctl enable --now snapd.socket

OpenSUSE Leap 42.2

sudo zypper addrepo https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_42.2/ snappy
sudo zypper install snapd
sudo systemctl enable --now snapd.socket

OpenSUSE Tumbleweed

sudo zypper addrepo https://download.opensuse.org/repositories/system:/snappy/openSUSE_Tumbleweed/ snappy
sudo zypper install snapd
sudo systemctl enable --now snapd.socket

Gentoo

sudo -s
nano -w /etc/portage/repos.conf/gentoo-snappy.conf

Paste the following:

[gentoo-snappy]
 
# An unofficial overlay that supports the installation of the "Snappy" backbone.
# Maintainer: Clayton "kefnab" Dobbs (clayton.dobbs@gosecur.us)
# Upstream Maintainer: Zygmunt "zyga" Krynicki (me@zygoon.pl)
 
location = /usr/local/portage/gentoo-snappy
sync-type = git
sync-uri = https://github.com/zyga/gentoo-snappy.git
priority = 50
auto-sync = yes

Save the configuration file with ctrl + O.

emaint sync --repo gentoo-snappy

How To Use Snaps

As mentioned earlier, snaps are hosted in the “snap store” run by Ubuntu and Canonical respectively. Anyone can post a snap for free. For those looking to publish their own snap packages to the store, head over to Snapcraft.io. This website has all of the information (in heavy detail) that can get you started.

To search the store for software, try using the find command:

snap find programname

For example:

snap find telegram

This prints a list of all installable snap packages with the keyword “telegram” in it. Look through this list, and figure out what package to install. Then, use the install command to make it happen.

sudo snap install telegram-latest

This will download the latest version of the snap from the store, and install it to the system, and then mount the snap container so that the user can access the software inside of it. To view where the snap is mounted, run the lsblk command. This is because the software is a mounted volume and no different for the system from any other mounted hard drive, or device.

Remove any installed snap package from the system with the remove command.

For example:

sudo snap remove telegram-latest

Forget the name of a snap you wish to remove? Try this:

snap list

The list command will print out a list of all installed snaps. From here, take note of the name of the snap, then remove it from the system with the remove command above.

Note: Find other commands not discussed in this tutorial by using snap --help

Updating Snaps

Like any software, snaps have to update. The snap daemon manages every snap container on the system. As a result, snap packages will not update with conventional means. To update installed snap packages on the system, use the refresh command. The last crucial command for using snaps is the refresh command.

sudo snap refresh

Conclusion

Snap packages have the potential to replace ways we install and use software on Linux, by making it easier to distribute. Instead of software developers having to create several different packages, binaries and delivery methods to accomplish the same task, they’ll just create a single snap container. Self contained with libraries, executable code, and other important files that users can easily install with a single command.

Snaps aren’t perfect. Some new Linux users will have issues using them. This is because installing apps will only work with the command line. We can only hope that as snap packages get more and more popular, the people at Ubuntu will work on a nice user interface to install and use snaps. Till then, the command line will have to do.

5 Comments

  1. How is a package install tool that requires me to look up additional instructions to make something like NMAP work, as out of the box it lacks the required network access to do it’s job, a good thing?

    Additionally, once you install a Snap, if you remove it afterwards, it somehow caches a reference to it, so the installed APT version cannot be found!

    Snap should be discontinued, and I for one hope that Canonical starts to realize that soon!

  2. Why have all snap apps an empty white icon showing on the taskbar, whereas standard applications have a proper colored icon identifing them as being chrom, spotify, postman, whatever?

  3. If I understand it correctly, in the snap are all libraries, necessary for running each software, bundled in. So if I (somehow) unpack the snap, can I get standalone, portable app?

  4. Snaps are ghastly things. Massive bloat for no gain. Trying to solve a problem that just doesn’t exist and making a mess in the mean time.

    1. Programs that took a second or two to load now take about 30 seconds.
    2. What was a small package to download and install is now multiple hundreds of megabytes.
    3. They add a layer of complexity that makes it harder to even run the things. It took me ages to find that to run an installed snap you have to laboriously type “snap run “.
    4. Packages just can’t expose any commands to the OS. That makes many things completely useless.
    5. Being a self-contained user-mounted filesystem / isn’t /. Packages can’t see my shared /data mount.

    It’s just complete junk and hopefully soon people will begin to realise it and they will die out like they should.

    • Finally, after reading like 10 articles about snaps I find the info how to actually use them in a comment!