Fat-shaming Linux app stores blog home

Posted Monday, 18-Nov-2024 by Ingo Karkat

I have an ambivalent relationship with the Linux app stores. I do use both Snaps and Flatpak on my Ubuntu systems. The glory days of a single package manager are long gone, but with it we've gotten a much larger selection of free software. If apps provide an easier way to offer a runs anywhere on Linux experience for open source projects by simplifying the maintainer's packaging overhead, I'm all for it. Small tools don't have the community and adoption rates behind them to provide native packages for all major systems. And nobody wants to download source TAR archives from some FTP server, unpack and build via ./configure && make install, only to be completely left alone with the problem of updating those. It's exactly around software updates that I think the app stores still have room for improvement.

problem

!Your disk space is running low on /dev/sda1
Only 768 MB remaining.

My root partition regularly runs low on disk space. There are various reasons for that; building lots of Docker images is a common one on development systems, the IntelliJ Discord integration spamming the syslog with error messages a rather obscure and annoying one. An entirely unreasonable one is that app stores continually install updates without cleaning up old versions! Nobody needs all previous versions of an app, and in the (hopefully rare) case of a regression, one benefit of the modern app stores is that it's so easy to install (also older) packages. In fact, "classic" Linux package managers like apt-get had this solved (via version pinning) a long time ago! Heck, even a policy of keeping the previous version around (like modern Ubuntu versions do with Linux Kernel packages) sounds like a reasonable compromise between comfort and space requirements.

I just have seven Snap apps and two Flatpak app installed here (yet with (multiple versions of) core dependencies the respective package managers list 23 and 15 packages), so I'm just a modest user. One reason for using Linux is that it also runs pretty well on older and cheaper hardware. I still do manual partitioning into a root partition (as small as 64 GiB for non-dev notebooks) and a separate /home (recommended for different backup strategies). All of that looks pretty reasonable to me, so I wonder why I am forced to manually intervene regularly as old app versions gobble up disk space?!

purge commands

I probably wouldn't complain if there were a single command I could run that would get rid of old package version. Again, venerable apt-get autoremove shows how it should be done. But no, one has to search through several Stack Overflow posts around the topic, and then eventually roll one's own script, as it's not just one simple command, and apparently additional repairs should be done first or caches cleaned afterwards (mentioned in a plethora of answers or comments that were upvoted, and who has the time and interest to dive deeper into that topic and find out what's just cargo cult or outdated).

my solution

So here are my own purge scripts:

example purges

These rely on a generic withDiskUsageDelta command from my shell-tools project, giving immediate feedback about how effective the cleanup has been (and spurring me to write this in anger and dismay).

Here's one run from my (now decommissioned) old personal notebook when the available disk space dropped below 1 GiB:

$ snap-purge
canonical-livepatch (revision 278) removed
chromium (revision 2925) removed
chromium-ffmpeg (revision 55) removed
core (revision 16928) removed
core18 (revision 2823) removed
core20 (revision 2318) removed
core22 (revision 1439) removed
core24 (revision 423) removed
cups (revision 1052) removed
fx (revision 319) removed
gnome-42-2204 (revision 172) removed
gnome-46-2404 (revision 42) removed
mesa-2404 (revision 44) removed
newsboat (revision 7915) removed
snap-store (revision 959) removed
snapd (revision 21465) removed

Removed 16 old snaps.
Disk usage decreased by 1.9Gi (41.15%): 4.6Gi → 2.7Gi

And these are today's cleanups from my dev system; freeing up space of an entire DVD:

$ snap-purge
chromium (revision 2985) removed
chromium-ffmpeg (revision 58) removed
core18 (revision 2829) removed
core20 (revision 2379) removed
core22 (revision 1621) removed
core24 (revision 490) removed
cups (revision 1058) removed
gnome-46-2404 (revision 42) removed
goreleaser (revision 993) removed
jo (revision 278) removed
kubectl (revision 3419) removed
losslesscut (revision 132) removed
mesa-2404 (revision 44) removed
snap-store (revision 1113) removed
teams-for-linux (revision 708) removed

Removed 16 old snaps.
Disk usage decreased by 1.6Gi (35.80%): 4.3Gi → 2.8Gi
$ flatpak-purge
Working on the system installation at /var/lib/flatpak
Verifying flathub:runtime/org.gnome.gitlab.YaLTeR.VideoTrimmer.Locale/x86_64/stable…
[52 lines deleted]
Verifying flathub:runtime/org.freedesktop.Platform.GL.default/x86_64/23.08…
Verifying flathub:runtime/org.freedesktop.Platform/x86_64/23.08…
Pruning objects
Erasing .removed

        ID                                             Branch           Op
 1. [-] org.freedesktop.Platform.ffmpeg-full           23.08            r
 2. [-] org.gnome.Platform                             45               r
 3. [-] org.gnome.Platform.Locale                      45               r
 4. [-] org.freedesktop.Platform.openh264              2.2.0            r
 5. [-] org.gnome.Platform                             46               r
 6. [-] org.gnome.Platform.Locale                      46               r
 7. [-] org.freedesktop.Platform.GL.Debug.default      23.08            r
 8. [-] org.freedesktop.Platform.GL.Debug.default      23.08-extra      r
 9. [-] org.freedesktop.Platform.openh264              2.4.1            r

Uninstall complete.
Disk usage decreased by 2.8Gi (41.76%): 6.6Gi → 3.8Gi
	

It would be great if app store command would include such commands to clean up left-over packages manually, and provide a way to configure an automatic purge policy, with a good default trade-off between disk consumption and reliability and rollbacks.

Ingo Karkat, 18-Nov-2024

ingo's blog is licensed under Attribution-ShareAlike 4.0 International

blog comments powered by Disqus