Low disk space - how to clean out garbage?

@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.

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
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.


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


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.

After a fresh reinstall and one flatpak app, my ~/.local/share/flatpak is of size 48K and /var/lib/flatpak 1.1G.

1 Like

this is expected, because of the runtimes needed to run the app.

1 Like

Another 1.5G with Libreoffice installed, but still have 17G unused space on the device - hooray!

1 Like

That doesn’t seem right. You may have been bitten by some bug. The appstream directory has absolutely no interest in taking so much space :wink:

1 Like

@dos Then we need to confirm that, because I have seen that on other devices.

I followed this post last night as I had the exact same problem. Thank you so much everybody for their answers and help on this issue.

I ended up wiping out Flatpak in the /var and /home directory as well. I cleaned up about 16 GB of space. Pretty disgusting, really.

Also, I cleaned up about 2 GB by “emptying” the generaljournal cache. That was most helpful.

Wanted to update people on this annoying issue. I am strongly considering not utilizing Flatpak at all now.


I might have this issue too:

$ du -hs /var/lib/flatpak/appstream/flathub/aarch64 
4.2G	/var/lib/flatpak/appstream/flathub/aarch64

Is this normal:

$ find /var/lib/flatpak/appstream/flathub/aarch64 -wholename "*icons*" | wc -l

Can I remove the appstream directory?

in short, I would not recommend it.

1 Like

Same issues here.

Is it safe to remove (some of) the contents of the appstream directory at least. At least some people seem to have done so without things going awry.
There appears to be a lot of dross in there, and I wouldn’t mind a couple of extra gigs of space.

I’ve found the information that: the …/aarch64 folder “is only supposed to have (in the steady state), one “active” symlink pointing to a non-dot prefixed check-summed file, and a .timestamp file”. Here is a discussion about that.
I’ve deleted all other stuff and apparently everithing is working properly. Recovered about 7GB


If only it wasn’t so bloody hard to manipulate files in protected folders! Nemo does not allow copying files in these directories. Running nemo from the command line as root (sudo nemo) does not work. And I don’t know of an elegant way to do this from the comand line.
(I want to copy the three files needed to a new directory, and then delete the old flathub directory.)

I think I managed to do it.
I copied the ‘active’ directory, the giant (hex?) number without a dot, and the most recent giant (hex) number with a dot to a new /flathub/aarch64 directory. After renaming the original flathub dir.
So, now I can delete the original flathub dir?

Or maybe I don’t need the one with the dot(?)