[GNC-dev] flatpak environment.local

Geert Janssens geert.gnucash at kobaltwit.be
Fri May 7 15:47:41 EDT 2021


Op maandag 26 april 2021 03:48:56 CEST schreef Chris Good:
> Hi Frank,
> 
> Your strace suggestion was successful thanks.
> I am using the flathub stable GnuCash flatpak.
> 
> 1. strace showed both environmentand & environment.local should be in
> /app/etc/gnucash to be read by GnuCash sandbox. Investigation shows that
> this comes from the host file system
> /var/lib/flatpak/app/org.gnucash.GnuCash/current/active/files/etc/gnucash.
> Sandbox /app/etc is HARD linked to host
> /var/lib/flatpak/app/org.gnucash.GnuCash/current/active/files/etc
> 
> This is the expected location for a flatpak that is for ALL users, but I
> thought  I installed it just for my user. It turns out that the
> installation instructions in
> https://wiki.gnucash.org/wiki/Flatpak#Installation are wrong, at least for
> Ubuntu 20.04 flatpak 1.65. Our wiki says:
> 	# Install GnuCash ...
> 	## for all users
> 	sudo flatpak install flathub org.gnucash.GnuCash
> 	## or only you
> 	flatpak install flathub org.gnucash.GnuCash
> 
> but the Ubuntu man page says (my words):
> 	## for all users
> 	flatpak install --system flathub org.gnucash.GnuCash
> 	## or only you:
> 	flatpak install --user flathub org.gnucash.GnuCash
> And, although the man page doesn't say it, --system is the default and does
> NOT need sudo, so my flatpak installed in the system location
> (/var/lib/flatpak)
> rather than the user location (~/.local/share/flatpak).
> 
> Can some-one please let me know if the GnuCash wiki is outdated, or just
> wrong, or just wrong for Ubuntu so I can update it?
> 

I believe --system has always been the default. I *thought* it was a distro specific 
configuration to allow users (or perhaps users with admin rights only?) to install system wide 
flatpaks without sudo rights. As far as I know this is also the way it works on Fedora and has 
for as long as I remember. So Ubuntu is certainly not the only distro to do this. I don't know 
about other distros.

> 2. I just created an environment.local file in
> /var/lib/flatpak/app/org.gnucash.GnuCash/current/active/files/etc/gnucash
> from outside the sandbox, and after the sandbox is started, it is able to
> access /app/etc/gnucash/environment.local.
> I suspect that may go missing after a flatpak update - Is there a better
> way?
> 
Not based on environment.local. The environment.local method was created with a traditional 
package installation in mind. It also works on Windows, simply because the Windows installer 
overwrites an existing installation. It's not working with the MacOS dmg for the same reason it 
doesn't work for flatpaks. Each flatpak version is installed in a separate  directory and the 
manually added files are not copied over. This could use some rearchitecting.

Having said that, you can define a custom environment for a flatpak application using
flatpak override (--user|--system) --env "LANG=en_GB LANGUAGE=en_GB" \
                 org.gnucash.GnuCash

This will set these environment variables for the gnucash flatpak and this will persist across 
updates.

> 3. Even though the GC sandbox read environment.local setting LANG=en_GB and
> LANGUAGE={LANG}, and I checked en_GB is available in my flatpak GnuCash
> shell the trace file still shows: Effective locale set to en_AU.UTF-8
> Perhaps this message is misleading? I wonder how to check what is actually
> being used?
> 
I can't tell you that offhand (and currently am not in a position to dig in the code...) 

Regards,

Geert


More information about the gnucash-devel mailing list