How To Remove Unused Flatpak Runtimes To Free Up Disk Space

Flatpak logo

Flatpak doesn't automatically remove a runtime after the last application that depended on it was uninstalled. This may be an issue for some users because these runtimes can take a lot of disk space.

Flatpak applications depend on runtimes, a set of essential libraries and services like Dbus, GLib, Gtk3, PulseAudio and so on. Thanks to these runtimes, application authors can bundle the libraries specific to the application without having to worry about low-level dependencies.

Each runtime is used by multiple applications, keeping the applications small in size, but there's one problem. After you uninstall all the application that depend on a particular runtime, the runtime itself is not removed. And that can be a problem because these runtimes can be very large - for example:

org.kde.Platform/x86_64/5.11    flathub 02ede84d3591 - 1.4 GB system,runtime
org.kde.Platform/x86_64/5.12    flathub d3e20330f263 - 1.3 GB system,runtime
org.gnome.Platform/x86_64/3.26  flathub d01b14e467c2 - 1.3 GB system,runtime
org.gnome.Platform/x86_64/3.28  flathub 6d1d0ebbd724 - 1.3 GB system,runtime

While Flatpak doesn't auto remove unused runtimes, there is a way to remove them, similar to apt autoremove or dnf / yum autoremove:

flatpak uninstall --unused

This command should list all unused Flatpak runtimes, and offer to uninstall them from your system.

Example:

$ flatpak uninstall --unused
Uninstalling from system:
org.freedesktop.Platform.GL32.nvidia-410-73/x86_64/1.4
org.freedesktop.Platform.GL32.nvidia-410-78/x86_64/1.4
org.freedesktop.Platform.GL32.nvidia-415-18/x86_64/1.4
org.gnome.Platform/x86_64/3.24
org.gnome.Platform.Locale/x86_64/3.24
org.kde.Platform/x86_64/5.9
org.kde.Platform.Locale/x86_64/5.9
Is this ok [y/n]: y
Uninstalling: org.freedesktop.Platform.GL32.nvidia-410-73/x86_64/1.4
Uninstalling: org.freedesktop.Platform.GL32.nvidia-410-78/x86_64/1.4
Uninstalling: org.freedesktop.Platform.GL32.nvidia-415-18/x86_64/1.4
Uninstalling: org.gnome.Platform/x86_64/3.24
Uninstalling: org.gnome.Platform.Locale/x86_64/3.24
Uninstalling: org.kde.Platform/x86_64/5.9
Uninstalling: org.kde.Platform.Locale/x86_64/5.9

Also see: How To Remove Old Snap Versions To Free Up Disk Space

There's no need to append --user to this command if you have installed Flatpak applications for your user only. The flatpak uninstall --unused command removes both system and user runtimes that are no longer needed.

The option to remove unused runtimes was introduced with Flatpak 0.11.8, released back in June 2018, so you need this version or newer to use it.

The Flatpak image used in this article is from https://flatpak.org/

Flatpak articles you may like: