Rolling Back a Broken Flatpak Update on a Production Server
Flatpak is great for sandboxed desktop apps, but on a production box you’re still dealing with real‑world workloads. A bad runtime bump can bring an entire workflow to a halt or expose a vulnerability if the new runtime regresses. The silver lining? Flatpak keeps a full history of every branch you’ve ever installed, so you can undo a bad update without touching other apps.
Below is a practical, coffee‑talk style walk‑through: how to spot the problem, roll back the offending runtime or app, and confirm that the system stays secure and stable.
1. Detect the Problem
A broken update shows up in one of three ways:
| Symptom | Likely Cause |
|---|---|
| App refuses to launch or crashes immediately | Runtime mismatch or missing dependency |
| Services that use Flatpak apps hang or die | Runtime update broke a shared library |
| Security errors (SELinux denials, etc.) | New runtime introduced a policy change |
Quick check
flatpak info --show-runtime <app-id>
If the runtime version no longer matches the one the app was built against, you’ve probably hit a regression.
2. List Available Branches
Flatpak stores every branch that’s ever been installed. Refresh the metadata and list them:
flatpak update --appstream
flatpak list --app --columns=application,branch,version
For a runtime:
flatpak list --runtime --columns=application,branch,version
You’ll see output like:
org.mozilla.Firefox stable 115.0
org.mozilla.Firefox beta 116.0
org.mozilla.Firefox stable 114.0
The older branch is the one you want to roll back to.
3. Pin the Desired Branch
To keep Flatpak from auto‑updating the runtime or app, pin the branch:
flatpak mask org.mozilla.Firefox stable
Now Flatpak will hold the stable branch at its current version until you unmask it.
4. Roll Back the Runtime
Assume the problematic runtime is org.freedesktop.Platform. First, pick the exact version you want:
flatpak list --runtime --columns=application,branch,version | grep org.freedesktop.Platform
Suppose you need 20.08.3. Install that specific branch:
flatpak install --reinstall --arch=x86_64 \
org.freedesktop.Platform//20.08.3
The --reinstall flag forces a fresh install even if the branch is already present, ensuring the files are replaced.
Tip: If the runtime is shared by many apps, you might have to reinstall each dependent app so they link against the older runtime:
flatpak update --appstream
flatpak update --commit=20.08.3 org.mozilla.Firefox
5. Verify the Rollback
Run the application or service again. If it starts normally, the rollback succeeded. Double‑check the runtime:
flatpak info --show-runtime org.mozilla.Firefox
It should now report 20.08.3.
6. Harden the Environment
A rollback is a band‑aid. To prevent future regressions:
Mirror the official Flatpak repo
Keep a copy on your network and pin the repository. You control when new branches go live.Enable auto‑updates only for critical security branches
flatpak update --appstream --no-updateThen manually trigger updates for security‑critical runtimes.
Audit runtime changes
Compare the new runtime’s changelog with the old one. Look for added libraries or altered permissions that could affect SELinux or AppArmor.Keep a rollback plan
Store the SHA of the last known good runtime in a CM tool (Ansible, Salt, etc.) and automate the rollback if a new runtime fails health checks.
7. Troubleshooting Common Pitfalls
| Issue | Fix |
|---|---|
| Flatpak refuses to install older branch | Verify the branch exists in the remote. Use flatpak remote-info --log <remote> org.freedesktop.Platform to list all available commits. |
| Dependent apps still use the new runtime | After reinstalling the runtime, force each app to update to the pinned branch: flatpak update --commit=20.08.3 <app-id>. |
| SELinux denials after rollback | The older runtime may have different SELinux contexts. Run audit2allow -w -a to see denials and create a module if needed. |
| App fails to start due to missing extensions | Some runtimes ship optional extensions. Reinstall them: flatpak install --reinstall org.freedesktop.Platform.Extension//20.08.3. |
8. Real‑World Example: Rolling Back org.freedesktop.Platform
# 1. Check current runtime
flatpak info --show-runtime org.mozilla.Firefox
# → 20.09.1
# 2. List all available versions
flatpak remote-info --log flathub org.freedesktop.Platform
# 3. Install the last stable release
flatpak install --reinstall --arch=x86_64 \
org.freedesktop.Platform//20.08.3
# 4. Pin the runtime
flatpak mask org.freedesktop.Platform 20.08.3
# 5. Reinstall dependent app
flatpak update --commit=20.08.3 org.mozilla.Firefox
# 6. Verify
flatpak info --show-runtime org.mozilla.Firefox
# → 20.08.3
After these steps, Firefox runs under the trusted runtime, and the server stays stable.
9. When to Consider Removing Flatpak
If your production server rarely runs GUI apps, you might as well uninstall Flatpak:
sudo dnf remove flatpak
That cuts out the risk of future regressions and shrinks the attack surface. But if you rely on Flatpak for tools like org.gnome.Boxes, keep it and enforce stricter update policies.
10. Summary of Trade‑offs
| Approach | Pros | Cons |
|---|---|---|
| Pinning a runtime | Predictable behavior, quick rollback | Manual updates needed for security patches |
| Using a local mirror | Full control over releases | Extra storage and sync overhead |
| Removing Flatpak | Zero runtime risk | Loss of sandboxed application convenience |
Pick the method that matches your security posture and operational constraints.