I want to remove every piece of existing software/package on Ubuntu related to snap and replace with flatpak.
How to completely remove snap in Ubuntu 19.04 and replace with flatpak without crashing or messing my existing system?
I want to remove every piece of existing software/package on Ubuntu related to snap and replace with flatpak.
How to completely remove snap in Ubuntu 19.04 and replace with flatpak without crashing or messing my existing system?
You can do this manually or with unsnap (more at the end).
Here is a nice article. Basically, snap installs only from a proprietary Canonical repository, you don't have the freedom to change that. Also, installs files to nonstandard locations.
On the other hand, flatpak has its detractors too:
Probably for people who just hope Canonical give up with Snap/snapcraft (at least for Desktop):
# Stop snapd services
sudo systemctl stop snapd && sudo systemctl disable snapd
Purge snapd
sudo apt purge -y snapd gnome-software-plugin-snap
Remove no longer needed folders
rm -rf ~/snap
sudo rm -rf /snap /var/snap /var/lib/snapd /var/cache/snapd /usr/lib/snapd
Prevent reinstall
sudo apt-mark hold snap snapd
cat <<EOF | sudo tee /etc/apt/preferences.d/snapd
Package: snapd
Pin: origin *
Pin-Priority: -1
EOF
If you are unsure about removing snap completely, you can at least reduce it at its minimum: remove snap-store, remove snap plugin from GNOME Software; and of course remove any snap also available as flatpak, like Ungoogled Chromium 1.
Worth to mention that "it's possible to remove all the snaps, and remove snapd... the desktop will function fine" (from a former snap developer; see unsnap below). gnome-...
snaps are just backends for GTK snap apps.
sudo snap remove snap-store # And anything you don't use of snap list
sudo apt purge gnome-software-plugin-snap
sudo apt install gnome-software-plugin-flatpak
Sources:
Is also possible to change command-not-found behavior to stop suggesting installing snap packages (Command 'something' not found, but can be installed with:), tuning advice
method from CommandNotFound
class on /usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py
(/usr/share/doc/command-not-found/README.md
is obsolete). Near the end (line 365) add snaps, mispell_snaps = ['','']
to force an empty result.
packages = self.get_packages(command)
snaps, mispell_snaps = self.get_snaps(command)
snaps, mispell_snaps = ['','']
logging.debug("got debs: %s snaps: %s" % (packages, snaps))
This applies to bash. On zsh /usr/lib/command-not-found
seeems to be used.
Install Flatpak on Ubuntu 18.10 or later (check here for older versions).
sudo apt install flatpak
Install the Software Flatpak plugin: The Flatpak plugin for the Software app makes it possible to install apps without needing the command line. To install, run:
sudo apt install gnome-software-plugin-flatpak
Add the Flathub repository: Flathub is the best place to get Flatpak apps. To enable it, run:
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Add --user
if you'll install per-user apps.
Restart your system (reboot
).
To adjust flatpak permissions check Flatseal (flatpak install flatseal
).
Using flatpak install/uninstall nameOfTheApp
usually is enough. It will run a fuzzy search and suggest alternatives.
flatpak run name
: Run an installed application.
flatpak install remote name
: Install an application from a remote source. --user
will install per-user. Examples:
$ flatpak install flathub org.gnome.gedit
$ flatpak --user install flathub org.gnome.gedit//3.30
$ flatpak --user install https://flathub.org/repo/appstream/org.gnome.gedit.flatpakref
flatpak list
: List all installed applications and runtimes.
flatpak update
: Update all installed applications and runtimes.
flatpak remove name
: Remove an installed application. --unused
also remove unused refs on the system.
flatpak info name
: Show information about an installed application.
Ex snap developer Alan Pope had developed unsnap (currently on pre-alpha status) to Quickly migrate from using snap packages to flatpaks:
Quickly and easily migrate from using
snap
for applications toflatpak
. unsnap runs as a two-stage process. unsnap itself generates the scripts to do the actual migration. This enables users to view and/or edit the scripts prior to execution to validate or tweak them.
pop-transition is a similar project.
pip
: A tool for installing and managing Python packages.sudo apt purge snapd gnome-software-plugin-snap
Thanks to doug. It feels so clean now, all snap removed.