One Command to Convert All your Snap Apps into Flatpak in Ubuntu

For those hate Snap but prefer Flatpak, there’s now a script to automatically remove all the snap apps installed on your system, and install them back as Flatpak in Debian and Ubuntu.

It’s Unsnap, a free and open-source script written by Alan Pope and some other contributors. The man was an employee of Canonical (the company behind Ubuntu), and one of the developers of Snap.

As you may know, Snap and Flatpak are universal Linux package format run in sandbox. They make possible to run newer apps (or app in multiple versions) in Linux without worrying about dependency issue. However, they take more disk spaces since run-time libraries also sandboxed, and so far have limitations to interact outside of sandbox.

Snap is powered by Canonical. The client and runtime are open-source while the backend is proprietary. Flatpak is completely open-source, and RedHat is behind the project. And, the open-source community seems to (IMO) prefer Flatpak is bit more.

Use Unsnap to Convert your Snap Apps to Flatpak

Unsnap does NOT rebuilt your Snap apps as Flatpak. It automate the process to remove Snap apps and install equivalent Flatpak apps back. Which, is useful for beginners and advanced users who want to save time for searching packages.

Supported Systems:

According to the script content, it so far supports: Debian, Ubuntu (and its official flavors), Linux Mint, Pop!_OS, Elementary OS, and Zorin OS.

Working Process

The script works in two mode: default and auto.

It by default detects your system status and snap apps, then generates following new scripts:

  • 00-backup – script to run snap save to save current data of snap apps.
  • 01-install-flatpak – script to install Flatpak daemon.
  • 02-enable-flathub – script to add Flathub repository.
  • 03-install-flatpaks – script to install equivalent Flatpak apps.
  • 04-remove-snaps – script to Remove all the Snap apps.
  • 99-remove-snapd – script to remove disable snap. Though it may be installed back via a system update.

It may skip 01/02 scripts if you already installed Flatpak daemon and added Flathub repository. And, the scripts are quite simply and easy to understand for those have basic Linux command and programming skills. Then, you can choose to manually run all or any of the scripts accordingly!

The auto mode will generate the scripts and run all of them automatically!

Limitations:

The scripts so far supports 219 applications. Advanced users can add more apps support by editing the ‘applist.csv’ config file.

It won’t remove unsupported and excluded Snap applications, though they will be gone after running 99-remove-snapd script either manually or automatically.

The script can save current data of all Snap applications. But there seems no way to import them in the equivalent Flatpak applications. And, there’s NO script to undo the changes!

Download Unsnap and Run the script

1. User can either download Unsnap from github page, or open terminal (press Ctrl+Alt+T in Ubuntu) and run command:

git clone https://github.com/popey/unsnap

Run sudo apt install git if git command not found.

2. After downloading the script, either

  • run cd unsnap to navigate to source folder and ./unsnap auto to do all the things AUTOMATICALLY in one command.
  • or run cd unsnap, then ./unsnap to generate the scripts for MANUAL use.

For manual mode, all the generated scripts are available in “log-202x-xxx” sub-folder.

Just run cd log-* command to navigate to that folder, then choose any script you want to run. For example, backup snap app data by ./00-backup.

As mentioned, there’s no script to undo the changes! You can safely remove the unsnap folder after all the jobs done!

Original Article