Snaps are a new feature in Ubuntu that allow you to install and update software packages quickly and easily. Snaps are similar to app stores like the Apple App Store or Google Play, but they’re built into Ubuntu.
To use snaps, you first need to install the snapd tool. Once snapd is installed, you can use it to find and install snaps. To install a snap, you just type its name into the command line:
sudo snap install
What’s a Snap Package on Linux?
“Snap” refers to both the snap command and a snap installation file. A snap bundles an application and all its dependents into one compressed file. The dependents might be library files, web or database servers, or anything else an application must have to launch and run.
The upside to snaps is they make installations simpler because they avoid the heartache of dependency hell. This is what occurs when a new application can’t run either because a required resource isn’t available, it’s the wrong version, or its installation overwrites files required by existing applications so they can’t run.
You might expect a snap to be uncompressed and the files extracted at install time. However, it’s at run time that the snap file is mounted on a block loop device. This allows the file’s internal SquashFS file system to be accessed.
The application is executed in an encapsulated, ring-fenced way, so its files can’t interfere with those on your computer. You can even install multiple versions of the same application, and they won’t cross-pollinate or fight amongst themselves.
The downside is the installation files are bigger than the traditional Debian package manager (DEB) files. They also use more hard drive real estate. With snaps, every application that needs a particular resource installs its own copy. This isn’t the most efficient use of hard drive space. Although hard drives are getting bigger and cheaper, traditionalists still balk at the extravagance of each application running in its own mini-container. Launching applications is slower, too.
Snaps have also been criticized for not following the theme of the desktop and their automatic upgrades. Some people are also wary because snaps aren’t necessarily made by the authors of the software. Therefore, they don’t consider them to be 100 percent “official.”
So, with Focal Fossa, Canonical has replaced the Ubuntu Software application with a version that installs snaps by default. What does this mean to you?
RELATED: What’s New in Ubuntu 20.04 LTS “Focal Fossa”
The Ubuntu Software Center
We can use the df command to list the SquashFS file systems mounted on your computer. We’ll use the -t (type) option to restrict the output to the file systems we’re interested in:
We then use the snap list command to list the snaps that are installed:
There are two snaps related to the GNOME desktop, two related to core snap functionality, one for GTK themes, and one for the snap store. Of course, the snap-store application is also a snap.
Here’s the thing: if you run the snap-store command in a terminal window, the application launched is the Ubuntu Software.
Of course, you’d usually run the Ubuntu Software application by clicking its icon. We’re launching it from the command line to demonstrate that beneath the surface, it’s now the snap-store application:
The Ubuntu Software application looks just as you’d expect. You can search for all the same software you could previously.
Let’s search for and install the “sqlitebrowser” application. The results screen shows the details of the application and a screenshot. Select “Install” to install the software.
If you didn’t know, you wouldn’t suspect the changes beneath the hood. Scroll down, and you’ll see some new, snap-specific information.
The “Details” list provides the following information:
Channel: The channel from which the installation will pull the application. Version: The software version. License: The license type. Developer: The person who created the snap, or the people who wrote the application. Source: The source from which the snap will be downloaded (snapcraft. io is Canonical’s Snapcraft snap store). Download size: The size of the snap file.
The channel can be one of the following:
Stable: The default, which contains the most stable, dependable packages. Candidate: This channel is less stable, but very close to it because it contains release candidate level software. Beta: This channel is late-development-cycle quality, but not guaranteed to be stable. Edge: For early build testers and the inquisitive. You shouldn’t use this channel for anything of importance.
After the installation is complete, we can check the list of installed snaps again:
The new entry is listed at the bottom. Let’s launch the program:
Everything about the application works just fine, although the interface looks dated. The sculpted, pseudo-3D interface elements will remind you of the GUIs of yesteryear. This isn’t common across all snaps, but it’s striking in this example.
RELATED: How to Work with Snap Packages on Linux
Installation from the Command Line
Nothing’s changed when installing applications from the command line. You still have access to the snap command-line tool, so you can install and uninstall snaps within a terminal window. The apt-get installation command and apt, the apt-get wrapper, are still there, too.
Let’s install the same application from the command line. Because the version we installed above is a snap, they won’t affect each other in any way:
Let the installation complete. Press the Super key and type “sqlitebrowser.” After you type a few characters, you’ll see two versions of the program on your computer.
Fire them both up.
As you can see, we have two different versions installed and running at the same time.
The version at the back of the image is the one we installed from the command line, and the version in front is the one in the snap:
The apt-get version is version 3. 11. 2. The snap version is 3. 11. 99.
Despite appearances, the command-line version is the older one. Regardless, it’s self-evident the two versions coexist and run together just fine. So, snaps do what they’re supposed to with the ring-fencing of different versions of the same application.
Also, installing applications from the command line with apt or apt-get is the same as it always was, and isn’t affected by snaps at all.
Which Should You Use?
Do you even care in the slightest which type of application you’re using? If not, go with snaps.
If any of the following are deal-breakers (or several of them add up to one), steer clear of the Ubuntu Software application and install your applications the traditional way:
Snaps are slower to load. This will be more noticeable on old hardware. Snaps take up more hard disk space. Snaps are updated automatically. Snaps might not match your installed themes. Snaps are not always “official. ” They’re often built by well-intentioned volunteers.
If your computer is reasonably modern, the speed difference between launching a snap or a regular application won’t be massive. The biggest time penalty we noticed was during the installation. The snaps took a lot longer to download. Once the files were downloaded, the installation was fast enough. Downloading is a one-off task, though, so it’s not something you’ll have to deal with daily.
Even if you think snaps are the future, and you’re ready to wholeheartedly embrace them, you can’t go all-in with them. Some applications aren’t available in snap form. In those cases, you’ll still have to install them from the command line.
Plainly, Canonical is nailing its colors to the mast with this move. As far as Ubuntu’s developers are concerned, snaps are here to stay. As always, you can either use them, ignore them, or have a hybrid system that mixes and matches snaps and traditional DEB-based installations.