Introduction to Flatpak
The universal packaging system from Fedora is popular among developers and desktop Linux users.
I have used Flatpak packages since I was introduced to them. The reason? They solve one of the core problems every Linux desktop user faces: managing packages on Linux.
Yes, I'm aware of the fact that there are default package managers such as apt on Debian-based distros, pacman on Arch and yum on RHEL-based distros. For the most part, these package managers do a great job (for the most part - I'm repeating again).
When you change your Linux distribution, you need to learn the new package manager along. Furthermore, managing dependencies between two packages might conflict and that's where the Flatpak comes in.
What is Flatpak?
Flatpak is a package management utility for Linux that allows developers to distribute applications in a sandboxed environment, isolated from the rest of the system.
Flatpak packages are portable and are designed to run across different Linux distributions, eliminating dependency issues that may occur with traditional package managers.
Another good part is that Flatpak packages come bundled with their own libraries and dependencies. So you don't have to worry about dependencies. This solves a huge problem as on a Linux system, different packages/services might require different versions of one package.
For example, if you're running GNOME and try to install a KDE application using the default package manager, you will find the dependency list is huge in size, and even bigger than the actual package. This can be solved using Flatpak.
Applications installed via Flatpak run in an isolated environment with limited access to system resources. This enhances security by preventing compromised apps from affecting the rest of the system.
Using Flatpak, you can install multiple versions of the same package. Sure, it requires some extra effort but it is doable.
What are the pros and cons of Flatpak?
Like any software solution, Flatpak comes with its own pros and cons. Here, I will be addressing the pros and cons of using Flatpak so you can decide whether Flatpak will be powering your system or not.
Pros of using Flatpak
- Runs on any Linux distribution (if you install Flatpak support on it).
- Often provides the most recent version of the package.
- Ability to install packages for individual users without affecting the whole system.
- Flatpak packages run in an isolated environment which enhances security by limiting access to system resources.
- Flatpak packages come bundled with all the necessary dependencies, avoiding conflicts with the system.
- Flatpak is decentralised which means it can be hosted and updated independently without relying on a single repository.
Cons of using Flatpak
- As the packages are bundled with all the dependencies, the size of the package is quite large compared to what you get with the default package manager.
- Flatpaks are isolated and are only given limited access to the system which often causes trouble. For example, by default, I can not send files located inside the root directory from Discord (Flatpak version) due to limited access.
- Many times, Flatpaks won't pick the system-wide theme. Sure, you can theme Flatpak but it requires additional steps.
- It only works when you have a desktop environment installed. This means you can not run Flatpak on the Ubuntu server.
Should you use Flatpak?
If you love using the most recent version of packages and want to install multiple versions of the same package without worrying about the dependency resolution, then Flatpak can be a great choice.
In fact, distros like Fedora silverblue, elementaryOS, Endless OS, etc. come pre-configured with flatpak packages.
Just one con and that's the filesize. In my opinion, it will only affect users with low-end specs so even if you have a moderately spaced computer, you should give it a try.
This section of Linux Handbook gives you the necessary resources to start using Flatpaks on your Linux system.