System-wide or per-user mode
Flatpak can operate in system-wide or per-user mode.
We set it up for the user in per-user mode for these reasons:
- In system-wide mode, many operations (install, add overrides, repository configuration) needs privileges (not necessarily setting an administration password).
- We install the Tor Browser pseudo-Flatpak as
a system Flatpak, and we prefer to not give the
amnesiauser too much latitude to mis-configure it.
Routing all Flatpak apps' network traffic over Tor
Tails transparently proxies all of amnesia's outgoing TCP Internet
traffic through tor, so since Tails' Flatpak-integration is set up
for per-user mode (described above) all Flatpak apps installed in the
ways we support will be torified. Notably this means that the stream
isolation is limited to IsolateDestAddr and IsolateDestPort for
all Flatpak apps.
Proxy-related environment variables
Our research has shown that standard
environment variables, such as HTTP_PROXY and SOCKS_SERVER, are
not honored by most Flatpak apps. However, if we find Flatpak apps
that support them and work better (e.g. improved stream isolation by
setting SOCKS username/password) we might consider adding overrides on
a per-app basis.
Repositories
We enable Flathub at build time by default, install the
up-to-date GPGKey in the image, and keep its key up-to-date in Persistent
Storage via on-activated-hooks.
Persistent Storage
Given the storage requirements, we only support managing Flatpak apps when the corresponding Persistent Storage feature is enabled.
That feature makes these directories persistent:
/.local/share/flatpak: repository data (configuration, keys, AppStream, icons...), runtime environments, the actual Flatpak apps, and overrides~/.var/app: user's application data (configuration, caches, etc.)~/.cache/gnome-software: icons and repository data cached by GNOME Software in its own format
Recommended apps
Our current list of "recommended apps" (terminology still being discussed) is:
- Signal, as the most useful messaging app
- Delta Chat, as an alternative end-to-end encrypted messaging that don't require a phone number (or even registering any account)
- Karere, as WhatsApp client for global accessibility
The research that led to this list of apps happened on #21549.
This list may change in the future, for example with #8573 or #21374.
Apps management user interface
We install GNOME Software with gnome-software-plugin-flatpak. We do not install gnome-software-plugin-deb: in Tails, GNOME Software is for Flatpak apps, while Debian packages are managed in other ways (APT on the command line, Synaptic as long as we ship it).
GNOME Software uses AppStream to get the list of apps available on Flathub: "AppStream is a metadata specification enabling software to provide rich, machine-readable information (screenshots, descriptions, versions) for app stores, including Flathub".
GNOME Software startup and update schedule
GNOME Software follows an update schedule by checking if certain
conditions are met on its startup and every hour following that, and
if met proceeds to fetch updates. The main condition is that it will
only fetch updates if the last attempt for that was done another
calendar day. It implements that by comparing the current time with a
timestamp (org.gnome.software.check-timestamp GSetting) that was set
last time it fetched updates (if not set it will also proceed). To
benefit from this scheduling we make this timestamp (and GNOME
Software's other settings) persistent as part of the Flatpak feature:
- config/chroot local-includes/usr/lib/systemd/user/gnome-software.service.d/persist-dconf-state.conf
- [[!tails_git_web config/chroot_local-includes/usr/local/lib/tails-persist-gnome-software-dconf-state]]
A wrapper for GNOME Software prevents it from starting if Tor isn't bootstrapped, informing users of this requirement. The reason for this is that GNOME Software updates the timestamp mentioned above even if started before Tor has bootstrapped so fetching upgrades will fail, and as a result all update checks fail for the rest of the day, so updates would only be fetched if the session extend far into the next day when the update check can succeed again. GNOME Software has a network availability check that will prevent the timestamp from being updated if there's no network, which prevents this issue in most normal cases, but not ours.
The service that starts GNOME Software is scheduled to start after Tor has bootstrapped:
XDG autostart is disabled, and DBusActivatable is dropped from the
Desktop file to ensure that it executes the wrapper:
Localization
Flatpak Apps are localized in three different ways (or not at all):
- All available localization is part of the base Flatpak app
(e.g.
org.signal.Signal) - Localization is handled in a non-standard way, e.g. downloaded on
application start (e.g.
org.telegram.desktop) - The localization bits are split into a
.LocaleFlatpak extension that contains all locales, but is only partially installed; only the locale matching the system locale (or whatever was manually configured withflatpak config --set languages) is installed.
Tails doesn't do anything special here, so there is really nothing to say about 1 and 2. For 3 the only relevant thing to mention is about switching locales:
When a Flatpak app is initially installed its .Locale extension (if
it exists) is also installed, but only pulling the part of it that is
for the current system locale (as selected by the user at the Welcome
Screen). If a user restart Tails in a different locale the new parts
of the .Locale extension are pulled the next time Flatpak upgrades
are installed, which is according to GNOME Software's update schedule,
mentioned above. So new locales will not necessarily be pulled in
immediately after switching, it might take a few days.
Upgrades
GNOME Software automatically manages upgrades of Flatpak apps and runtimes in Tails.
Potentially problematic use cases
Not enough disk space to download or apply upgrades
GNOME Software warns about this when its GUI is open and one installs/upgrades apps from there, but not when it tries to automatically upgrade apps in the background.
- Not enough disk space to download AppStream
- Upstream issue: gnome-software/-/work items/3057 on GNOME GitLab
- Not enough disk space to download updates → background updates will silently
fail forever and GNOME Software incorrectly reports successful update
- Upstream issue about misleading notification: gnome-software/-/work items/3056 on GNOME GitLab
- Not enough disk space to apply an already downloaded update → non-issue since flatpak continuously unpacks the downloaded objects while downloading
For all these cases, Tails mitigations:
Timing
Someone using Tails only between midnight to 6:00 UTC will never get updates
- Upstream issue: gnome-software/-/work items/3033 on GNOME GitLab
- Tails mitigation: #21924
Short sessions + low-bandwidth → large updates might never have time to finish
This is amplified by the fact partially downloaded data is not reused across boots.
- Upstream issues:
- Tails mitigation: #21924
Infrequent sessions, e.g. starting Tails every N months
This can imply the user is always using Flatpak apps that are N months old, and may not be aware of it.
- Tails mitigation: #21924
Shutdown while the update is being downloaded or installed
This can potentially cause two kinds of problems:
- ostree corruption: see the dedicated section
- Delays upgrade (partially downloaded data is not reused across boots)
- Upstream issue: https://github.com/flatpak/flatpak/issues/7006
- Tails mitigation: #21924
ostree corruption blocks automatic upgrades
Flatpak and ostree are designed to be resilient to interruptions when
installing/updating. In rare cases when data corruption happens, it can be fixed
with flatpak --user repair, which is a slow and somewhat risky operation, so
we can't run it "just in case".
Tails mitigation: #21924
Connection
Background download eats the user's data quota, especially on metered connection
This won't happen: GNOME Software won't download upgrades on a metered connection.
Note: use nmcli -f GENERAL.DEVICE,GENERAL.METERED dev show to check whether
NetworkManager thinks a given connection is metered. In the settings
for a given connection, the Metered connection checkbox
can be in non-checked state even when the backend knows a connection is metered
(and GNOME Software will therefore be aware as well), which can be confusing.
Upgrades downloading in the background impact user's network activities
- Upstream issue: gnome-software/-/work items/1038#note 2946490 on GNOME GitLab
- Tails mitigations we've considered: #21923
Always using a metered connection means no updates ever
GNOME Software will notify the user about it.
Time syncing
- Time is correct enough to bootstrap Tor but not enough for Flathub HTTPS: won't happen since the Tor consensus has a much shorter TTL than Flathub's TLS certificate.
- Mismatch between system time when a timestamp was stored during a previous Tails session vs. system time when a timestamp is read: we only persist GNOME Software timestamps after tor has bootstrapped, so at worst time can only be off by a few hours, which won't cause any issues.
- Clock changing while GNOME Software or Flatpak are doing stuff: we prevent GNOME Software from starting before Tor has bootstrapped, so we know the time can only be at most 3 hours wrong, delaying an update check by up to 1 hour, which is OK.
Other
Not enough RAM available to download or apply upgrades
We could not trigger any problem in low-memory situations so it seems this is handled well already.
Miscellaneous GNOME Software UX issues related to upgrades
Related pages
See also: