Low disk space - how to clean out garbage?

It’s possible. Because to build flatpaks from source you will most likely development runtimes. And those take some space.
(I still remember with some irritation that one time I tried to be nice and build from source a flatpak application according to the developer preference, using gnome-builder, and in the end having 2GB of development runtimes to build from source a 27MB flatpak app)

Can you do: flatpak list to print all the flaptak applications and runtimes you have installed.

If you are not conformable in having a list of your applications listed here, then maybe you can DM the list to me, or redact applications but leave the runtimes and things related to gnome builder.

3 Likes

Thanks! By following your kind advice I executed: sudo journalctl --vacuum-time=10d. My journalctl file was over 900M and is now much smaller.

2 Likes
Namn                                               Program-ID                                                       Version                  Gren                   Installation
Markets                                            com.bitstower.Markets                                            0.5.4                    stable                 system
Tootle                                             com.github.bleakgrey.tootle                                      1.0.0                    stable                 system
Shortwave                                          de.haeckerfelix.Shortwave                                        3.0.0                    stable                 system
Spot                                               dev.alextren.Spot                                                0.3.1                    stable                 system
Freedesktop Platform                               org.freedesktop.Platform                                         21.08.16                 21.08                  system
Freedesktop Platform                               org.freedesktop.Platform                                         22.08.2.1                22.08                  system
Mesa                                               org.freedesktop.Platform.GL.default                              21.3.9                   21.08                  system
Mesa                                               org.freedesktop.Platform.GL.default                              mesa-22.1.7              22.08                  system
ffmpeg-full                                        org.freedesktop.Platform.ffmpeg-full                                                      21.08                  system
openh264                                           org.freedesktop.Platform.openh264                                2.1.0                    2.2.0                  system
Rust stable                                        org.freedesktop.Sdk.Extension.rust-stable                        1.63.0                   21.08                  system
Rust stable                                        org.freedesktop.Sdk.Extension.rust-stable                        1.64.0                   22.08                  system
GNOME Application Platform version 41              org.gnome.Platform                                                                        41                     system
GNOME Application Platform version 42              org.gnome.Platform                                                                        42                     system
Iotas                                              org.gnome.gitlab.cheywood.Iotas                                  0.1.4                    stable                 system
Adwaita theme                                      org.kde.KStyle.Adwaita                                                                    5.15-21.08             system
KDE Application Platform                           org.kde.Platform                                                                          5.15-21.08             system
QGnomePlatform                                     org.kde.PlatformTheme.QGnomePlatform                                                      5.15-21.08             system
QtSNI                                              org.kde.PlatformTheme.QtSNI                                                               5.15-21.08             system
QGnomePlatform-decoration                          org.kde.WaylandDecoration.QGnomePlatform-decoration                                       5.15-21.08             system
KeePassXC                                          org.keepassxc.KeePassXC                                          2.7.1                    stable                 system
LibreOffice                                        org.libreoffice.LibreOffice                                      7.4.2.3                  stable                 system
Telegram Desktop                                   org.telegram.desktop                                             4.2.4                    stable                 system
Telegram Desktop Webview Add-on                    org.telegram.desktop.webview                                     2.38.0                   stable                 system

Another view:

Namn                                                Installerad storlek
Markets                                             229,4 kB
Tootle                                              842,2 kB
Shortwave                                             9,5 MB
Spot                                                 14,7 MB
Freedesktop Platform                                541,0 MB
Freedesktop Platform                                548,9 MB
Mesa                                                290,2 MB
Mesa                                                285,8 MB
ffmpeg-full                                           8,5 MB
openh264                                            580,6 kB
Rust stable                                           1,4 GB
Rust stable                                           1,4 GB
GNOME Application Platform version 41               743,5 MB
GNOME Application Platform version 42               729,8 MB
Iotas                                                 2,8 MB
Adwaita theme                                        16,2 MB
KDE Application Platform                            824,8 MB
QGnomePlatform                                       19,4 MB
QtSNI                                                 3,3 MB
QGnomePlatform-decoration                            20,8 MB
KeePassXC                                            36,5 MB
LibreOffice                                         709,5 MB
Telegram Desktop                                    141,0 MB
Telegram Desktop Webview Add-on                      96,5 MB

This folder equals to 10GB: du -smh /var | sort -nr | head -15 or sudo du -sh /var/*.

purism@pureos:~$ sudo du -sh /var/* | sort -nr | head -15
172K	/var/backups
137M    /var/tmp
31M	    /var/cache
20M	    /var/log
20K	    /var/spool
9,3G	/var/lib
4,0K	/var/opt
4,0K	/var/mail
4,0K	/var/local
0	    /var/run
0	    /var/lock
purism@pureos:~$ flatpak list --app --columns=application,runtime
Program-ID                                        Exekvering
com.bitstower.Markets                             org.gnome.Platform/aarch64/41
com.github.bleakgrey.tootle                       org.gnome.Platform/aarch64/42
de.haeckerfelix.Shortwave                         org.gnome.Platform/aarch64/42
dev.alextren.Spot                                 org.gnome.Platform/aarch64/42
org.gnome.gitlab.cheywood.Iotas                   org.gnome.Platform/aarch64/42
org.keepassxc.KeePassXC                           org.kde.Platform/aarch64/5.15-21.08
org.libreoffice.LibreOffice                       org.freedesktop.Platform/aarch64/22.08
org.telegram.desktop                              org.freedesktop.Platform/aarch64/21.08
1 Like

So these are development runtimes, they can likely be removed.
About the app tootle, it is currently archived upstream. Meaning that, until development picks up again in upstream it will be stuck in the GNOME runtime version 42, this might be an issue when gnome apps start migrating to the 43 runtime.
You can also install it from apt with: apt install tootle the version in the deb repositories is not that different from the one on flathub.
maybe you can remove the flatpak version and install the apt version and then run again:
flatpak remove --unused

One of your flatpak applications from gnome ecosystem, com.bitstower.Markets has not yet updated to GNOME 42, which is why you have two runtimes of GNOME, one for 41 and another for 42:

GNOME Application Platform version 41              org.gnome.Platform                                                                        41                     system
GNOME Application Platform version 42              org.gnome.Platform                                                                        42

Removing com.bitstower.Markets and running flatpak remove --unused would possibly save you about 743,5 MB of space or a bit more. Of course what apps you use is your personal preference, not mine.

And because you have some Qt/KDE applications, you also have the KDE runtimes, which takes about 700MB of space, plus the apps on top

1 Like

Thanks, I uninstalled Rust stable. Another interesting folder to look at is my ~/.local/share/flatpak, which contain about 4GB of data. As you can see, there are a lot of dirs named 98c144a5445b8f382d86fb856f6457897102b790f1138b7028c741a3eedcb223 etc. Dont know if these are safe to remove too?

purism@pureos:~$ du -sm ~/.local/share/flatpak | sort -nr | head -15
4102	/home/purism/.local/share/flatpak
purism@pureos:~$ du -sm ~/.local/share/flatpak/* | sort -nr | head -15
4068	/home/purism/.local/share/flatpak/appstream
34	/home/purism/.local/share/flatpak/repo
1	/home/purism/.local/share/flatpak/runtime
1	/home/purism/.local/share/flatpak/db
purism@pureos:~$ du -sm ~/.local/share/flatpak/appstream/* | sort -nr | head -15
4058	/home/purism/.local/share/flatpak/appstream/flathub
11	/home/purism/.local/share/flatpak/appstream/gnome-nightly
purism@pureos:~$ du -sm ~/.local/share/flatpak/appstream/flathub/* | sort -nr | head -15
4058	/home/purism/.local/share/flatpak/appstream/flathub/aarch64
purism@pureos:~$ du -sm ~/.local/share/flatpak/appstream/flathub/aarch64/* | sort -nr | head -15
52	/home/purism/.local/share/flatpak/appstream/flathub/aarch64/07da4f798a47517df3993af291a0e0737e038d432556c61ea016f7f021b721c7
26	/home/purism/.local/share/flatpak/appstream/flathub/aarch64/6b0d6d50b4cfca2b105a4f212daa98ca63fb690478c175d1612e1a8a9ab519e5
8	/home/purism/.local/share/flatpak/appstream/flathub/aarch64/3ec74a0d99f8c5f482893d7545dde4f90dbeb4368c23cec7bccb1a79ce9a2d7d
6	/home/purism/.local/share/flatpak/appstream/flathub/aarch64/98c144a5445b8f382d86fb856f6457897102b790f1138b7028c741a3eedcb223
1	/home/purism/.local/share/flatpak/appstream/flathub/aarch64/active

I would not remove those

I currently have 2.1G and think that someone should help you to clean those.

That would be great! Here is some further input to help troubleshoot:

purism@pureos:~$ sudo du -sm /var/lib/* | sort -nr | head -15
6300	/var/lib/flatpak
68	/var/lib/dpkg
22	/var/lib/gdm3
17	/var/lib/app-info
5	/var/lib/aspell
3	/var/lib/upower
1	/var/lib/xml-core
1	/var/lib/xkb
1	/var/lib/xfonts
1	/var/lib/vim
1	/var/lib/usbutils
1	/var/lib/usb_modeswitch
1	/var/lib/unattended-upgrades
1	/var/lib/udisks2
1	/var/lib/ucf
purism@pureos:~$ sudo du -sm /var/lib/flatpak/* | sort -nr | head -15
3422	/var/lib/flatpak/appstream
2005	/var/lib/flatpak/repo
851	/var/lib/flatpak/app
23	/var/lib/flatpak/runtime
1	/var/lib/flatpak/exports

As in the ~/.local folder it is also flatpak overflowing the storage.

1 Like

I’m not sure at this moment how to help you. At least we know which folder is huge:

du /var/lib/flatpak --total --summarize --human-readable --one-file-system

The total is 6.2G, of which:

851M	/var/lib/flatpak/app
3,4G	/var/lib/flatpak/appstream
756K	/var/lib/flatpak/exports
2,0G	/var/lib/flatpak/repo
23M	/var/lib/flatpak/runtime
1 Like

I have there 52M (as not using it much). Anyway you are getting there (although I’m still not sure how to help you).

EDIT:

ls -l /var/lib/flatpak/runtime/org.gnome.Platform/aarch64/
ls -l /var/lib/flatpak/runtime/org.freedesktop.Platform/aarch64/

Please adjust accordingly, as up to your post #12:

du -sh /var/lib/flatpak/runtime/org.gnome.Platform/aarch64/42
du -sh /var/lib/flatpak/runtime/org.freedesktop.Platform/aarch64/21.08
du -sh /var/lib/flatpak/runtime/org.gnome.Platform/aarch64/42 /var/lib/flatpak/runtime/org.freedesktop.Platform/aarch64/21.08
flatpak uninstall --unused
du /var/lib/flatpak --total --summarize --human-readable --one-file-system
flatpak update

@tomoqv, above is explained here: https://blogs.gnome.org/alexl/2017/10/02/on-application-sizes-and-bloat-in-flatpak/ and here: https://blogs.gnome.org/mwleeds/2021/01/11/cleaning-up-unused-flatpak-runtimes/.

@Quarnero Thanks a lot for helping me! I will dig deeper into this and read the post you linked when I get the time.

1 Like

I have now uninstalled some more flatpak apps and managed to shrink
/var/lib/flatpak to 6.0GB but ~/.local/share/flatpak remains at 4.1GB which makes me believe that the latter contains a lot of stuff that could be removed. I am just not sure which folders/files that can be safely removed or what I risk if I just delete them all.

EDIT: I see now that I only managed to shrink /var/lib/flatpak from 6.2 to 6.0 GB, which is virtually nothing. How much space should a “normal” flatpak installation with a few apps occupy on the disk?

I have been considering uninstalling flatpak all together and then cleaning out all the flatpak folders and after that reinstalling the apps that I really want from flathub.

p.s. It seems I can’t edit the title of this post to reflect that this is about flatpak folders overflowing and eating up about half of the disk space on the device.

EDIT 2: Currently installed flatpak apps:

Namn                                                Installerad storlek
Markets                                             229,4 kB
Spot                                                 14,7 MB
Freedesktop Platform                                548,9 MB
Mesa                                                290,2 MB
Mesa                                                285,8 MB
openh264                                            580,6 kB
GNOME Application Platform version 41               743,5 MB
GNOME Application Platform version 42               729,8 MB
Iotas                                                 2,8 MB
LibreOffice                                         709,5 MB
1 Like

flatpak remote-info flathub org.gnome.Platform/aarch64/41
flatpak remote-info flathub org.gnome.Platform/aarch64/42
flatpak remote-info org.freedesktop.Platform/aarch64/21.08
flatpak remote-info org.freedesktop.Platform/aarch64/22.08
flatpak remote-info flathub org.kde.Platform/aarch64/5.15-21.08

No need to post any of above outputs here (those are of yours only). Above is not helping much either but we do move forward.

EDIT:
Check if there (while I’m not using LibreOffice on Librem 5):
ls -l /var/lib/flatpak/runtime/org.kde.Platform/aarch64/
ls -l /var/lib/flatpak/runtime/org.kde.Platform/aarch64/5.15-21.08
or
cd /var/lib/flatpak/runtime/org.kde.Platform/aarch64/
ls -la

Anyway please execute (adjust if above not correct):

du -sh /var/lib/flatpak/runtime/org.gnome.Platform/aarch64/41 /var/lib/flatpak/runtime/org.gnome.Platform/aarch64/42 /var/lib/flatpak/runtime/org.freedesktop.Platform/aarch64/21.08 /var/lib/flatpak/runtime/org.freedesktop.Platform/aarch64/22.08 /var/lib/flatpak/runtime/org.kde.Platform/aarch64/5.15-21.08

flatpak uninstall --unused

Check with: du -sh /var/lib/flatpak/runtime/org.gnome.Platform/aarch64/41 if probably gone away, as I hope. Check other related folders the same way.

Check size of: ls -l ~/.local/share/flatpak/repo/tmp/cache.

EDIT II:

On my phone ~/.local/share/flatpak is of size 60K, as checked with: du -sh ~/.local/share/flatpak.

I do not have related appstream folder on my Librem 5. Now I cannot confirm if it was there anyway (before procedure I recommended here to you, but still guess that appstream was there before).

EDIT: @joao.azevedo please go over (check) my advice here in this thread (your previous contribution and proof of my recent posts is important to us).

Consider keeping your journal clean permanently and automatically: https://source.puri.sm/Librem5/community-wiki/-/wikis/Tips%20&%20Tricks#managing-journals

3 Likes

It turns out I have two instances of Flathub, one system installation and one user installation. The user installation has zero apps installed and I guess that one might have been created during my attempts to build programs with Gnome Builder. This leads me to believe that I should be able to delete everything under ~/.local/share/flatpak without any problems, after deleting the repo from the Purism App Store. Question is if it is enough to just delete it from the repo section, or do I need some other CLI uninstall?

EDIT: I have now removed the flathub user repo in the app store and deleted the entire ~/.local/share/flatpak/appstream folder with seamingly no problems, recovering another 4GB of disk space. I am now looking at the /var/lib/flatpak/appstream/flathub/aarch64 folder wich contains some 660 folders named “.1371b7418a5654528860eaec3df6e3f3261be5de861eeb63e75a3b76fc1fe03c-4TXNM1” etc, all containing three objects; appstream.xml, appstream.xml.gz and the folder icons. Looking into the icons folders, I find between 2500-3000 png files in two folders 64x64 and 128x128, weighing in at 35-45MB. That multiplied by 660 folders add up to 3.6GB in almost 860,000 objects!!!

Maybe a total flatpak wipe and purging everything flathub on the device, followed by a fresh flatpak reinstall of the 4 apps I currently use would clean out most of this space?

EDIT 2: I have now completely uninstalled flatpak and removed the associated folders under /var/lib and ~/.local/share. My free space is now 20 GB. I will likely reinstall flatpak at a later stage if needed and hopefully it won’t totally bloat my system again.