After managing to get a Fedora ISO to rebuild successfully (for a USB stick) after adding a kickstart file (https://serverfault.com/questions/548405/), I now have an issue with locating the kickstart file on the USB media.

When this is done from a CDROM you can simply kickckstart by adding this parameter to boot:

linux ks=cdrom

This will kickstart (providing the kickstart file is named ks.cfg and is in the root of the disk).

Now, obviously this will be different for the USB drive, so from my research, I assumed that this line would do the job:

linux ks=hd:sdb1:/ks.cfg

Evidently this does not work. I get an error informing me this drive is already mounted and cannot be remounted.

EDIT: Actual error message:

mount: /dev/sdb1 is already mounted or /run/install/tmpmnt0 busy
Warning: Can't get kickstart from /dev/sdb1:/ks.cfg

To test that the syntax was correct I placed the kickstart file on another USB stick and loaded the same command to grab ks.cfg from the new location:

linux ks=hd:sdc1:/ks.cfg

This does work (providing USB sticks are mounted in order, boot -> sdb1, kickstart -> sdc1). The install will kickstart and complete the install with no issue. Obviously having to use 2 pen drives is somewhat frustrating and unreliable.

Is there a way around this?

  • You did try ks=cdrom, right? – Michael Hampton Nov 3 '13 at 23:10
  • Yes I have done, but it does not find the kickstart file. – dooffas Nov 4 '13 at 9:38
  • have you tried linux ks=hd:sbd1/ks.cfg ? – Archemar Dec 24 '14 at 9:04
  • The steps outlined here are the ones I used to build my USB key. – Vitalii Sep 15 '17 at 11:33

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/


#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

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/

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 ..
  • This is much the same as I did in the linked article (Rebuild Fedora 19 ISO adding Kickstart for USB install). Thanks for your reply. – dooffas Apr 16 '15 at 8:49

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)

  • That solved my problem. I would also add that the grub.cfg has to be changed in case you use EFI. – Adonist Feb 23 at 17:22

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!


You have to point to /sda1 because when you boot from USB sda is the USB, sdb is the first hard disk and so on

  • no, it's not always like that. – sivann Dec 23 '14 at 15:40

Now you have one partition on the USB stick of size of the ISO image. Just create another partition on the USB stick using the rest space, format it and place your kickstart files there.

UPD: try fdisk, since parted seems to be not working this case.

UPD1: iso must be receated with xorriso

UPD2: see https://serverfault.com/a/551307/134234

  • I have also tried this, please see my other post: serverfault.com/questions/549158 – dooffas Nov 4 '13 at 11:24
  • @dooffas I saw It, you was not lucky with gparted. Did you really try fdisk? I recreated you case with lvm volume and at least fdisk created the second partition successuly. – Veniamin Nov 4 '13 at 18:55
  • I did try fdisk, however it does not read the partition table correctly. It thinks that the partition that holds the Fedora image takes up almost 8GB, which is not true. It appears that writing the fedora image to the drive corrupts the partition table. – dooffas Nov 5 '13 at 11:38
  • @dooffas Sorry, in my lab I recreated iso with xorriso but forgot to note It. Please find my updates. – Veniamin Nov 7 '13 at 9:25
  • this doesn't work. even after creating partitions, the whole disk is mounted by the installer, and partitions cannot be used. – sivann Dec 23 '14 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.