Is it possible to copy the runtimes for flatpaks from one to another install?

Basically my question is in the title. I wonder if it would be possible to copy the directory where runtimes for flatpaks reside from one installation to another. That would be /var/lib/flatpak I think.

Flatpaks are supposed to contain everything necessary for the application, so it’s worth trying.

1 Like

Thanks for the reply!

Yes, that was sort of my thinking as well. I will give it a go this weekend and see how it goes. I’ll report back no matter the outcome.

4 Likes

I have tried to transfer /var/lib/flatpak from one to another system. However there is something odd going on while trying to copy the directory to a removable medium to be transferred to the other system. The size of the directory in the “source” system:

flatpak1

And the size of the directory being copied:

flatpak2

And that is what actually happens. 4 GB is copied over as 10.9 GB!!

BTRFS compression maybe?

Or do Flatpaks do some hidden linking to reduce file sizes?

That’s a possibility.
I also tried to copy over the directory from a system on Btrfs to another system also on Btrfs on the same drive with the same result.

Plausible as well.

1 Like

Another question (unrelated to the topic):

While installing flatpaks (runtimes and apps) you are not asked for the password. Yet they get written to directories owned by root. Does the installation process gets root privilege somehow?

There is a process running as root called flatpak-system-helper

It is started by a systemd service, flatpak-system-helper.service

1 Like

Thanks for the explanation! I appreciate it.

1 Like

Flatpaks do some hidden linking to the libraries that a program needs to run. This way, you are downloading them once. I think what you are seeing when you copy the folder is the linked files being copied as well.

2 Likes