install command - SELinux warnings when SELinux is Enforcing
When SELinux is Enforcing
there are triggered some warnings when changing the context of the files installed with the install
command:
❄ [caubet_m-adm@merlin-l-002:/data/user/caubet_m-adm/Software/GIT/buildblocks/Tools/ANSYS]$ ./build 2021R2 --overlay=merlin_gpfs --update-modulefiles -f
overlay_name=merlin_gpfs
overlay_dir=/data/software/pmodules
opt_system=merlin_gpfs
ANSYS/2021R2: building ...
ANSYS/2021R2: start building ...
ANSYS/2021R2: preparing sources ...
ANSYS/2021R2: configuring ...
ANSYS/2021R2: compiling ...
ANSYS/2021R2: installing ...
ANSYS/2021R2: running post-installation for Linux ...
install: warning: /data/software/pmodules/Tools/ANSYS/2021R2/share/Tools/ANSYS/build: failed to change context to system_u:object_r:default_t:s0: Permission denied
install: warning: /data/software/pmodules/Tools/ANSYS/2021R2/share/Tools/ANSYS/modulefile: failed to change context to system_u:object_r:default_t:s0: Permission denied
ANSYS/2021R2: installing modulefile '/data/software/pmodules/Tools/modulefiles/ANSYS/2021R2' ...
install: warning: /data/software/pmodules/Tools/modulefiles/ANSYS/2021R2: failed to change context to system_u:object_r:default_t:s0: Permission denied
ANSYS/2021R2: Cleaning up '/var/tmp/caubet_m-adm/ANSYS-2021R2/build'...
ANSYS/2021R2: Cleaning up '/var/tmp/caubet_m-adm/ANSYS-2021R2/src'...
ANSYS/2021R2: Done ...
This only happens with files where owner has no write permissions: install
is changing permissions to 0444 prior to setting the context. This looks a wrong behavior of the install
command and the workaround would be by running install
by giving write permissions to the owner (install -m 0644 ...
), followed by a chmod 0444 ...
.
❄ [caubet_m-adm@merlin-l-002:/data/user/caubet_m-adm/Software/GIT/buildblocks/Tools/ANSYS]$ install -m 0644 build /data/software/pmodules/Tools/ANSYS/2021R2/share/Tools/ANSYS/build
❄ [caubet_m-adm@merlin-l-002:/data/user/caubet_m-adm/Software/GIT/buildblocks/Tools/ANSYS]$ ls -ltraZ /data/software/pmodules/Tools/ANSYS/2021R2/share/Tools/ANSYS/
drwxr-sr-x. caubet_m-adm svc-cluster_merlin6 unconfined_u:object_r:unlabeled_t:s0 ..
-r--r--r--. caubet_m-adm svc-cluster_merlin6 system_u:object_r:unlabeled_t:s0 modulefile
-rw-r--r--. caubet_m-adm svc-cluster_merlin6 unconfined_u:object_r:unlabeled_t:s0 dependencies
drwxr-sr-x. caubet_m-adm svc-cluster_merlin6 unconfined_u:object_r:unlabeled_t:s0 .
-rw-r--r--. caubet_m-adm svc-cluster_merlin6 system_u:object_r:default_t:s0 build
❄ [caubet_m-adm@merlin-l-002:/data/user/caubet_m-adm/Software/GIT/buildblocks/Tools/ANSYS]$ vim modulefile
❄ [caubet_m-adm@merlin-l-002:/data/user/caubet_m-adm/Software/GIT/buildblocks/Tools/ANSYS]$ install -m 0444 build /data/software/pmodules/Tools/ANSYS/2021R2/share/Tools/ANSYS/build
install: warning: /data/software/pmodules/Tools/ANSYS/2021R2/share/Tools/ANSYS/build: failed to change context to system_u:object_r:default_t:s0: Permission denied