After trying to build the gitg flatpak I noticed my /var/lib/flatpak/repo
folder has become very large.
I'm assuming these are build files? Is there a good way to clean these up?
I'm using Flatpak 1.4.0.
After trying to build the gitg flatpak I noticed my /var/lib/flatpak/repo
folder has become very large.
I'm assuming these are build files? Is there a good way to clean these up?
I'm using Flatpak 1.4.0.
For those landing here who arent building stuff, /var/lib/flatpak/repo
is also where every flatpak installs ends up, and when you run upgrades it doesn't clean itself up. For --user
installed packages it would be ~/.local/share/flatpak/
.
Discovered that answer on this post.
flatpak uninstall --unused
Before
[root@laptop flatpak]# du -sh .
8.4G .
After
[root@laptop flatpak]# du -sh .
4.3G .
/var/lib/flatpak/
& ~/.local/share/flatpak/
are the system & user install location for installed runtimes (e.g. org.gnome.Platform
) and applications (e.g. org.gnome.gitg
). The repo/
directory is where all the checksum-ed binary files are stored, it's like a git repo. They are not the build files unless you include the downloaded org.gnome.Sdk//master
runtime, which would be installed here. But the SDK is shared and not specific to gitg.
If you built with flatpak-builder
they would be in a folder called .flatpak-builder
& the build
folder (what ever you called it). So if you ran the following in a directory like ~/gitg-build-folder/
:
flatpak-builder --force-clean --repo=gitg-repo build org.gnome.gitgDevel.json
Delete ~/gitg-build-folder/build
& ~/gitg-build-folder/.flatpak-builder
to remove any build files produced during building gitg.
If you don't need to build anything in the future you could delete org.gnome.Sdk//master
, however, a lot of the files are de-duplicated as org.gnome.Platform
is also installed. You might also have the *.Debug
SDK extension installed which would take a lot of space.
Answer from duplicate question on Flatpak GitHub: https://github.com/flatpak/flatpak/issues/2945#issuecomment-499498706
Fixed my greedy Flatpak problem, for what it's worth: I managed to clean like 20 Gb of garbage (/var/lib/flatpak/repo/objects), a bunch of tiny files. I started by uninstalling all the applications that I had installed there, but it didn't make much difference. Without applications and only with runtimes, it was still the same. Used the flatpak uninstall --unused command, which removes runtimes and extensions not used by installed applications (I didn't have any left, so everything was removed). Despite this, there was no big difference on the hard drive. Finally, the command sudo flatpak repair, which is to fix inconsistencies, is what cleared almost 20 GB. I had previously tried it without success. I guess by deleting the apps, Flatpak just became aware of that garbage. Although I don't need them anymore, because I installed them directly on the system, I reinstalled the Flatpak applications (curious to see what would happen) that I had and everything works fine and only taking up something like 1GB.
My Flatpak version: 1.10.7