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
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.