[GRASS-user] Create location fails in docker

Hi,

I need to run GRASS in a docker image but I have issues apparently about permissions.

My docker image is built on a dockerfile:

···

Margherita Di Leo

Hi again,

I try to reformulate my question:

···

Margherita Di Leo

Hi Madi,

Am 30.09.2021 09:46 schrieb Margherita Di Leo:

Hi again,

I try to reformulate my question:

On Wed, Sep 29, 2021 at 9:32 PM Margherita Di Leo <diregola@gmail.com>
wrote:

grass --text -c EPSG:4326 $GRASSDATA/france -e

The error message:

Traceback (most recent call last):
File "/usr/bin/grass", line 390, in get_grass_config_dir
os.mkdir(directory)
PermissionError: [Errno 13] Permission denied: '/.grass7'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/grass", line 2218, in <module>
main()
File "/usr/bin/grass", line 2001, in main
grass_config_dir = get_grass_config_dir()
File "/usr/bin/grass", line 395, in get_grass_config_dir
_("Failed to create configuration directory '%s' with error:
%s")
NameError: name '_' is not defined
Traceback (most recent call last):
File "/usr/bin/grass", line 390, in get_grass_config_dir
os.mkdir(directory)
PermissionError: [Errno 13] Permission denied: '/.grass7'

What does this error message mean? Why is it trying to write in the
/.grass7 folder ?

Whenever you launch GRASS GIS with the grass startup script, it writes the chosen Gisdbase/Location/Mapset info into .grass7/rc. If you launch GRASS GIS for the first time, it first creates the directory .grass7 which is the part that fails with a permission error.

I'm no Docker expert at all, but I think you have to explicitly run the container with parameters indicating the devices one can access from within.

And what does the name '_' refer to?

This seems to be linked to the translation handling:

File "/usr/bin/grass", line 395, in get_grass_config_dir
_("Failed to create configuration directory '%s' with error:
%s")

Note the '_' in front of the string which marks it as a translatable string.

There was a bug related to this a while ago, but it was fixed (https://trac.osgeo.org/grass/ticket/3875). Maybe a locale issue ?

Moritz

2021-09-30 10:46 GMT+03:00, Margherita Di Leo <diregola@gmail.com>:

What does this error message mean? Why is it trying to write in the

/.grass7 folder ? And what does the name '_' refer to?

It means that you need to fix your environment before starting GRASS.
Check your $HOME setting.

Māris.

Hi Moritz,

Hi Madi,

PermissionError: [Errno 13] Permission denied: ‘/.grass7’

What does this error message mean? Why is it trying to write in the
/.grass7 folder ?

Whenever you launch GRASS GIS with the grass startup script, it writes
the chosen Gisdbase/Location/Mapset info into .grass7/rc. If you launch
GRASS GIS for the first time, it first creates the directory .grass7
which is the part that fails with a permission error.

But isn’t .grass7/rc folder supposed to be written in the home directory? In my docker image I set the user and a home directory is created for it…

I’m no Docker expert at all, but I think you have to explicitly run the
container with parameters indicating the devices one can access from
within.

I’m trying to figure… I set a workdir and give full permissions to the user to it, but still the .grass7 folder is not written there nor in the home. Is there a way to “force” the grass configuration files to be written somewhere else?

Thanks,

···

Margherita Di Leo

[RESOLVED]

Simply the docker machine was deployed with changes I was unaware of. Sorry for the noise and thank you so much for the brainstorming.

···

Margherita Di Leo