Cleaning up /var/lib/flatpak/repo/tmp after failed install

I am running the included Flatpak (1.12.2) on Linux Mint 20.3.

I made a mistake: I selected to install a large flatpak (for ungoogled-chromium) indirectly via mintinstall, when I realized I wouldn’t have enough space to install it (only for the download). Of course, mintinstall does not offer any kind of abort or cleanup functionality. So I simply declined to authorize the installation each time I was prompted for a sudo password, figuring I would be able to drop to the command line later and get rid of the downloaded packages.

However, it seems I cannot easily do this. As it happens, my internet connection failed partway through the download. But even disregarding that, it seems that the command-line UI doesn’t offer any way to interact with packages that were downloaded but not installed.

As a result, I currently have around 900 MB of data sitting in /var/lib/flatpak/repo/tmp:

$ du -hs /var/lib/flatpak/repo/tmp
893M	/var/lib/flatpak/repo/tmp

I have one simple question, which nobody on the Internet so far seems able or willing to answer: can these files safely be deleted? If not, how should I recover the disk space?

I have already tried all manner of web searches, and also specifically checked on Stack Overflow, Ask Ubuntu etc. No matter what search terms I try (and I have a years-long history of showing other people what search terms they should have tried for other issues…), hardly any results concern this specific folder, and the results that do mention it in passing are completely irrelevant to my situation.

I have already tried the Linux Mint forums. Nobody there could suggest anything better than restoring a Timeshift backup, which is unacceptable as I have already installed many other things in other ways.

I have already tried the Flatpak bug tracker. I was flatly told that my version of Flatpak is out of date (never mind that my OS doesn’t offer any newer version via apt) and that mintinstall isn’t part of Flatpak (never mind that it invoked Flatpak and caused the current situation). When I tried to clarify these points, I was completely ignored for weeks.

I have already tried uninstalling every other Flatpak app (I didn’t really need any of them), reinstalling Flatpak, and using sudo flatpak repair. None of this has any effect on the size of /var/lib/flatpak/repo/tmp.

Please just give a clear explanation of how this folder works. Just because I’m not developing with Flatpak, doesn’t mean I can’t have more than the most basic documentation needs.

It’s almost certainly safe to delete anything old in /var/lib/flatpak/repo/tmp. Are the files inside a cache directory? If so, I’d be even more certain.

It specifically looks like so:

$ du -hd1 /var/lib/flatpak/repo/tmp
474M    /var/lib/flatpak/repo/tmp/flatpak-cache-K6IFL2
365M    /var/lib/flatpak/repo/tmp/flatpak-cache-41WQL2
8.0K    /var/lib/flatpak/repo/tmp/cache
55M     /var/lib/flatpak/repo/tmp/flatpak-cache-HR9DL2
893M    /var/lib/flatpak/repo/tmp

It should be safe to remove those flatpak-cache-* directories.

I made a manual restore point and went ahead and deleted the directories manually (required sudo). No system instability; it might be a while before I actually need Flatpak for anything again.