What is the problem: Permission Denied ?

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
xieqing
Posts: 6
Joined: Fri Jun 26, 2020 10:10 am

What is the problem: Permission Denied ?

Post by xieqing »

I'v installed CS-6.0.5 on the Linux subsystem of Windows10

I'm trying to create a new study. Then there goes the error message:

csrun create -s test -c case1

code_saturne 6.0.5 study/case generation
o Creating study 'test'...
o Creating case 'case1'...
Traceback (most recent call last):
File "/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/bin/code_saturne", line 76, in <module>
retcode = cs.execute()
File "/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/lib/python3.8/site-packages/code_saturne/cs_script.py", line 93, in execute
return self.commands[command](options)
File "/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/lib/python3.8/site-packages/code_saturne/cs_script.py", line 150, in create
return cs_create.main(options, self.package)
File "/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/lib/python3.8/site-packages/code_saturne/cs_create.py", line 865, in main
study.create()
File "/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/lib/python3.8/site-packages/code_saturne/cs_create.py", line 293, in create
self.create_case(c)
File "/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/lib/python3.8/site-packages/code_saturne/cs_create.py", line 694, in create_case
shutil.copytree(user_distpath, user)
File "/usr/lib/python3.8/shutil.py", line 554, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File "/usr/lib/python3.8/shutil.py", line 510, in _copytree
raise Error(errors)
shutil.Error: [('/mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/share/code_saturne/user', 'SRC/REFERENCE', "[Errno 13] Permission denied: 'SRC/REFERENCE'")]

Can anyone teach me how to solve this problem?
Mohammad
Posts: 99
Joined: Thu Oct 25, 2018 12:18 pm

Re: What is the problem: Permission Denied ?

Post by Mohammad »

Hello,

I'm not very expert at this, but you check the following command (sudo) to check if the error is due to user permissions or not:

Code: Select all

sudo csrun create -s test -c case1
Regards,
Mohammad
xieqing
Posts: 6
Joined: Fri Jun 26, 2020 10:10 am

Re: What is the problem: Permission Denied ?

Post by xieqing »

Thanks for the suggesstion. However,

sudo /mnt/e/Program_Files_Linux/code-saturne-install/CS-6.0.5/code_saturne-6.0.5/arch/Linux_x86_64/bin/code_saturne create -s test -c case1

still shows "Permission Denied"
Yvan Fournier
Posts: 3103
Joined: Mon Feb 20, 2012 3:25 pm

Re: What is the problem: Permission Denied ?

Post by Yvan Fournier »

Hello,

You should not need to run an application like code_saturne in sudo/root mode anyways.

I have only run a few tests unde the Windows subsystem for Linux, but have observed some quirks/fragilty in the Python scripts.

Are you running the code from a directory in the shared portion of the WSL (visible from Windows) or only in the part visible from the WSL ? How about the code_saturne install ?

SRC/REFERENCE is a directory in the new case being created, so if if fails in the portion visible from Windows, you may try in the WSL-only part (though is is not very satisfactory fo usage, it can help to understand what i wrong).

Also, are the other files and directories of the case such as DATA, SRC, RESU created correctly before this fails ?

Whitespace in directory names should be ok, but you might test without them, just in case. Accents in directory names might still be a problem for some mappings, so if you have whitespace or special characters in the directory you are running from, you might try without that.

Best regards,

Yvan
xieqing
Posts: 6
Joined: Fri Jun 26, 2020 10:10 am

Re: What is the problem: Permission Denied ?

Post by xieqing »

Hello Yvan,

In the previous failed run,
the error occurs before the directories RESU and SCRIPTS are created ( DATA is successfully created).
And there is NO whitespace in the directory names

I've installed code_saturne in the shared portion of the WSL, i.e., in /mnt/e/Program_Files_Linux/code-saturne-install/...

Follow your advice, I run the code again, without sudo, in the part ONLY visible from the WSL, i.e., in /home/...

This time it shows NO problem!

But I'm still wondering if it is possible to run in the shared portion of the WSL, i.e., in directories /mnt/...

Best regards,
Qing
Yvan Fournier
Posts: 3103
Joined: Mon Feb 20, 2012 3:25 pm

Re: What is the problem: Permission Denied ?

Post by Yvan Fournier »

Hello,

Did you try running with the installation in the WSL-only portion and the case in the portieon visible by Windows ?

Is this WLS or WSL2 ?

In any case, it should be possible to run in the part visible from Windows, so if it fails, we may need to fix a bug. It looks like the Python recursive copy does not work well on WSL in your case. That could be considered a Python bug, and might be fixed on other Python versions, but otherwise, we could probably adapt the scrips to use other functions than "shutil.copytree". to work around this bug.

Best regards,

Yvan
xieqing
Posts: 6
Joined: Fri Jun 26, 2020 10:10 am

Re: What is the problem: Permission Denied ?

Post by xieqing »

Hello Yvan,

I use WSL2

I've run more tests, and I think it should be the python 'shutil' problem.

First, I've checked that when the 'Permission Denied' appears,
the files in /.../usr/ have already been copied to directory SRC/REFERENCE

Second, I've tried to copy the files [DATA, RESU, SCRIPTS, SRC ] successfully created in directory /home/test/case1...
to the /mnt/test/case1..., then RUN code_saturne, and it succeeded and showed no problem.

So, the problem should be simply in the stage of creating the CASE directories and files


Best regards,
Qing
Post Reply