Bug: 'modulespath' error at logon when using jailshell

Brian N

Member
Dec 28, 2021
12
1
3
United States
cPanel Access Level
Root Administrator
Environment: Alma Linux 8.5.latest, cPanel 94.0.23 LTS

Jailshell users get a minor error when logging into command line (ie using 'Terminal' or via SSH):
Code:
sed: can't read /usr/share/Modules/init/.modulespath: No such file or directory
The error is coming from this section of /etc/profile.d/scl-init.sh:
Code:
if [ "${MODULEPATH:-}" = "" ]; then
   MODULEPATH=`sed -n 's/[   #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' ${MODULESHOME}/init/.modulespath`
fi
The sed line is called because MODULEPATH is unset at runtime, and fails because /usr/share/Modules/init/.modulespath does, in fact, not exist. After logon, a jailshell user ends up with this in their environment:
Code:
MODULEPATH=/etc/scl/modulefiles:

When using the 'normal' shell (ie bash), MODULEPATH is set at runtime and thus that section is skipped and the error does not occur. In this case, they end up with this instead in their environment:
Code:
MODULEPATH=/etc/scl/modulefiles:/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles

I did some digging to try to find out where the difference lies but was unable to locate it. I'm guessing maybe some logon piece is missing somewhere from the jail environment, but the difference might lie in the jailshell binary itself.

As far as I've seen this doesn't seem to have any impact on normal use. I have had users ask about it though.

Thanks!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,360
1,628
363
cPanel Access Level
Root Administrator
Hey there! This is a known issue and was fixed in cPanel 98. At this time the team is not planning to backport this change to version 94, but if you update to a new tier, or wait for the next LTS, you'll see it's working normally.