Give a Flapak app read-write access to its own internal file system
Bartłomiej Piotrowski
b at bpiotrowski.pl
Mon Jan 31 20:59:13 UTC 2022
On 31/01/2022 21.40, Olof Nord wrote:
> Hello Flatpak devs!
>
> I have a demo application[1], which during initial startup, extracts
> some archives inside the Flatpak.
>
> Is there any flags/ways of giving the application write access to its
> own internal file system?
> In my case to "/app/bin/resources".
> This folder does not exist during build, but is created at startup.
>
> Currently, I receive the following error message during startup:
> "unlinkat /app/bin/resources: read-only file system".
>
> The files are only relevant to the application itself, there is no need
> to access them from outside.
>
> I have found "--sandbox-expose" to expose read-write access to a file,
> but this argument isn't valid as a finish-args, and using "--filesystem"
> isn't really applicable as the folder exists only inside the Flatpak
> itself (It also does not address the problem, I have tried).
>
> Using Flatpak 1.12.4, flatpak-builder 1.2.2.
>
> Any advice or further information would be greatly appreciated!
>
> Cheers,
> Olof Nord
>
> [1]https://gitlab.com/olof-nord/go-astilectron-flatpak-demo
> <https://gitlab.com/olof-nord/go-astilectron-flatpak-demo>
As far as I know, /app is read-only except for the extra-data modules,
which can extract data to /app/extra during installation. There is no
solution to that, it's by design.
A possible workaround is extracting files to $XDG_DATA_HOME, but I
assume you would need to change your app to look for the data there.
Bart
More information about the Flatpak
mailing list