Swap snaps for Flatpaks with unsnap
Package Exchange
![© Photo by Tamanna Rumee on Unsplash © Photo by Tamanna Rumee on Unsplash](/var/linux_magazin/storage/images/issues/2023/268/unsnap/photobytamannarumeeonunsplash_packages.png/817267-1-eng-US/PhotobyTamannaRumeeonUnsplash_Packages.png_medium.png)
© Photo by Tamanna Rumee on Unsplash
If you want to move away from Ubuntu's Snap package format, the unsnap script removes snaps from your computer and replaces them with Flatpaks where possible.
The Linux community, like any other community, is not particularly good at welcoming new things. Most people want to retain the status quo. In the words of the philosopher Voltaire, the better is the enemy of the good. Nothing is more dangerous than leaving the good for better things.
Systemd, the still controversial system and session manager, illustrates this concept. Other examples are the new package systems Flatpak, Snap, and AppImage, which Linux Magazine previously covered in December 2022 [1]. These package systems are by no means met with unanimous approval in the Linux community. In particular, the Snap format, which Canonical initially designed for cloud applications and the Internet of Things (IoT), but later ported for desktop applications, is experiencing opposition beyond the basic criticism of new package systems.
If you've become disillusioned with Snap, the unsnap
script can help you replace snaps with Flatpaks where available on Ubuntu and its deriviatives.
Bad Experiences
The Linux community is skeptical of any solo efforts by Canonical due to bad past experiences. The main criticisms leveled at Snap (Figure 1) are the Snap Store's proprietary back end [2] and the fact that Canonical is increasingly pushing the format in Ubuntu, with no official way to remove snaps.
![](/var/linux_magazin/storage/images/issues/2023/268/unsnap/figure-1/817270-1-eng-US/Figure-1_large.png)
The snap daemon (snapd
) is the defined tool for retrieving snaps and all associated metadata from Canonical's servers. In addition, snaps have functional drawbacks that the company has been slow to eliminate. Flatpak, on the other hand, was well received by proponents of alternative package systems. Flatpak is probably the choice of most users outside the Ubuntu environment. This could eventually lead to Canonical mothballing Snap again, as has often been the case in the past with in-house developments such as Ubuntu Touch or the Mir display manager.
This situation has led some distributions to reject or even block snaps. One prominent example is Linux Mint, based on Ubuntu LTS, whose developers decided as early as 2020 not to deliver snaps [3]. They also announced that Linux Mint, starting in version 20, would actively prevent the installation of the Snap framework via the graphical package manager, preventing snaps from automatically ending up on the user's system through the backdoor.
Laptop manufacturers System76 (Pop!_OS) and Tuxedo (Tuxedo OS 1) also avoid shipping snaps with their Ubuntu derivatives. Even Ubuntu users have not rallied behind Snap, as suggested by many guides that describe installing Firefox in Ubuntu as a DEB.
unsnap
Former Snap co-developer Alan Pope, who left Canonical in 2021 after 10 years with the company, has developed unsnap
[4], a script that replaces snaps with Flatpaks where available. The script, hosted on GitHub, has been tested by the developers for use on Ubuntu and all derivatives that offer snapd
and packages in the Snap format.
To test unsnap
on a freshly installed Ubuntu 22.04 LTS, I set up a few more packages from the Snap Store in addition to the existing snaps via the Ubuntu Software package manager and then listed them just to be sure (Figure 2). I then downloaded the unsnap
script from GitHub. To do this, I first had to install the git package and then run the command from Listing 1.
Listing 1
Installing unsnap
$ git clone https://github.com/popey/unsnap
Before getting into the nitty gritty, let's take a look at how the script works. Immediately after startup, unsnap
creates a log directory in which it generates six additional scripts tailored to the particular system (see Table 1). The applist.csv
[5] file is used to find Flatpaks that match the installed snaps.
Table 1
unsnap Subscripts
Script | Function |
---|---|
|
Runs the |
|
Installs the Flatpak package manager if not already done. |
|
Adds the Flathub repository to Flatpak if not enabled. |
|
Installs Flatpaks for each identified Snap package, if it exists. |
|
Removes snaps that have alternative Flatpaks. |
|
Removes |
Multiple Steps
To start the script, first change to the appropriate directory by typing cd unsnap
. The ./unsnap
command (Figure 3) first informs you that various checks will be run to determine if Flatpak is already installed and Flathub is included, as well as which snaps have Flatpak equivalents.
![](/var/linux_magazin/storage/images/issues/2023/268/unsnap/figure-3/817276-1-eng-US/Figure-3_large.png)
Next, unsnap creates
the helper scripts. If you have a reason not to run one of the helper scripts, you can launch these scripts manually one after the other. Otherwise, call ./unsnap auto
to automatically install the scripts (Figure 4).
![](/var/linux_magazin/storage/images/issues/2023/268/unsnap/figure-4/817279-1-eng-US/Figure-4_large.png)
On my lab system, I installed about 20 snaps, of which unsnap
was able to replace about half. However, I intentionally installed snaps such as the Canonical Juju and LXD tools, as well as the Mutt command-line email client, to test how the script responded (Figure 5). In general, the chances of finding a Flatpak counterpart for graphical apps are better, because Flatpak targets the desktop. Snap, on the other hand, also targets the server world.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.