How to change install location for Flatpak?

Hello,
The default install flatpak location is: /home/USER/.var/app/

I created today a ext4 gaming partition for Linux on my second drive. Is there a way to change the install folder for Flatpaks to my second drive?

I don’t use flatpacks so don’t know for sure but there is likely some config somewhere to change the default location. If not you could just move the folder and then link it back to it’s original location. The application should just follow the path with no problem.

ln -s /path/to/new/location /path/of/old/location
1 Like

I have to update the flatpaks with flatpak update --system so moving the files from one locations to another, wont really help here. I will run into issue, because flatpak wont find the new location then.

What is that command good for? Im better wait for someone who really knows how to change it… thanks anyways.

It’s a link. The application should just see it as it’s normal path. You can test it with the file manager. Just clicking through should take you there. This is what I use to keep all my data away from the operating system. Picture, Documents etc are on another partition/drive. There are just links in my /home. This way I can reinstall or change the OS if needed, mount the partition/drive, create the links and everything is where it needs to be.

1 Like

That’s not the installation location, but the data location, and no that can’t be changed. The default installation path /var/lib/flatpak can be changed.

You can try a symlink as @eriefisher tried to explain or a bind mount, or you add it like here described: https://docs.flatpak.org/en/latest/tips-and-tricks.html#adding-a-custom-installation

1 Like

@eriefisher

Im mainly intrested to change my data location…

I also see some files in /var/lib/flatpak but it looks mainly like some links that leads to the data location.

I have absolute no experience how to change this or how to symlink my flatpak application to a new location after i moved it or i have to reinstall the whole game?

Since you said its not possible to change the full data location and since i have to update my flatpak in terminal im total clueless what to do now.

The big problem is, its a game that i want to change the location… it called BAR (Beyond all Reason) and it has also a Launcher that updates the game data but the launcher and nvidia flatpak drivers needs also updates through flatpak update --system command in the Terminal.

As a exact sample, my install folder is: /home/koboldx/.var/app/info.beyondallreason.bar/

And my new Partition/mount point is: /run/media/koboldx/Linux-games/

Should i move the game location to: /run/media/koboldx/Linux-games/info.beyondallreason.bar/

and what next?

Should i just type in Terminal: ln -s /run/media/koboldx/Linux-games/info.beyondallreason.bar/ /home/koboldx/.var/app/info.beyondallreason.bar/

And thats enough?

Im a total clueless rookie there. I have no idea if thats works.

I also want to give additional info, maybe that help… but i copy pasted the Application Link from the Startmenue (the way how i normaly start the flatpak game) at the desktop and i checked the properties and found another path:
/var/lib/flatpak/exports/share/applications/info.beyondallreason.bar.desktop

I believe this must be the launcher that comes up first to update the gamefiles.

This tutorial looks like over the top too me. I think/hope the symlink is the better way to archive the goal.

Please guys lead me though the process. Anyways, i need to go to sleep… im tomorrow online again, so i will response back then, if you have some informations for me.

It is just not intended to be changed or being portable. If it is beyond your knowledge, then let as it is. A quick search reveals to me that a symlink will not work here because of bwrap. No idea, but must be part of the sandbox technique.

I searched it and it has an AppImage. Just download it and run it. It is portable.

So if you want everything on /run/media/koboldx/Linux-games/, then create folder there and put the AppImage in there. Then create a folder next to it with the AppImage Name plus .home.

  • Launcher: /run/media/koboldx/Linux-games/Beyond-All-Reason.AppImage
  • Folder: /run/media/koboldx/Linux-games/Beyond-All-Reason.AppImage.home

:notebook: The Name of that folder must match the filename.

Now the Launcher uses this folder as /home/$USER/. Fully portable that way. That would be the shortest way and without hassle. :man_shrugging:

What is bwrap? Is this some protection?

AppImage with that game is a really big downgrade… there are Sound issues, i already gave AppImage a chance, but its a no go.

You still see a way to get it to run with your tips and tricks link?

Flatpak’s sandbox tool: Bubblewrap - ArchWiki

Not for the data location in your home folder, no.

1 Like

Thats sad… :frowning:

Thanks anyways for your help.

Sorry for the late response but it looks like you got your answer. As @megavolt pointed out links or symlinks won’t work in ever scenerio. Unfortunately this seems to be one of them. I should play with flatpaks some more to learn about them. I’ve tried a few times and had nothing but trouble. CPU’s hit at 100%, ram consumption and freeze ups. Hopefully they have things sorted better by now.

1 Like

I think i have the same Performance in this game, as when i play under Windows10, cpu related no real difference.

But Ram consumption hell yeah… its a pain and i dont think that its normal… but on the other hand, i never checked the Ram consumption with AppImage.

I asked on a discord server also about the flatpak and i just got a answer with a link, but its related to steamdeck.

https://tuxexplorer.com/can-i-choose-where-my-flatpak-apps-are-saves-on-the-steam-deck

Could this change the result? The info looks pretty close the same as your link suggested.

You are right. It is the same. So no change.

1 Like

Just a quick response, it was possible to change location and i have found a quick solution.

All my Command + individual locations, no other changes or Applications involved (only the Gamelauncher keeps in the remaining Flatpak default folder):

move exiting installation to new directory (dont create a Folder named “bar”)

$ mv ~/.var/app/info.beyondallreason.bar/data/ /media/linux-games/bar

give app in flatpak permission to read and write to new data directory

$ flatpak override --user --filesystem=/media/linux-games/bar info.beyondallreason.bar

symlink the old data directory to new one

$ ln -s /media/linux-games/bar ~/.var/app/info.beyondallreason.bar/data

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.