How to solve runaway Flatpak folder size?

New thread, new question (I did try to search the issue at least)

A lot of trouble ballooned by my previous install having a runaway flatpak situation. I ended up reinstalling the whole system because I couldn’t keep track of the failed things I’ve done and all the things I might have screwed things up behind the scenes.

So… now I am at a fairly fresh install. When I did the reinstall, I tried desperately to make the root partition bigger than 70.1 Gig. This was apparently impossible. So I am stuck with that.

This means that whenever I install a flatpak, it gets installed to /var/lib/flatpak . I do not want that. Because that means the root folder gets too big and pretty soon I can’t even update nvidia drivers and other things because diskspace runs out even though there’s 900+ gigs of space that the installers refuses to even touch.

So. I have googled around and found some guides. One wants the user to dedicate a whole partition to the flatpak folder, That seems excessive to me.

https://linuxconfig.org/how-to-move-var-directory-to-another-partition

another has a more sensible (to my untrained eyes) method of moving the flatpak folder to somewhere in the home folder (so it can use all the space on the disk I already have set up) and somehow link flatpak installs to it…

And when I type “somehow”. I am meaning that I am not quite sure what they are talking about. Apparently, it’s some kind of a “symlink”.

So I tried…

copying /var/lib/flatpak to /home/username/flatpakplus (I did use my own username, I just don’t want it public on the web :wink: )

Then I tried

ln -s /home/username/flatpakplus /var/lib/flatpak

things did go without error messages. But when I tried installing GIMP… it still installed into /var/lib/flatpak

So there’s some kind of step I have missed here. So I removed the link and I removed the flatpakplus folder from my home folder. And by that I tried to restore things to what it was before I started to muck around.

So…

tldr:

What actually is the preferred method of altering things so that the flatpaks gets installed into a folder on a partition that has more than enough room to install hundreds of apps?

Wouldn’t it just be better to not use flatpak at all? Pretty much all the software you will need can come from RPM repositories, and you can just do:

dnf install packagename

otherwise, just partition your system properly in the first place when you install it, and make sure you have enough space available for the partitions you know will increase in disk usage.

1 Like

I would:

  1. Copy /var/lib/flatpak to /home/flatpak
    (you don’t want this stuff into your home directory)
  2. Remove everything from /var/lib/flatpak
    (essentially steps 1 and 2 move /var/lib/flatpak/* to /home/flatpak/)
  3. Add /home/flatpak /var/lib/flatpak none bind 0 0 into /etc/fstab
  4. mount /var/lib/flatpak
    (the findmnt /var/lib/flatpak should now show something and content of /home/flatpak should be visible in /var/lib/flatpak)
  5. restorecon -Rv /var/lib/flatpak
    (SELinux file contexts have to be restored; /home has different rules, which the copy did use)

Ok. Let me show my ignorance here by asking some questions to make this more of an informed series of steps.

Is there anywhere I can read about why I don’t want this stuff in my home directory? It sounds important, so it might be good to know why.

Also, last time I tried using a simple “cp directory directory” command for this, it just sat there not showing anything. I could assume it was doing something, but I had no clue as to how far it had progressed. Is there a good copy command that shows some form of progress? Because I accidentally did close the terminal during it was running and… well.. I ended up reinstalling because I had no clue what was copied and what wasn’t.

I am now curious about what the “none bind” bits do for that proposed row in fstab.

Also, instead of removing. Would it be a safe move to just rename the /var/lib/flatpak to something else. Just so I can restore things if it all goes bork like last time I tried this?

as you may suspect by now. I am vary shaky at the basics of linux. Is “mount /var/lib/flatpak” something I should type in terminal?

I have no clue what this means. Sorry. :slight_smile: