From Gentoo Wiki
Jump to:navigation Jump to:search

Flatpak is a package management framework aiming to provide support for sandboxed, distro-agnostic binary packages for Linux desktop applications.


USE flags

USE flags for sys-apps/flatpak Linux application sandboxing and distribution framework

doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
gtk Add support for x11-libs/gtk+ (The GIMP Toolkit)
introspection Add support for GObject based introspection
kde Add support for software made by KDE, a free software community
policykit Enable PolicyKit (polkit) authentication support
seccomp Enable seccomp (secure computing mode) to perform system call filtering at runtime to increase security of programs
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking


Chromium-based browsers suggest disabling suid USE-flag for sys-apps/bubblewrap for performance reasons.
Flatpak installation guide suggested to restart the system after installation. This might be no longer necessary.
root #emerge --ask sys-apps/flatpak

Add flathub repository

All operations with flatpak can be performed as user or as root, if performing as user --user flag can help if there are issues with permissions.
user $flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo



  • /var/lib/flatpak - global flatpak state (system-wide installed apps and repos)
  • ~/.local/share/flatpak - per-user flatpak state (locally installed apps and repos)
  • ~/.var/app/ - per application state (configuration files and cache)

Basic usage

To install an application, e.g. Thunderbird, run:

user $flatpak --user install org.mozilla.Thunderbird

To run the application use created .desktop file or run:

user $flatpak run org.mozilla.Thunderbird

To update installed applications and runtimes:

user $flatpak update


Flatpak documentiation offers a good guide about desktop integration and theming.


Flatpak applications don't follow the system's GTK theme by default. First find out what's the current GTK theme, e.g. Materia-dark-compact, and then install it for Flatpak applications to use. [1]

user $gsettings get org.gnome.desktop.interface gtk-theme
user $flatpak install flathub org.gtk.Gtk3theme.Materia-dark-compact

Desktop integration for Wayland

When using WMs such as Sway, installing xdg portals is needed for full integration. There are different backends available for this matter:

  • GTK backend: 'xdg-desktop-portal-gtk'
  • KDE backend 'xdg-desktop-portal-kde' (in development)
  • Wayland/wlroots backend: 'xdg-desktop-portal-wlr' (in development)


root #emerge --ask sys-apps/xdg-desktop-portal
root #emerge --ask sys-apps/xdg-desktop-portal-gtk
root #emerge --ask gui-libs/xdg-desktop-portal-wlr

Ensuring portals are running

Please note that sometimes these libraries aren't pulled automatically by the OS and need to be run by the user, for example they can be pulled in Sway configuration:

FILE ~/.config/sway/configRunning xdg portals
exec /usr/libexec/xdg-desktop-portal-gtk -r
exec /usr/libexec/xdg-desktop-portal-wlr -r
exec "sh -c 'sleep 5;exec /usr/libexec/xdg-desktop-portal -r'"


Fixing jagged fonts on Wayland

Some users report jagged fonts on Wayland. The workaround is to install gnome-settings-daemon.[2]

root #emerge --ask gnome-base/gnome-settings-daemon


There are different views on the security of Flatpak. The infamous "Flatkill" essay covers several reported problems, although some have noted it lacks some nuance and have responded here. Make up your own mind.

See also

  • Docker — a container virtualization environment
  • LXD — is a next generation system container manager.