Low disk space - how to clean out garbage?

I am running very low on disk space on my L5. A df -h shows

Filesystem  Size  Used  Free   Used %   Mounted at
/dev/dm-0   29G   26G   1.4G   96%      /

This doesn’t sound right. I regularly clean my system with apt autoremove etc. I also use Bleachbit occasionally (not sure if that is a good idea though).

A du -sm * | sort -nr | head -15 shows the following:

20092   media (my sd card)
11151   home
10114   var
4945    usr
277     boot
22      run

Under home I get the following:

224   Pictures
133   Downloads
20    Documents
1     Videos

Found one culprit now, my .local directory. 10.3 GB in 1,115,712 objects!!!
Turns out that my ~.local/share/flatpak occupies an insane amount of space. After cleaning with flatpak uninstall --unused it still has 4.3 GB in almost a million files and dirs. The aarch64 directory has almost all of that in countless hidden dirs. Would it be safe to remove these?

Edit: Another culprit is /var/lib/flatpak with 8.5GB of space.

6 Likes

I find the output of du -xak / | sort -n | tail -100 convenient for finding the largest files and directories.

The -x keeps du on a single filesystem, very useful for / which has multiple filesystems mounted within.

1 Like

One option to check is: ~/.var/apps that is where all the flatpak apps user data is stored. You will find there directories per app. Depending on the flaptak applications that you use some of those can take some space. In ~/.var/app it is safe to remove directories from flatpak apps that you already uninstalled.

Also when removing flatpaks, did you had any error about flatpaks that might be pined down?

Another thing to check is the journalctl log size.

You can do that with: sudo journalctl --disk-usage

1 Like

Not that I have noticed. One thing I have done though, is trying to build loupe with Gnome Builder, and the build has never managed to finish due to running out of disk space. Could that have anything to do with the flatpak folders in both ~.local and /var/lib/flatpak?

I think I have cleaned it a few days ago, currently 18.7MB

This post will help some (although wasn’t really reading your thread): Computer has gotten laggy.

Executing right afterwards: sudo apt update would be sort of mandatory action. Check related before/after with: sudo du -sh /var/cache/apt/archives.

EDIT: https://docs.bleachbit.org/doc/command-line-interface.html.

1 Like

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