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

Purpose of /var/lib/flatpak/.removed, needs documentation #1835

Open
hackel opened this issue Jun 28, 2018 · 17 comments
Open

Purpose of /var/lib/flatpak/.removed, needs documentation #1835

hackel opened this issue Jun 28, 2018 · 17 comments

Comments

@hackel
Copy link

hackel commented Jun 28, 2018

I recently discovered /var/lib/flatpak/.removed contained 610M in two removed-{hash} directories. I cannot find this documented anywhere other than the source code. What is the purpose of this directory? Why doesn't Flatpak automatically clean them out? Can I assume it is safe to remove manually? These directories are dated over a year ago, so I can't tell you what version I was running then. I'm currently on Flatpak 0.99.2-flatpak1~bionic on Ubuntu 18.04.

@alexlarsson
Copy link
Member

The .removed directory contains apps/runtimes that are removed (typically due to an update), but are still in use. Each time you update something all unused things in this directory will be cleaned up.

@alexlarsson
Copy link
Member

It the actual subdirectories are that old its unlikely that they are in use, a simple "flatpak update" should theoretically remove them. If not, something is going wrong and needs debugging.

@alexlarsson
Copy link
Member

I believe a flatpak update will fix this, but no reply, so closing. Re-open if it fails.

@erralb
Copy link

erralb commented Aug 22, 2018

@alexlarsson
Hi, just tried "flatpak update" but it's not working, the .removed folder still contains files

@hlev
Copy link

hlev commented Nov 25, 2018

Flatpak 1.0.4 does not seem to remove the contents of this directory either, even with uninstall --unused, despite every app in the installation was removed beforehand.

It keeps the org.freedesktop.Platform runtime and a couple of extensions are listed in metadata that seem to have been dependencies of the previously installed applications.

@matthiasclasen
Copy link
Collaborator

the code for removing is here: https://github.com/flatpak/flatpak/blob/master/common/flatpak-dir.c#L8922

It gets called during install and update. it skips subdirectories of .removed that 'locked', which is indicated by having a .removed/XYZ/files/.ref file. Is that the case for your subdirectories ?

@tjanez
Copy link

tjanez commented Jan 1, 2019

It gets called during install and update. it skips subdirectories of .removed that 'locked', which is indicated by having a .removed/XYZ/files/.ref file. Is that the case for your subdirectories ?

I will try to fill-in for @hlev since I appear to be experiencing the same issue.

[tadej@toronto files]$ ls /var/lib/flatpak/.removed
org.freedesktop.Platform-73e812f33b03b170bda57c577a2ff9f15f6fe88f6b16d43415311c72751d7693
[tadej@toronto files]$ ls -al /var/lib/flatpak/.removed/org.freedesktop.Platform-73e812f33b03b170bda57c577a2ff9f15f6fe88f6b16d43415311c72751d7693/files/.ref 
-rw-r--r--. 1 root root 0 Oct  6 22:03 /var/lib/flatpak/.removed/org.freedesktop.Platform-73e812f33b03b170bda57c577a2ff9f15f6fe88f6b16d43415311c72751d7693/files/.ref

So, indeed, it appears that org.freedesktop.Platform-73e812f33b03b170bda57c577a2ff9f15f6fe88f6b16d43415311c72751d7693 is somehow locked?

Here is the list of Flatpaks I have on the system:

[tadej@toronto ~]$ flatpak list -d
Ref                                                   Origin                   Active commit Latest commit Installed size Options       
com.slack.Slack/x86_64/stable                         flathub                  af79c7981276  -               2.8 MB       system,current
org.daa.NeovimGtk/x86_64/master                       org.daa.NeovimGtk-origin bcdaf15ce78a  -               1.9 GB       system,current
org.signal.Signal/x86_64/stable                       flathub                  52833ac7c1b7  -             276.8 MB       system,current
us.zoom.Zoom/x86_64/stable                            flathub                  d67055d67ba4  -             151.0 kB       system,current
org.freedesktop.Platform.Icontheme.Adwaita/x86_64/1.0 flathub                  6e589c240937  -              25.6 MB       system,runtime
org.freedesktop.Platform.VAAPI.Intel/x86_64/1.6       flathub                  82006efc71d3  -               8.7 MB       system,runtime
org.freedesktop.Platform.VAAPI.Intel/x86_64/18.08     flathub                  cbf3d3cf9782  -               8.1 MB       system,runtime
org.freedesktop.Platform.ffmpeg/x86_64/1.6            flathub                  d757f762489e  -               7.7 MB       system,runtime
org.freedesktop.Platform.html5-codecs/x86_64/18.08    flathub                  1f2e4a4769ab  -               7.9 MB       system,runtime
org.freedesktop.Platform/x86_64/18.08                 flathub                  34c5f0a8f28a  89f04c10a9f5  935.5 MB       system,runtime
org.gnome.Platform/x86_64/3.28                        flathub                  6d1d0ebbd724  -               1.3 GB       system,runtime

Any ideas what is going on?

@hlev
Copy link

hlev commented Jan 1, 2019

HNY

@matthiasclasen Thanks for highlighting the part of the code responsible for deletion. Unfortunately it wasn't a permalink, so I don't know if and where it goes off track.

Not sure if @tjanez has the same issue, because he has applications installed, my comment was simply related to flatpak 1.0.4 leaving unwanted files around even if you uninstall everything.

  1. Install one or more applications
  2. Uninstall every application
  3. flatpak seems to keep the Platform runtime(s) in this directory, despite nothing possibly using it, since there's nothing installed.

There is no indication, other than decreased disk space, that these files are kept around and the client does not seem to have a command to remove everything. Cleanup has to be done manually.

I haven't used or updatet flatpak since I made the comment so this may have changed.

@BullShark
Copy link

I tried doing an update. That didn't remove it.

[plasma ~]# flatpak update Looking for updates… Nothing to do. 
[plasma ~]# sudo find /var/lib/flatpak/.removed -name '*.ref' /var/lib/flatpak/.removed/org.gnome.Platform-6a3d0df724a4617ed3527ac8cd5851f6f26b1535e278d8d23df71b65dd553675/files/.ref /var/lib/flatpak/.removed/com.leinardi.gwe-d386f950fcbcc5e9bb669f1fad167a276733195defecde28a8887cab07888f09/files/.ref 
[plasma ~]# flatpak list -d 
[plasma ~]# flatpak list 
[plasma ~]# du -sh /var/lib/flatpak/.removed    
950M    /var/lib/flatpak/.removed 
[plasma ~]# 

@ludvigng
Copy link

Are these safe to remove manually? I currently only have flatpaks installed as --user, but I did accidentally install something as --system which I later removed. These things are still left in /var/lib/flatpak/.removed though.

@khanson679
Copy link

Still an issue with Flatpak 1.8.2 (Ubuntu 20.10).

➜  ~ flatpak update                   
Looking for updates…
Nothing to do.
➜  ~ du -sh /var/lib/flatpak/.removed 
866M    /var/lib/flatpak/.removed

@llucax
Copy link

llucax commented Jul 19, 2021

Same here. I even removed the .ref file and did a flatpak update and nothing is being removed from /var/lib/flatpak/.removed.

@ghost
Copy link

ghost commented Jul 27, 2021

sudo flatpak repair might do the trick.

bach@kubuntu:~$ sudo flatpak repair
[sudo] password for bach: 
[16/33] Verifying flathub:runtime/org.kde.Platform/x86_64/5.14…
Checking remotes...
Pruning objects
Erasing .removed

Original thread

@kjcole
Copy link

kjcole commented May 23, 2023

I've moved (perhaps foolishly) all the user flatpaks to system but still have ~/.local/share/flatpak/.removed/ files even after:

reboot
flatpak update
flatpak repair
sudo flatpak update
sudo flatpak repair

@alxlg
Copy link

alxlg commented Feb 28, 2024

@kjcole same here but I solved with:

flatpak repair --user

@kjcole
Copy link

kjcole commented Feb 28, 2024

@alxlg Sometime within the past nine months the problem went away... possibly because I issued that command, but more probably because my flatpaks are now all "system" rather than "user". But thanks.

@nightmareci
Copy link

I had this same issue, a lot of space being used up by the .removed directory that I wanted to reclaim. I can confirm that merely sudo flatpak repair completely erased the system packages' .removed directory and contents:

$ sudo flatpak repair
Working on the system installation at /var/lib/flatpak
Checking remotes...
Pruning objects
Erasing .removed

That doesn't do cleanup for user packages though, do flatpak repair --user for user packages as well, to finish cleaning up everything. I ran that too, but it didn't report that .removed was erased/present.

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