Swap snaps for Flatpaks with unsnap
Rework Needed
My test took around 10 minutes and provided detailed information about what was happening at all times. The flatpak list
command (Figure 6) can be used to determine which snaps were converted to Flatpak format. For snaps with a Flatpak equivalent, unsnap
converted these snaps cleanly, and all of the programs remained functional. The script left the remaining snaps and the infrastructure untouched. Some manual work would be required to completely oust snaps from the computer.
I then reinstalled Ubuntu 22.04, along with some snaps that I knew had corresponding Flatpaks available, including Gimp 2.99.10 Beta, Krita, Spotify, and KeePassXC. In the process, I also installed several additional runtime environments for Gnome and (because of Krita) KDE, as well as other infrastructure packages from Canonical. With this environment using the same procedure as before, I then tested whether unsnap
also removes the Snap infrastructure when it can convert all snaps to Flatpaks.
I loaded the script and ran it by typing ./unsnap auto
. This time, unsnap
first had to install Flatpak and connect to Flathub. After doing so, the call successfully replaced all manually installed snaps with Flatpaks. In addition, it successfully disabled the Firefox snap, which was already present during the install.
When checking via flatpak list
, I noticed one minor disadvantage to this method: All Flatpaks are system-wide and therefore accessible to all users. There is no option to limit the Flatpak to specific users.
Then I ran snap list
to see if there was anything left of the Snap infrastructure. Lo and behold, the snaps had been deleted, but the infrastructure was still there. Apparently, the script did not execute the last of the six helper scripts (99-remove-snapd
). I now did this manually by changing to the ~/unsnap/log2022...
directory and running the ./99-remove-snapd
command there. The script removes snapd
and takes away the parts of the infrastructure that the base does not need.
However, I discovered the Snap infrastructure is already deeply rooted in Ubuntu and that not everything can be removed even manually (Figure 7).
Manual
Even without unsnap
, the Snap infrastructure can be removed from the computer. To do this, first disable the corresponding systemd services (Listing 2, lines 1 to 3). Then use the command
Listing 2
Removing unsnap
01 $ sudo systemctl disable snapd.service 02 $ sudo systemctl disable snapd.socket 03 $ sudo systemctl disable snapd.seeded.service 04 [...] 05 $ sudo rm -rf /var/cache/snapd 06 $ sudo apt autoremove --purge snapd 07 $ rm -rf ~/snap
sudo snap remove PACKAGE
to delete everything that snap list
shows you item by item. Last but not least, remove the remnants (lines 5 to 7). Afterwards, the removed packages can be reinstalled manually as DEBs or Flatpaks.
Conclusions
On Ubuntu and its derivatives (if they use Snap), unsnap
lets you swap installed snaps directly for Flatpaks. To do this, an equivalent Flatpak must be available, which is very often the case with graphical applications. With a little manual work, the Snap infrastructure can also be removed.
However, the project warns on GitHub that the software is still at a pre-alpha stage. I attempted to get a statement from Alan Pope, but was unable to do so by the time this issue went to press. I know of many users who have successfully used unsnap
; and I did not experience any problems myself. However, to be on the safe side, I recommend using the manual removal option and then reinstalling the removed packages in your desired format.
Infos
- "Innovative Linux Package Managers" by Erik Bärwaldt, Linux Magazine, issue 265, December 2022, p. 72
- Snap Store: https://snapcraft.io/store
- Mint without Snap: https://linuxnews.de/2020/06/02/linux-mint-20-ohne-snapd/
- unsnap: https://github.com/popey/unsnap
- applist-csv: https://github.com/popey/unsnap/blob/main/applist.csv
« Previous 1 2
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.
News
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.