Cleaning up after a failed flatpak download?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
zahlman
Level 1
Level 1
Posts: 28
Joined: Mon Apr 17, 2023 12:46 pm

Cleaning up after a failed flatpak download?

Post by zahlman »

[System details: Linux Mint 20.3 Cinnamon on Ubuntu 20.04; mintinstall 8.0.9; Flatpak 1.12.2]

Previously, I tried using the Software Manager to grab a large Flatpak app. Thanks to my unstable internet connection, the download was interrupted partway through, and Software Manager simply errored out. This is just as well, since I realized I really wanted to do a user install of it anyway and Software Manager doesn't offer an option for that. (In fact, it had offered me a couple of elevation prompts during the process which I simply cancelled out of, presumably because there were multiple packages to install for the application. I reasoned that I could just let the download run and then figure out what to do with the downloaded packages, but the download failed.)

Eventually, I ended up doing the user-level install separately, from a fresh download; but now I still have extra disk usage - representing, I assume, downloaded but not installed packages, which are not sufficient to install the application.

I already tried `sudo flatpak repair`. It claimed to remove some things, but I only got back about 10MB this way (perhaps the package download that was in progress?) and I am still somewhere on the order of 500GB short of what I expected.

The strange part is that `flatpak list -d --all` doesn't seem to list anything new, and seems to account for the entire size of the folder as reported by Baobab. But if I look at my Timeshift backups using `du -s`, I can see the usage for `/var/lib/flatpak` go up by almost 900MB in the next snapshot after the failed download. (It was already a lot more than Baobab reports, which I guess has something to do with how symlinks are accounted for... but more importantly, there was definitely a significant change, so I know I'm not just imagining that I lost disk space.)

How can I clean up the now-useless downloaded data safely? I can't find anything in Flatpak options about downloaded but not installed packages.

UPDATE: I may have misinterpreted the `flatpak list -d --all` output. On further investigation, it appears that the increase in disk usage is accounted for by `/var/lib/flatpak/repo/tmp`, which certainly sounds like a logical place for the downloads. Can I safely just delete the contents here, or does Flatpak need to do some internal bookkeeping with it?)
mikeflan
Level 17
Level 17
Posts: 7162
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Cleaning up after a failed flatpak download?

Post by mikeflan »

I'm really not sure about this, but I say . . .
I really wanted to do a user install of it anyway and Software Manager doesn't offer an option for that.
I say all Software Manager installs are user installs.

I say stick with Software Manager installs unless you have a good reason not to.
How can I clean up the now-useless downloaded data safely?
Install with Software Manager and then uninstall with Software Manager.
Can I safely just delete the contents here
It is probably safe to do that, but I would do Software Manager install and Software Manager uninstall first.
I can see the usage for `/var/lib/flatpak` go up by almost 900MB in the next snapshot after the failed download.
Consider just doing a Timeshift snapshot restore from before the install attempt.
User avatar
Lady Fitzgerald
Level 15
Level 15
Posts: 5821
Joined: Tue Jan 07, 2020 3:12 pm
Location: AZ, SSA (Squabbling States of America)

Re: Cleaning up after a failed flatpak download?

Post by Lady Fitzgerald »

mikeflan wrote: Thu Mar 28, 2024 7:47 pm ...Consider just doing a Timeshift snapshot restore from before the install attempt.
This ^. I always create a Timeshift snapshot before installing anything and write in the comments why I made the snapshot (same for removing a program, changing settings, etc.). that way, if something goes south, I can just restore the snapshot and it will be as though I never did anything after I made the snapshot.
Jeannie

To ensure the safety of your data, you have to be proactive, not reactive, so, back it up!
zahlman
Level 1
Level 1
Posts: 28
Joined: Mon Apr 17, 2023 12:46 pm

Re: Cleaning up after a failed flatpak download?

Post by zahlman »

mikeflan wrote: Thu Mar 28, 2024 7:47 pm I say all Software Manager installs are user installs.
By "user install" I mean an installation of software that places the content in a user-specific directory, such that the program is only usable by that user (without sudo etc. overrides). I know the dpkg/apt toolchain is not designed for this, but it is an explicitly built-in feature of Flatpak, and also a normal thing that Windows users do all the time.
I say stick with Software Manager installs unless you have a good reason not to.
My overall experience with mintinstall has been quite poor, frankly. It doesn't offer any kind of cancellation or cleanup options; it suppresses all sorts of debug information (compare mintupdate which offers an xterm with detailed logging); and only a single version of any given package is offered, which is often years out of date with no indication of any means to update.
Install with Software Manager and then uninstall with Software Manager.
As far as I can tell, a couple dependencies were downloaded and not the complete package; and I can't even figure out which dependencies. So I can't really see how this is intended to work, either. Aside from that, I'm not sure there's disk space on the volume to install the whole thing (a problem I was able to avoid by using Flatpak directly, because a user install goes on a separate partition the way I have things configured), and it would be a lengthy download that could easily fail again.
Consider just doing a Timeshift snapshot restore from before the install attempt.
I considered it. If I don't see a better idea either here or on the Flatpak GitHub I'll probably end up doing it (and then re-applying some other changes), but I'm very much not happy with the idea that I should have to resort to this. I didn't manually back up first (I never did the equivalent in 15+ years on Windows, and never ended up regretting it) and my last snapshot before the installation attempt is a weekly one.
mikeflan
Level 17
Level 17
Posts: 7162
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Cleaning up after a failed flatpak download?

Post by mikeflan »

As far as I can tell, a couple dependencies were downloaded and not the complete package; and I can't even figure out which dependencies.
The hope is that install with Software Manager will finish the install and then uninstall with Software Manager will remove all of it, or at least whatever would normally be uninstalled. But if you don't have the space, then don't do that.
User avatar
Da Londo
Level 4
Level 4
Posts: 205
Joined: Fri Feb 06, 2009 11:48 am
Location: Maasmechelen, BE
Contact:

Re: Cleaning up after a failed flatpak download?

Post by Da Londo »

Maybe this will help

Code: Select all

flatpak uninstall --unused
aka Jim on HexChat
zahlman
Level 1
Level 1
Posts: 28
Joined: Mon Apr 17, 2023 12:46 pm

Re: Cleaning up after a failed flatpak download?

Post by zahlman »

I probably should have mentioned, I also already tried that and of course it doesn't help. I can't uninstall it because it isn't installed.
motoryzen
Level 10
Level 10
Posts: 3497
Joined: Sun Dec 08, 2019 12:25 am

Re: Cleaning up after a failed flatpak download?

Post by motoryzen »

I can't uninstall it because it isn't installed
Then the only thing that remains is confirming whether or not any remnants of the duplicate or original flatpak app's files remain..If so..hunt them down.

/var/lib/flatpak is the most common place in Mint where flatpak application files are located
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
zerth
Level 1
Level 1
Posts: 7
Joined: Thu Jun 15, 2023 4:39 am

Re: Cleaning up after a failed flatpak download?

Post by zerth »

zahlman wrote: Thu Mar 28, 2024 1:56 pm I already tried `sudo flatpak repair`. It claimed to remove some things, but I only got back about 10MB this way (perhaps the package download that was in progress?) and I am still somewhere on the order of 500GB short of what I expected.
500 GB is a bit too much for a broken flatpak install. In my experience, flatpak tends to pull in 2-3 GB of additional dependencies per app tops. And even these dependencies are runtimes shared by many apps.

You may want to check your filesystem for errors. If it looks fine, use the standard ways to analyse a drive for large files and directories. It may be not related to flatpak at all.
motoryzen
Level 10
Level 10
Posts: 3497
Joined: Sun Dec 08, 2019 12:25 am

Re: Cleaning up after a failed flatpak download?

Post by motoryzen »

Unless you're running literally around 80 to 100 something flatpak applications, Zerth made a VERY reasonable point. I'm betting on that or some folder that contains a lot of stuff you forgot or didn't know it about.
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
zahlman
Level 1
Level 1
Posts: 28
Joined: Mon Apr 17, 2023 12:46 pm

Re: Cleaning up after a failed flatpak download?

Post by zahlman »

zerth wrote: Sun Mar 31, 2024 7:25 am
zahlman wrote: Thu Mar 28, 2024 1:56 pm I already tried `sudo flatpak repair`. It claimed to remove some things, but I only got back about 10MB this way (perhaps the package download that was in progress?) and I am still somewhere on the order of 500GB short of what I expected.
500 GB is a bit too much for a broken flatpak install. In my experience, flatpak tends to pull in 2-3 GB of additional dependencies per app tops. And even these dependencies are runtimes shared by many apps.

You may want to check your filesystem for errors. If it looks fine, use the standard ways to analyse a drive for large files and directories. It may be not related to flatpak at all.
Sorry, a typo, I meant 500MB - as an estimate, because I was only roughly aware of usage before and after. In fact it is 900MB upon inspection (just as noted with the Timeshift du comparison). I thought I was clear that I was talking about garbage left behind from a single failed installation, and I definitely do not have the kind of Internet capacity required to create a problem on that scale :mrgreen:
motoryzen wrote: Sat Mar 30, 2024 6:45 pm Then the only thing that remains is confirming whether or not any remnants of the duplicate or original flatpak app's files remain..If so..hunt them down.

/var/lib/flatpak is the most common place in Mint where flatpak application files are located
I must ask: did you read the OP, in which I clearly described looking in that folder, and observing bloat within the `repo/tmp` subfolder? In particular, the update at the end, in which I explicitly ask whether it is safe to delete that folder or its contents?
zahlman
Level 1
Level 1
Posts: 28
Joined: Mon Apr 17, 2023 12:46 pm

Re: Cleaning up after a failed flatpak download?

Post by zahlman »

Based on advice from the Flathub Discourse I went ahead and deleted the cache folders. No issues so far.
Post Reply

Return to “Software & Applications”