Modifying the initrd.img to run additional binaries in a PXE booted RHEL 6

pxe-bootrhel6

I am trying to add additional automation to our existing RHEL 6 (or Oralce's implementation thereof) PXE install process by running a script in the %pre section of my kickstart config that call hpacucli, HP's raid device configuration binary.

My approach has been to modify the PXE served initrd.img. I've unpacked the initrd.img and copied in the required libraries, binaries, and scripts but when the system boots using the modified initrd.img, the modified /lib (and /lib_64) are moved aside to /lib_old and /lib is linked to the /mnt/runtime/lib. How can I change this configuration so that the /lib is not moved (unlikely) or required libraries are available in the runtime /mnt/runtime/lib?

To test and confirm this I've been able to get the install process to move to the 6th virtual console, which allows me to see errors, and then open a shell (a useful debugging mechanism).

%pre
exec  /dev/tty6 2> /dev/tty6
chvt 6

/bin/sh

Best Answer

After several tries, I stopped looking to google or documentation I could not vouch for and started reading logs, which brought me to the solution.

In the PXE install process, the initrd.img bootstraps the process, anaconda consults the kickstart script, pulls down the install image, starts 'stage2' and mounts the fetched install.img on /mnt/runtime, which moves lib, lib_64, and usr aside and links in the corresponding directories in /mnt/runtime, and then launches the now local /usr/bin/anaconda. This is evident in the /tmp/anaconda.log which I could reach in my paused install process, outlined above.

I solved my problem by updating the install.img with the libraries I needed. This means the entire process requires modifying two images, the intitrd.img for the scripts, directories, and binaries that I needed to make hpacucli work, and the install.img to add the libraries to the lib that would exist after the install.img was mounted. I am sure there are other solutions, this seemed the least intrusive.

If there are other hpacucli pre-install users out there looking for answers, I can post the entire setup.