What are you trying to accomplish?
I tried to run fmriprep on rhel linux system. I keep getting an error of permission denied. Here is the code:
if [ $container == docker ]; then
fmriprep-docker $bids_root_dir $bids_root_dir/derivatives \
participant \
--participant-label $subj \
--skip-bids-validation \
--md-only-boilerplate \
--no-freesurfer \
--fs-license-file /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt \
--fs-no-reconall \
--no-submm-recon \
--output-spaces MNI152NLin2009cAsym:res-2 \
--ignore fieldmaps sbref \
--dummy-scans 0 \
--random--seed 123 \
--nthreads $nthreads \
--stop-on-first-crash \
--mem_mb $mem_mb \
--write-graph \
-w /home/chuanji/temp \
-u 1004
fi
Here is the error:
RUNNING: docker run --rm -it -e DOCKER_VERSION_8395080871=1.13.1 -u 1004 -v /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt:/opt/freesurfer/license.txt:ro -v /home/cluster/projects/ABC_AgingBrain:/data:ro -v /home/cluster/projects/ABC_AgingBrain/derivatives:/out -v /home/chuanji/temp:/scratch poldracklab/fmriprep:20.1.1 /data /out participant --participant-label 1003 --skip-bids-validation --md-only-boilerplate --no-freesurfer --fs-no-reconall --no-submm-recon --ignore fieldmaps sbref --dummy-scans 0 --random--seed 123 --nthreads 6 --stop-on-first-crash --mem_mb 5000 --write-graph -w /scratch --output-spaces MNI152NLin2009cAsym:res-2
Traceback (most recent call last):
File "/usr/local/miniconda/bin/fmriprep", line 6, in
from fmriprep.cli.run import main
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 4, in
from .. import config
File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/config.py", line 127, in
if _fs_home and (Path(_fs_home) / "license.txt").is_file():
File "/usr/local/miniconda/lib/python3.7/pathlib.py", line 1355, in is_file
return S_ISREG(self.stat().st_mode)
File "/usr/local/miniconda/lib/python3.7/pathlib.py", line 1151, in stat
return self._accessor.stat(self)
PermissionError: [Errno 13] Permission denied: '/opt/freesurfer/license.txt'
fMRIPrep: Please report errors to https://github.com/poldracklab/fmriprep/issues
What have you tried?
I have tried to search similar issues for this, but it seems none of them solve the problem that I have.
I have created the \derivatives dir (output dir) and intermediate results dir (/temp) before I run the script.
I have tried to add the user ID (-u 1004).
I don't understand why I still got the same error
I do not now why the program are trying to locate the license.txt file in /opt/freesurfer folder because
that folder does not exist. So I tried to copy the license.txt file there as a root user, but still did not fix the problem.
I also tried to run the script as a root user, I got the same error "permission error: permission denied: /opt/freesurfer
/license.txt'.
Thank you in advance for any help!
Maybe the file doesn't have proper read permission?
chmod a+r /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt
should do the trick.
Thanks for the advice. I have tried to run this command, as well as chmod a+rw /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt, and chmod a+r /home/cluster/projects/ABC_AgingBrain/derivatives/. I was able to execute the commands
without error or warning.
But I still got the same error when I tried to run fmriprep-docker script:
[Errno 13] Permission denied: '/opt/freesurfer/license.txt'
Any ideas about this?
Thank you!
Okay, how about trying out the following and pasting the output.
whoami && ls -l /home/cluster/projects/ABC_AgingBrain/derivatives/license.txtfmriprep-docker command, but with the --shell flag added. This will start an interactive session within the container. Then run whoami && ls -l /opt/freesurfer/license.txtThanks, when I run the whoami && ls -l /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt I got the output:
chuanji
-rw-r--rw-. 1 chuanji shinkarelab 57 Aug 22 18:26 /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt
Then when I run the fmriprep-docker with --shell flag added, I got:
RUNNING: docker run --rm -it -e DOCKER_VERSION_8395080871=1.13.1 -u 1004 -v /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt:/opt/freesurfer/license.txt:ro -v /home/cluster/projects/ABC_AgingBrain:/data:ro -v /home/cluster/projects/ABC_AgingBrain/derivatives:/out -v /home/chuanji/temp:/scratch --entrypoint=bash poldracklab/fmriprep:20.1.1
I have no name!@138e4566c1f6:/tmp$
Then I typed the whoami && ls -l /opt/freesurfer/license.txt, I got:
I have no name!@138e4566c1f6:/tmp$ whoami && ls -l /opt/freesurfer/license.txt
whoami: cannot find name for user ID 1004
When I remove the _-u 1004_ flag, and run the fmriprep-docker with --shell flage, I got:
RUNNING: docker run --rm -it -e DOCKER_VERSION_8395080871=1.13.1 -v /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt:/opt/freesurfer/license.txt:ro -v /home/cluster/projects/ABC_AgingBrain:/data:ro -v /home/cluster/projects/ABC_AgingBrain/derivatives:/out -v /home/chuanji/temp:/scratch --entrypoint=bash poldracklab/fmriprep:20.1.1
root@8cbf2e04110f:/tmp#
Then I typed the whoami && ls -l /opt/freesurfer/license.txt, I got:
ls: cannot access '/opt/freesurfer/license.txt': Permission denied
When I typed id in the command window, I got:
uid=1004(chuanji) gid=1004(chuanji) groups=1004(chuanji),10(wheel),1006(shinkarelab),1011(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
Thanks again for any suggestions.
i'm not optimistic, but you could try chown chuanji:chuanji /home/cluster/projects/ABC_AgingBrain/derivatives/license.txt.
Otherwise, it seems RHEL has some baked in security with docker, you could try temporarily disabling it and seeing if that helps (https://stackoverflow.com/a/63236291)
It is exactly the RHEL security that you mentioned. After I changed the config file (disable the selinux), the fmriprep starts running successfully now! Thank you so much!
Great, glad you got it working!