Kickstart installation from USB -- Kickstart location

Solution 1:

I was able to solve this by doing the following:

  • Place the kickstart file at the top of the isolinux directory and make sure it is named ks.cfg
  • my isolinux.cfg file looks like this:

    label linux
      menu label ^Install CentOS 7
      kernel vmlinuz
      append initrd=initrd.img inst.ks=hd:LABEL=CentOS\x207\x20x86_64:/isolinux/ks.cfg inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet
    

Using the drive label when referencing ks.cfg makes the resulting iso image more portable. (it can turned into a bootable USB drive)

Solution 2:

I've tried everything, but only this seems to work: put the ks.cfg inside the initrd. So the steps below extract initrd, add the ks.cfg in there, and recreate it. Tested with CentOS7

First mount the original .iso image on your pc, and copy its contents under tmp/

Then,

#Keep the original file
cp -ai tmp/isolinux/initrd.img initrd.img.orig
mkdir irmod
cd irmod

#Extract initrd in irmod/
xz -d < ../tmp/isolinux/initrd.img | cpio --extract --make-directories --no-absolute-filenames

#Add the ks.cfg in there
cp ../tmp/ks.cfg .

# Recreate the initrd.img inside isolinux/
find . | cpio -H newc --create | xz --format=lzma --compress --stdout > ../tmp/isolinux/initrd.img

#cleanup
cd ..
rm -r irmod

# Add  ks=file:/ks.cfg to the boot parameters in isolinux.cfg. you can do it by hand, this is an example for our own isolinux.cfg
sed -s -i 's|ks=.*ks\.cfg ksdevice=link|ks=file:/k1.cfg|' ../tmp/isolinux/isolinux.cfg ../isolinux.cfg

Then proceed with creating the image as usual:

cd tmp/

imgname="inaccess-centos7-ks1-v1.iso"
xorriso -as mkisofs -R -J -V "CentOS 7 x86_64" -o "../${imgname}" \
        -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4  \
        -boot-info-table -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin .
cd ..

Solution 3:

My favourite method is to use UUID, because it is stable.

I use two pendrive, first with the CentOS, second with kickstart. After save a kickstart on second pendrive I check its UUID in linux with blkid command: /dev/sdg1: UUID="885E:0BD1" TYPE="vfat"

And after that I use it in installation page: ks=hd:UUID=885E:0BD1:/ks.cfg

It really works!