On Redhat6
chroot /install/netboot/rhels6.4/ppc64/compute/rootimg
ls /etc
adjtime group- lsvpd profile.d security
aliases gshadow magic protocols selinux
alternatives gshadow- makedev.d rc services
bashrc gssapi_mech.conf mke2fs.conf rc0.d sestatus.conf
.
..
echo $PATH
/opt/xcat/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
On Redhat7
[root@service-02 ~]# chroot /install/netboot/rhels6.4/ppc64/compute/rootimg
[root@service-02 /]# ls /etc
bash: ls: command not found
[root@service-02 /]# /bin/echo $PATH
/opt/xcat/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
What I notice is in the Redhat7 image /bin is not in the path. Is this something genimage needs to do for RHEL7? If I give the full path on RHEL7, it works
[root@service-02 /]# /bin/ls /etc
adjtime group- logrotate.d profile.d security
aliases gshadow lsvpd protocols selinux
.
.
.
I do notice on the RHEL7 MN before you chroot, the $PATH does not contain /bin
[root@service-02 bin]# echo $PATH
/opt/xcat/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
and when you say
[root@service-02 ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
the ls command is in /usr/bin on the machine which is in the path.
But in the image these commands like ls are not in /usr/bin, they are only in /bin and /bin is not in the path.
chroot /install/netboot/rhels6.4/ppc64/compute/rootimg
[root@service-02 bin]# /bin/pwd
/usr/bin
[root@service-02 bin]# /bin/ls ls
/bin/ls: cannot access ls: No such file or directory
I found the reason xdsh -i works when running under the daemon and not in bypass, is because running under the daemon /bin is added to the path.
[root@service-02 xCAT]# unset XCATBYPASS
Running under xcatd:
[root@service-02 xCAT]# xdsh -i /install/netboot/rhels6.4/ppc64/compute/rootimg 'echo $PATH'
compute-rhels6.4-ppc64: /opt/xcat/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/sbin:/usr/sbin:/bin:/usr/bin
Where as in XCATBYPASS mode /bin is missing and several other path differences.
Running in XCATBYPASS mode you get this path.
[root@service-02 xCAT]# xdsh -i /install/netboot/rhels6.4/ppc64/compute/rootimg '/bin/echo $PATH'
compute-rhels6.4-ppc64: /opt/xcat/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
chroot does not change environment variables, so the chrooted $PATH in the rootimage jail keeps the same as the value outside.
the $PATH on rh6 mn is effective for the rhels6.4 rootimage jail, but the $PATH on rh7 mn is invalid for the jail.