W3tTr3y's blog

A personal technology focused blog

CentOS 7 USB Kickstart

While I really enjoy my current employment opportunity, servers are typically installed by students and we have several generations of servers all installed by different people, so there can be inconsistencies. Since our current servers distribution is not going to be supported by the vendor for much longer and we recently purchased 15 new servers, it seemed like the perfect opportunity to expand our use of configuration management (puppet in our case) and to introduce the idea of using Kickstart since we’re migrating to CentOS.

While I used Kickstart with Redhat, RHEL, Fedora, and CentOS at a previous position, that was over five years ago and was on a network with dhcp, tftp, and nfs servers. I’m currently in a security group with no dhcp, tftp or nfs servers, so I really wanted to find a way to do everything off of USB. Since that proved to be more challenging then I expected, I wanted to write up my solution so I could find it again and hopefully spare some one else some of the pain.

Naïve Attempts

The CentOS wiki suggests using dd to copythe iso to the usb drive:

1
dd if=CentOS-7.0-1406-x86_64-Everything.iso of=/dev/sdb

Based on that, my first (very naïve) attempts were to dd the iso over and then to try to re-partition the drive to create a partition in the spare space to hold the kickstart files. There’s still a part of me that feels there has to be a way to make this work, but I never got it to work.

Progress

In Feburary, I first posed the question to the SuperUser community and thankfully karlacio posted an answer yesterday (April 22, 2015) which referenced gist 4b9ad551cb6c35870d7c

My first deviation was I used labels so my syslinux.cfg had an append line like:

1
append initrd=initrd.img inst.stage2=hd:LABEL=DATA:/ ks=hd:LABEL=BOOT:/ks/laptop.cfg

EFI Support

While that worked great for systems with BIOSes, it failed to work on machines with EFI. After reading up some, I knew that the EFI folder would be required since EFI’s look for partitions with that folder instead of utilizing an MBR. So I copied the EFI folder from the ISO to the BOOT partition.

Similar to the syslinux.cfg file, I had to update EFI/BOOT/grub.cfg to refernce the updated location; this change was quite simple I just changed the search line to read:

1
search --no-floppy --set=root -l 'BOOT'

In looking at the grub.cfg file, I noticed that it referenced files under images, so I copied that DVD/images folder over to BOOT/images. In order to have room to copy the folder, I had to start over and make the first partition 530MB. You could go larger, but since I had two 8GB USB3 thumb drives, I didn’t want to waste too much space.

I was quite frustrated when that didn’t work, but I finally found mgorven’s answer which suggested creating BOOT/EFI/BOOT/startup.nsh which contained one line:

1
BOOTX64

Conclusion

Using this method I was able to create a usb-based installation media that booted on my MacBook Pro, our newer EFI based systems, and are older ones using BIOSes.

Update – 1/9/2016 – I was able to use this method to sucessfully create usb-based media for RHEL 7.