Skip to main content

Flatpak Explained: Apps That Run on Every Linux Distribution

Flatpak lets you install desktop apps on Linux in a way that works the same on almost every distribution. Each app brings the libraries it needs and runs in a sandbox, apart from the rest of the system. Flathub is the main app store for Flatpak apps.

What it means

Most Linux apps come from the distribution itself: the version of Linux that you use. Ubuntu, Fedora and Arch Linux each package the same apps on their own. So one app can look different, or be an older version, depending on the system. App makers also have to deal with many different systems.

Flatpak takes another approach: one package that works everywhere. Picture a camping kit with its own tent, stove and water. You can set it up in any field, and you need nothing from the farmer. A Flatpak app carries what it needs in the same way.

Each app also runs in a sandbox. It works like a separate room. The app cannot look into the rest of your house unless you open a door for it, so a bad or broken app has a harder time harming your files.

You may already have it. Fedora, Linux Mint and Pop!_OS are among the many distributions that include Flatpak, and the software center often uses it without you noticing.

Back to top

How to use it

Start by checking whether Flatpak is on your system:

flatpak --version

This shows which version of Flatpak you have.

If Flatpak is missing, install it with your package manager. On Debian and Ubuntu:

sudo apt install flatpak

This installs Flatpak from the packages of your distribution.

Next, add Flathub as a source of apps:

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

This tells Flatpak where to find the Flathub apps.

Log out and log in again so that new apps show up in your menu. After that, you can search for apps and install them. Each app has its own ID. The VLC media player, for example, uses org.videolan.VLC:

flatpak search vlc
flatpak install flathub org.videolan.VLC
flatpak run org.videolan.VLC

These three commands search for VLC, install it from Flathub and start it.

For daily use, these commands help:

  • flatpak list --app shows the apps you installed.
  • flatpak update updates all apps and runtimes.
  • flatpak uninstall org.videolan.VLC removes an app.
  • flatpak uninstall --unused removes runtimes that no app needs anymore.
Back to top

How it works

A Flatpak app does not use the libraries of your system. Instead, it relies on a runtime: a shared set of base libraries, such as the GNOME, KDE or Freedesktop runtime. Many apps share one runtime, so you download it only once. The app package then holds only what the runtime does not provide.

Flatpak stores apps and runtimes with OSTree, which works a bit like Git for files. Identical files exist only once, and an update downloads only the changes. Apps installed for all users live in /var/lib/flatpak. Apps installed with --user go to ~/.local/share/flatpak.

bubblewrap and Linux namespaces form the sandbox. By default, an app cannot see your home folder or other apps. Each app declares the permissions it needs, such as network access or access to the Downloads folder. You can view these permissions and change them:

flatpak info --show-permissions org.videolan.VLC
flatpak override --user --nofilesystem=home org.videolan.VLC

The first command lists the permissions of VLC, and the second removes its access to your home folder.

Portals reduce how much access many apps need. To open a file, the app asks a portal. The portal shows the normal file dialog outside the sandbox. The app then gets access only to the file that you picked.

There is one pitfall. A sandbox is only as strict as its permissions, so an app with access to your whole home folder can read all of your files. The Flathub website shows the permissions of each app before you install it. Check that list first, and use flatpak override to remove access that an app does not need.

Back to top

Sources

Back to top
The welovelinux penguin

The byline of welovelinux news articles. AI helps us write the first draft, and a human editor, Peter Martin, checks every article against its sources before it is published.

Frequently asked questions

Flathub is the main app store for Flatpak apps. To use it, you add it as a source with the flatpak remote-add command. After that, you can search for apps and install them in the terminal, or often through the software center of your distribution.

Many distributions, such as Fedora, Linux Mint and Pop!_OS, already include Flatpak. To check, run flatpak --version in a terminal. If it is not installed, install it with your package manager, for example with sudo apt install flatpak on Debian and Ubuntu.

A Flatpak app uses a runtime instead: a shared set of base libraries, such as the GNOME, KDE or Freedesktop runtime. Many apps share one runtime, so it is downloaded only once. This is why the same app works the same way on almost every distribution.

Not always. The sandbox is only as strict as the permissions of the app. An app with access to your whole home folder can read all of your files. The Flathub website shows the permissions of each app, and flatpak info --show-permissions shows them on your system.

Run flatpak uninstall --unused. It removes runtimes that no app needs anymore. To remove an app itself, use flatpak uninstall with the ID of the app, for example flatpak uninstall org.videolan.VLC.