Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to clean flatpak repo/objects folder? #3542

Closed
janchytry opened this issue Apr 6, 2020 · 14 comments
Closed

How to clean flatpak repo/objects folder? #3542

janchytry opened this issue Apr 6, 2020 · 14 comments

Comments

@janchytry
Copy link

janchytry commented Apr 6, 2020

Hi all,

#2945 has not given me a proper response so I am asking straightforward:

I have uninstalled all flatpaks on my computer, the folder /var/lib/flatpak/repo/objects/ is still huge, taking up almost 9 GB of space.
How can I clean it or remove it? If there is no dedicated flatpak command, can I safely remove the whole /var/lib/flatpak folder manually after I have: sudo apt remove flatpak ?

Thanks!

Configuration:

Linux Mint 19.2
Flatpak 1.0.9

@TingPing
Copy link
Member

TingPing commented Apr 6, 2020

Just a guess: sudo ostree prune --repo=/var/lib/flatpak/repo

@refi64
Copy link
Collaborator

refi64 commented Apr 7, 2020

flatpak uninstall should already prune iirc, are you sure there aren't any leftover runtimes?

@janchytry
Copy link
Author

janchytry commented Apr 7, 2020

@TingPing Seems legit, I might give it a try.

@refi64 I am dead sure, I used flatpak uninstall --unused many times and flatpak list returned an empty space. /var/lib/flatpak/repo is still cluttered.

I mean I consider sudo apt uninstall flatpak entirely and assume then it must be safe to remove, innit.

@janchytry
Copy link
Author

@TingPing
sudo ostree prune --repo=/var/lib/flatpak/repo
returned:

error: No such metadata object b652ad50773fd61316b7aac0c3b7419742a5283abe3909ab3fb04d1c96d37dab.dirtree

@mwleeds mwleeds changed the title How to clean flatpak repo/objets folder? How to clean flatpak repo/objects folder? Apr 7, 2020
@TingPing
Copy link
Member

TingPing commented Apr 7, 2020

sudo flatpak repair ?

@janchytry
Copy link
Author

janchytry commented Apr 8, 2020

Oh my god, @TingPing you are right.

~$ flatpak repair
Verifying flathub:appstream2/x86_64...
Removing non-deployed ref flathub:runtime/org.freedesktop.Sdk/x86_64/19.08...
Pruning objects
error: No such metadata object b652ad50773fd61316b7aac0c3b7419742a5283abe3909ab3fb04d1c96d37dab.dirtree

returned an error one would never expect because of not using the good ol' SUDO.

~$ sudo flatpak repair
Verifying flathub:appstream2/x86_64...
Removing non-deployed ref flathub:runtime/org.freedesktop.Sdk/x86_64/19.08...
Pruning objects
~$

And voila! Repo folder is nearly empty.

I suggest changing how flatpak handles missing sudo error. This was very frustrating.
I think we can close this.

@stradicat
Copy link

Oh my god, @TingPing you are right.

~$ flatpak repair
Verifying flathub:appstream2/x86_64...
Removing non-deployed ref flathub:runtime/org.freedesktop.Sdk/x86_64/19.08...
Pruning objects
error: No such metadata object b652ad50773fd61316b7aac0c3b7419742a5283abe3909ab3fb04d1c96d37dab.dirtree

returned an error one would never expect because of not using the good ol' SUDO.

~$ sudo flatpak repair
Verifying flathub:appstream2/x86_64...
Removing non-deployed ref flathub:runtime/org.freedesktop.Sdk/x86_64/19.08...
Pruning objects
~$

And voila! Repo folder is nearly empty.

I suggest changing how flatpak handles missing sudo error. This was very frustrating.
I think we can close this.

I've done this exactly, but I wanted to ask first, since something looks odd:

$ sudo flatpak repair

[71/145] Verifying flathub:[package name, etc]
Pruning objects
Erasing .removed

Why would flatpak repair stop at just 71? would this behaviour be expected?

refi64 added a commit to refi64/flatpak that referenced this issue Sep 13, 2021
@refi64
Copy link
Collaborator

refi64 commented Sep 13, 2021

@DennisMayr Looks like it's just a bug in the progress reporting, should be fixed in #4410.

@stradicat
Copy link

Got it; thanks for the update!

alexlarsson pushed a commit that referenced this issue Sep 17, 2021
@QuestionMark001
Copy link

sudo flatpak repair ?

@TingPing Thanks for you,Bro.👍

@stacode123
Copy link

sudo flatpak repair ?

hmm seems not to work for me.
would only having 200mb of disk space affect that?

@pabloab
Copy link

pabloab commented Nov 1, 2023

Using Flatpak 1.11.1. After a remove --unused, sudo flatpak repair had reduced my du -sh /var/lib/flatpak/ from 1.5G to 89M. Shouldn't this be considered a bug? Shouldn't clean up/repair at least every time in a while?

@jwverzijden
Copy link

I have flatpak version 1.14.6, I think something is wrong with my configuration but I have no clue how to figure out what the problem is...
I have only a few apps installed with flatpak:

~$ flatpak --columns=name,app,version,branch,size,installation list
Name                                             Application ID                                          Version            Branch                 Installed size            Installation
Sticky Notes                                     com.vixalien.sticky                                     0.2.4              stable                 387.1 kB       user
DBeaver Corporation                              io.dbeaver.DBeaverCommunity                             24.1.0             stable                 312.6 MB       user
Mesa                                             org.freedesktop.Platform.GL.default                     24.0.7             23.08                  495.0 MB       user
Mesa (Extra)                                     org.freedesktop.Platform.GL.default                     24.0.7             23.08-extra            495.0 MB       user
nvidia-550-54-14                                 org.freedesktop.Platform.GL.nvidia-550-54-14                               1.4                      2.1 MB       user
Intel                                            org.freedesktop.Platform.VAAPI.Intel                                       23.08                   46.5 MB       user
openh264                                         org.freedesktop.Platform.openh264                       2.4.1              2.4.1                  763.9 kB       user
The GIMP team                                    org.gimp.GIMP                                           2.10.38            stable                 368.9 MB       user
GNOME Application Platform version 45            org.gnome.Platform                                                         45                       1.0 GB       user
GNOME Application Platform version 46            org.gnome.Platform                                                         46                     917.6 MB       user
Pop Gtk theme                                    org.gtk.Gtk3theme.Pop-dark                                                 3.22                     1.1 MB       user

~$ cd .local/share/flatpak/repo/objects/
~/.../repo/objects$ du -sh
38G	.

why is there 38GB of stuff in there when the installed apps only have a size of about 4GB in total?

repair doesn't seem to work because it exits with an error for user and doesn't do anything with sudo:

~/.../repo/objects$ flatpak repair --user
[45/46] Verifying flathub:runtime/org.freedesktop.Platform.GL.default/x86_64/23.08…
Checking remotes...
Pruning objects
error: No such metadata object e14f6225647ef3c359070fd64d402847175777e182e336774fd5189e034ff5c6.dirtree
~/.../repo/objects$ sudo flatpak repair
Working on the system installation at /var/lib/flatpak
Checking remotes...
Pruning objects
~/.../repo/objects$ du -s
38972732	.

I would like to reclaim at least some of the space used.. I think 38GB is unreasonable for the apps I have installed.
Is there a way to get some indication what's wrong with the repair command or some way to force clean it, can I just hit rm -rf on the dir or will that break everything?

@jwverzijden
Copy link

fyi I deleted the directory and it was not a problem.
maybe it's best if flatpak simply cleans up this junk when its not needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants