sodcalculator

10 Tech How-To

Flatpak Install & Use Guide for Linux

Guide 10-20780 · Updated · Step by step

Flatpak is a cross-distribution package manager that lets you install and run sandboxed applications on virtually any Linux distribution. You install it with a single command (e.g., sudo apt install flatpak on Debian/Ubuntu), add a repository like Flathub, and then use flatpak install and flatpak run to manage apps. This article explains how Flatpak works, how to install and use it, and how it compares to other packaging formats.

What Is Flatpak and Why Was It Created?

Flatpak is a framework for distributing desktop applications on Linux. It was designed to solve a long-standing problem: Linux has many distributions (Ubuntu, Fedora, Arch, etc.), each with its own system libraries and package manager. Traditionally, an app packaged for one distribution might not run on another, and even within a single distribution, an app might break when system libraries are updated.

Flatpak solves this by bundling the application with all the libraries it needs, in a sandboxed environment. The app runs in an isolated container that includes its own runtime (a base set of libraries) and dependencies. This means the same Flatpak package works on any Linux distribution that supports Flatpak, regardless of the underlying system.

The project was started by Alex Larsson of Red Hat in 2014 and has since become one of the most widely adopted cross-distro packaging formats, alongside Snap and AppImage. Flathub is the largest public repository of Flatpak apps, hosting thousands of applications.

How Flatpak Works: Runtimes, Sandboxes, and Portals

To understand Flatpak, you need to know three concepts: runtimes, sandboxes, and portals.

  • Runtimes are the base libraries that apps use. For example, the org.freedesktop.Platform runtime provides common libraries like GTK, while org.kde.Platform provides Qt. Each runtime has a version (e.g., 23.08) and includes a matching SDK for development. Apps depend on a specific runtime, and Flatpak downloads it automatically if it isn’t already installed.
  • Sandboxing is the security model. Each Flatpak app runs in a container with restricted access to the host system. By default, the app can only see its own files and a few system directories. It cannot access your home folder, network, or hardware (like webcam) unless you grant permissions.
  • Portals are interfaces that allow apps to request access to system resources without having direct permissions. For example, when an app wants to open a file, it uses the file chooser portal, which shows a system dialog. The user picks the file, and the app gets access only to that file, not the whole filesystem. This is more secure than granting blanket permissions.

Permissions are managed per-app and can be adjusted with tools like flatpak override or the graphical app Flatseal. For instance, to give an app access to your Pictures folder, you would run:

flatpak override --user --filesystem=~/Pictures com.example.App

Installing Flatpak on Your Distribution

Most distributions have Flatpak in their official repositories. Here are the commands for common ones:

  • Debian/Ubuntu: sudo apt install flatpak
  • Fedora: sudo dnf install flatpak
  • Arch Linux: sudo pacman -S flatpak
  • openSUSE: sudo zypper install flatpak
  • Linux Mint: often preinstalled; if not, use sudo apt install flatpak

After installing the flatpak package, you should add the Flathub repository, which is the main source of apps. On most systems, you can enable it with:

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

Then reboot or log out and back in so that the Flatpak environment is fully initialized. Some distributions (like Fedora) have Flathub pre-enabled; you can check with flatpak remotes.

Installing and Running Your First Flatpak App

Once Flatpak is installed and Flathub is added, you can search for apps using flatpak search. For example:

flatpak search spotify

This returns a list of matching apps with their application IDs (e.g., com.spotify.Client). To install, use:

flatpak install flathub com.spotify.Client

Flatpak will download the app and its runtime (if needed). The runtime is shared across apps, so installing multiple apps that use the same runtime won’t duplicate the download.

To run the app, you can either click its icon in your application menu (it appears automatically) or use the command line:

flatpak run com.spotify.Client

To update all installed Flatpaks, run flatpak update. To remove an app, use flatpak uninstall com.spotify.Client. You can also list installed apps with flatpak list.

How to Choose: Flatpak vs. Snap vs. AppImage vs. Native Packages

Linux users often wonder which packaging format to use. Here’s a quick comparison:

  • Native packages (deb, rpm) are optimized for your distribution, integrate best with system settings, and use less disk space. But they can be outdated and may not be available for all apps.
  • Flatpak offers a consistent experience across distributions, sandboxing for security, and automatic updates via Flathub. The downsides are larger download sizes (due to runtimes) and occasional permission quirks.
  • Snap is similar to Flatpak but developed by Canonical. It’s preinstalled on Ubuntu, but its backend (the Snap Store) is proprietary. Snaps also have a reputation for slower startup times.
  • AppImage is a single-file executable that doesn’t require installation. It’s portable and simple, but it doesn’t integrate with the system (no automatic updates, no sandboxing by default).

In general, if you want the latest version of an app and value security, Flatpak is a great choice. If you’re on Ubuntu and want minimal hassle, Snap might be easier. If you just want to run a portable app without installing anything, AppImage works well.

Common Problems and How to Fix Them

Flatpak is generally reliable, but you might encounter a few issues:

  • App doesn’t see your files: By default, Flatpak apps have limited filesystem access. You can grant access to a specific folder using flatpak override --user --filesystem=~/Documents com.example.App. To grant access to the whole home folder, use --filesystem=home (not recommended for security).
  • App doesn’t show in the menu: Sometimes the desktop file isn’t picked up. Try logging out and back in, or run update-desktop-database if you’re on a system that uses it.
  • Fonts look wrong: Flatpak apps may not see system fonts. Install the org.freedesktop.Platform.GL.default runtime or use Flatseal to add font permissions.
  • Slow startup: The first launch after an update may be slow because the runtime is being prepared. Subsequent launches are faster.
  • No internet access: Some apps need network permission. Use flatpak override --user --socket=network com.example.App to enable it.

If you run into a problem, the best resource is the Flathub discussion page for the app or the Flatpak documentation.

Safety and Security Considerations

Flatpak’s sandboxing is a major security benefit, but it’s not absolute. The sandbox can be bypassed if the app has certain permissions (e.g., --socket=x11 can allow keylogging, and --filesystem=home gives full access to your data). Always review permissions before installing an app, especially from third-party repositories. Stick to Flathub, which has a review process, and use Flatseal to audit and restrict permissions.

Also, note that Flatpak apps run with the same user privileges as your account. They can’t modify system files, but they can read your personal files if you grant access. The sandbox is not a replacement for good security practices; it’s an additional layer.

Frequently Asked Questions

How do I uninstall a Flatpak app completely?

Use flatpak uninstall com.example.App. To also remove unused runtimes and extensions, run flatpak uninstall --unused. This cleans up leftover dependencies that are no longer needed by any installed app.

Can I install Flatpak without sudo?

Yes, you can install apps per-user. The flatpak install command will automatically install to your user if you don’t have permission to install system-wide. However, adding a remote repository like Flathub system-wide requires sudo; you can add it per-user with flatpak remote-add --user flathub.

Why is my Flatpak app so large?

Flatpak apps bundle their dependencies, and the shared runtimes (like org.freedesktop.Platform) are around 500 MB. However, the runtime is shared across all Flatpak apps, so the first app you install is large, but subsequent apps that use the same runtime add only a few MB. You can check disk usage with flatpak list --columns=name,size.

How do I update a single Flatpak app?

Run flatpak update com.example.App to update just that app. To update all apps, use flatpak update without arguments. Flatpak also checks for updates automatically if your desktop environment supports it (e.g., GNOME Software or KDE Discover).

Can I run Flatpak apps on a server without a GUI?

Yes, but you need to install the flatpak package and the necessary runtimes. Since there’s no display, you’ll need to run the app with flatpak run in a headless environment, but most GUI apps won’t work without an X server or Wayland. Some command-line tools are available as Flatpaks, but it’s more common to use native packages on servers.

Is Flatpak safe to use?

Flatpak is generally safe because of its sandboxing. However, the security depends on the permissions granted. Always install from trusted sources like Flathub, and review permissions with Flatseal. The sandbox is not impenetrable, but it’s a significant improvement over traditional packages.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →