OpenHPC:fixes
Preshell/Postshell fix
- Identify the bootstrap that the relevant node is using, from the node's MAC address (for example fa:16:3e:cc:30:e3):
[root@ohpc-head ~]# ls /var/lib/tftpboot/warewulf/pxelinux.cfg/
01-fa-16-3e-34-14-bd 01-fa-16-3e-8f-2c-f2 01-fa-16-3e-fc-44-6d
01-fa-16-3e-3c-75-21 01-fa-16-3e-cc-30-e3
[root@ohpc-head ~]# cat /var/lib/tftpboot/warewulf/pxelinux.cfg/01-fa-16-3e-cc-30-e3
# Configuration for Warewulf node: caas01
# Warewulf data store ID: 18
DEFAULT bootstrap
LABEL bootlocal
LOCALBOOT 0
LABEL bootstrap
SAY Now booting caas01 with Warewulf bootstrap (3.10.0-327.22.2.el7.x86_64)
KERNEL bootstrap/11/kernel
APPEND ro initrd=bootstrap/11/initfs.gz wwhostname=caas01 quiet wwmaster=10.16.0.150 wwipaddr=10.16.0.151 wwnetmask=255.255.255.0 wwnetdev=eth0 wwgateway=10.16.0.150In the KERNEL and APPEND values we can see that it's using bootstrap 11
- We now need to unzip and uncompress the initfs image of this bootstrap to a temp directory:
[root@ohpc-head ~]# mkdir /tmp/initfs-dir
[root@ohpc-head ~]# ls /var/lib/tftpboot/warewulf/bootstrap/11/
cookie initfs.gz kernel
[root@ohpc-head ~]# cp /var/lib/tftpboot/warewulf/bootstrap/11/initfs.gz /tmp/initfs-dir/
[root@ohpc-head ~]# cd /tmp/initfs-dir/
[root@ohpc-head initfs-dir]# gunzip initfs.gz
[root@ohpc-head initfs-dir]# ls
initfs
[root@ohpc-head initfs-dir]# mkdir uncompressed
[root@ohpc-head initfs-dir]# cd uncompressed/
[root@ohpc-head uncompressed]# cat ../initfs | cpio -i
113303 blocks
[root@ohpc-head uncompressed]# ls
bin dev etc init lib lib64 proc sbin tmp usr var warewulf- Change the relevant lines in /init:
@@ -240,7 +240,7 @@
if [ $WWDEBUG -ge 3 ]; then
echo
echo "Spawning a debug shell. Exit to continue provisioning."
- setsid cttyhack sh
+ setsid /bin/cttyhack /bin/sh
echo "Continuing provisioning process."
echo
fi
@@ -317,7 +317,7 @@
echo "due to the 'preshell' Warewulf node configuration... So be it!"
echo
wwlogger "PRESHELL defined, waiting for local shell to exit"
- setsid cttyhack sh
+ setsid /bin/cttyhack /bin/sh
fi
wwlogger "Starting the provision handler"
@@ -331,7 +331,7 @@
echo "due to the 'postshell' Warewulf node configuration... So be it!"
echo
wwlogger "POSTSHELL defined, waiting for local shell to exit"
- setsid cttyhack sh
+ setsid /bin/cttyhack /bin/sh
fi- Change the relevant line in etc/functions:
@@ -160,5 +160,5 @@
echo "Spawning a debug shell."
echo "System will reboot automatically when you close the shell."
echo
rm /reboot
- setsid cttyhack sh
+ setsid /bin/cttyhack /bin/sh
wwlogger "Node rebooting"- Compress the initfs back:
[root@ohpc-head uncompressed]# find ./* | cpio -o -c > ../initfs
113303 blocks
[root@ohpc-head uncompressed]# cd ..
[root@ohpc-head initfs-dir]# ls
initfs uncompressed
[root@ohpc-head initfs-dir]# gzip initfs
[root@ohpc-head initfs-dir]# ls
initfs.gz uncompressed- Finally copy the compresses initfs.gz back to its original location:
[root@ohpc-head initfs-dir]# cp initfs.gz /var/lib/tftpboot/warewulf/bootstrap/11/- Reboot the relevant node and if you've set its provision POSTSHELL and/or PRESHELL arguments to TRUE then the shells will work fine