table of contents
- trixie 1.16.1-1
- testing 1.16.1-3+b1
- unstable 1.16.2-1
- experimental 1.17.2-1
| FLATPAK METADATA(5) | flatpak metadata | FLATPAK METADATA(5) |
NAME¶
flatpak-metadata - Information about an application or runtime
DESCRIPTION¶
Flatpak uses metadata files to describe applications and runtimes. The metadata file for a deployed application or runtime is placed in the toplevel deploy directory. For example, the metadata for the locally installed application org.gnome.Calculator is in ~/.local/share/flatpak/app/org.gnome.Calculator/current/active/metadata.
Most aspects of the metadata configuration can be overridden when launching applications, either temporarily via options of the flatpak run command, or permanently with the flatpak override command.
A metadata file describing the effective configuration is available inside the running sandbox at /.flatpak-info. For compatibility with older Flatpak versions, /run/user/$UID/flatpak-info is a symbolic link to the same file.
FILE FORMAT¶
The metadata file is using the same .ini file format that is used for systemd unit files or application .desktop files.
[Application] or [Runtime]¶
Metadata for applications starts with an [Application] group, metadata for runtimes with a [Runtime] group.
The following keys can be present in these groups:
name (string)
runtime (string)
sdk (string)
command (string)
required-flatpak (string list)
Flatpak after version 1.4.3 and 1.2.5 support multiple versions here. This can be useful if you need to support features that are backported to a previous stable series. For example if you want to use a feature added in 1.6.0 that was also backported to 1.4.4 you would use 1.6.0;1.4.4;. Note that older versions of flatpak will just use the first element in the list, so make that the largest version.
tags (string list)
[Context]¶
This group determines various system resources that may be shared with the application when it is run in a flatpak sandbox.
Conditional Permissions
Some permissions (such as sockets and devices) support conditional grants, where access is only provided when specific runtime conditions are met. This allows applications to adapt to different system capabilities and session types. Available since 1.17.
Conditional permissions use the syntax if:PERMISSION:CONDITION in the metadata file. For example, if:wayland:has-wayland grants Wayland socket access only when running in a Wayland session.
The following conditions are supported:
true
false
has-input-device
has-wayland
Conditions can be negated by prefixing with !. For example, if:x11:!has-wayland grants X11 socket access only when NOT running in a Wayland session.
Multiple conditional permissions can be specified for the same resource. If any condition matches, the permission is granted (OR logic). For example:
sockets=wayland;if:x11:!has-wayland;if:x11:false
For backward compatibility with older Flatpak versions, conditional permissions can be combined with unconditional grants:
sockets=x11;if:x11:!has-wayland;
Older Flatpak versions will grant X11 access unconditionally (seeing only x11), while newer versions recognize the conditional syntax and grant X11 access only when not in Wayland sessions.
To explicitly deny a permission that might be granted at a lower layer (such as from the runtime or a global override), prefix the permission name with !:
sockets=!x11;
This denial can be combined with conditional grants to remove unconditional access while allowing conditional access:
sockets=!x11;x11;if:x11:!has-wayland;
This denies unconditional X11 access, but allows X11 access conditionally when not running in a Wayland session. The seemingly contradictory !x11 and x11 ensures backward compatibility: older Flatpak versions see the final x11 grant, while newer versions understand the conditional logic.
All keys in this group (and the group itself) are optional.
The keys supported in this group are:
shared (list)
This option supports conditional permissions. See Conditional Permissions for details on how to share subsystem access conditionally based on runtime conditions.
sockets (list)
This option supports conditional permissions. See Conditional Permissions for details on how to grant socket access conditionally based on runtime conditions.
devices (list)
dri
input
usb
kvm
all
shm
This option supports conditional permissions. See Conditional Permissions for details on how to grant device access conditionally based on runtime conditions.
filesystems (list)
home
home/path
host
/dev is not shared: use devices=all; instead.
Parts of /sys are always shared. This option does not make additional files in /sys available.
Additionally, this keyword provides all of the same directories in /run/host as the host-os and host-etc keywords. If this keyword is used in conjunction with one of the host- keywords, whichever access level is higher (more permissive) will be used for the directories in /run/host: for example, host:rw;host-os:ro; is equivalent to host:rw;.
These other reserved directories are currently excluded: /app, /bin, /boot, /efi, /etc, /lib, /lib32, /lib64, /proc, /root, /run, /sbin, /tmp, /usr, /var.
Available since 0.3.
host-os
To avoid conflicting with the Flatpak runtime, these are mounted in the sandbox at /run/host/usr, /run/host/etc/ld.so.cache and so on.
Available since 1.7.
host-etc
To avoid conflicting with the Flatpak runtime, this is mounted in the sandbox at /run/host/etc.
Available since 1.7.
host-root
To avoid conflicting with the Flatpak runtime, this is mounted in the sandbox at /run/host/root.
This permission is only intended to be used as a last resort when there is no possible alternative with other filesystem permissions for applications that need the entire root filesystem of the host.
Please note that following symlinks under /run/host/root naively will result in a wrong path. For example, using realpath() is wrong. Instead, applications will have to implement some way of following symlinks in a way that behaves as if it were chroot'd into /run/host/root.
There are a few ways to do this. Modern kernels support the openat2()[1] call with RESOLVE_IN_ROOT. For a more portable solution with support for older kernels, see the implementation from the steam-runtime-tools[2] as an example.
Available since 1.17.
xdg-desktop, xdg-documents, xdg-download, xdg-music, xdg-pictures, xdg-public-share, xdg-videos, xdg-templates
xdg-desktop/path, xdg-documents/path, etc.
xdg-cache, xdg-config, xdg-data
xdg-cache/path, xdg-config/path, xdg-data/path
xdg-run/path
/path
~/path
~
One of the above followed by :ro
One of the above followed by :rw
One of the above followed by :create
persistent (list)
features (list)
devel
multiarch
bluetooth
canbus
per-app-dev-shm
A feature can be prefixed with ! to indicate the absence of that feature, for example !devel if development and debugging are not allowed.
This option supports conditional permissions. See Conditional Permissions for details on how to allow features based conditionally on runtime conditions.
unset-environment (list)
[Instance]¶
This group only appears in /.flatpak-info for a running app, and not in the metadata files written by application authors. It is filled in by Flatpak itself.
instance-id (string)
instance-path (string)
app-path (string)
Since 1.12.0, if flatpak run was run with the --app-path option, this key gives the absolute path of whatever files were mounted on /app, even if that differs from the app's normal app files.
If flatpak run was run with --app-path= (resulting in an empty directory being mounted on /app), the value is set to the empty string.
original-app-path (string)
If this key is missing, the app files are given by app-path.
app-commit (string)
app-extensions (list of strings)
branch (string)
arch (string)
flatpak-version (string)
runtime-path (string)
Since 1.12.0, if flatpak run was run with the --usr-path option, this key gives the absolute path of whatever files were mounted on /usr, even if that differs from the app's normal runtime files.
original-runtime-path (string)
If this key is missing, the runtime files are given by runtime-path.
runtime-commit (string)
runtime-extensions (list of strings)
extra-args (string)
sandbox (boolean)
build (boolean)
session-bus-proxy (boolean)
system-bus-proxy (boolean)
[Session Bus Policy]¶
If the sockets key is not allowing full access to the D-Bus session bus, then flatpak provides filtered access.
The default policy for the session bus only allows the application to own its own application ID, its subnames and its own application ID as a subname of org.mpris.MediaPlayer2. For instance if the app is called org.my.App, it can only own org.my.App, org.my.App.* and org.mpris.MediaPlayer2.org.my.App. It is only allowed to talk to names matching those patterns, plus the bus itself (org.freedesktop.DBus) and the portal APIs (bus names of the form org.freedesktop.portal.*).
Additionally the app is always allowed to reply to messages sent to it, and emit broadcast signals (but these will not reach other sandboxed apps unless they are allowed to talk to your app.
If the [Session Bus Policy] group is present, it provides policy for session bus access.
Each key in this group has the form of a D-Bus bus name or prefix thereof, for example org.gnome.SessionManager or org.freedesktop.portal.*.
The possible values for an entry are the following, in increasing order of access. Each value implies all the access from any lower values:
none
see
talk
own
[System Bus Policy]¶
If the sockets key is not allowing full access to the D-Bus system bus, then flatpak does not make the system bus available unless the [System Bus Policy] group is present and provides a policy for filtered access. Available since 0.2.
Entries in this group have the same form as for the [Session Bus Policy] group. However, the app has no permissions by default.
[Environment]¶
The [Environment] group specifies environment variables to set when running the application. Available since 0.3.
Entries in this group have the form VAR=VALUE where VAR is the name of an environment variable to set.
Note that environment variables can also be unset (removed from the environment) by listing them in the unset-environment entry of the [Context] group.
[Extension NAME]¶
Runtimes and applications can define extension points, which allow optional, additional runtimes to be mounted at a specified location inside the sandbox when they are present on the system. Typical uses for extension points include translations for applications, or debuginfo for sdks. The name of the extension point is specified as part of the group heading. Since 0.11.4, the name may optionally include a tag in the NAME in the name@tag ref syntax if you wish to use different configurations (eg, versions) of the same extension concurrently. The "tag" is effectively ignored, but is necessary in order to allow the same extension name to be specified more than once.
directory (string)
version (string)
versions (string)
add-ld-path (string)
merge-dirs (string)
download-if (string)
These are the supported conditions:
active-gl-driver
active-gtk-theme
have-intel-gpu
have-kernel-module-*
on-xdg-desktop-*
autoprune-unless (string)
enable-if (string)
subdirectory-suffix (string)
subdirectories (boolean)
no-autodownload (boolean)
locale-subset (boolean)
autodelete (boolean)
collection-id (string)
[ExtensionOf]¶
This optional group may be present if the runtime is an extension.
ref (string)
runtime (string)
priority (integer)
tag (string)
[Extra Data]¶
This optional group may be present if the runtime or application uses extra data that gets downloaded separately. The data in this group gets merged into the repository summary, with the xa.extra-data-sources key.
If multiple extra data sources are present, their uri, size and checksum keys are grouped together by using the same suffix. If only one extra data source is present, the suffix can be omitted.
NoRuntime (boolean)
uriX (string)
sizeX (integer)
checksumX (string)
[Policy SUBSYSTEM]¶
Subsystems can define their own policies to be placed in a group whose name has this form. Their values are treated as lists, in which items can have their meaning negated by prepending ! to the value. They are not otherwise parsed by Flatpak. Available since 0.6.13.
[USB Devices]¶
USB devices can be enumerable or hidden by the USB portal as specified by the keys in this group. The vendor and product ids are validated by Flatpak, but aren't otherwise used or parsed. This merely grant the permission to enumerate USB device for use by the portal. This does give access to the devices. Available since 1.15.11.
enumerable-devices (string list)
hidden-devices (string list)
EXAMPLE¶
[Application] name=org.gnome.Calculator runtime=org.gnome.Platform/x86_64/3.20 sdk=org.gnome.Sdk/x86_64/3.20 command=gnome-calculator [Context] shared=network;ipc; sockets=x11;wayland; filesystems=xdg-run/dconf;~/.config/dconf:ro; [Session Bus Policy] ca.desrt.dconf=talk [Environment] DCONF_USER_CONFIG_DIR=.config/dconf [USB Devices] enumerable-devices=0fd9:*; hidden-devices=0fd9:0063; [Extension org.gnome.Calculator.Locale] directory=share/runtime/locale subdirectories=true [Extension org.gnome.Calculator.Debug] directory=lib/debug
Example using conditional permissions to support fallback from Wayland to X11:
[Application] name=org.example.App runtime=org.gnome.Platform/x86_64/3.20 sdk=org.gnome.Sdk/x86_64/3.20 [Context] shared=network;ipc; sockets=wayland;x11;if:x11:!has-wayland;
In this example, the application will always have access to the Wayland socket if there the app runs in a Wayland session. The X11 socket only is available if the app does not run in a wayland session (!has-wayland).
SEE ALSO¶
NOTES¶
- 1.
- openat2()
- 2.
- steam-runtime-tools
- 3.
- freedesktop.org special directories
- 4.
- freedesktop.org Base Directory Specification
| flatpak |