kickstart from USB stick

Latest response

I am using cobbler to install a new red hat 5. (I know it is a bit old)
From the network , it is working perfectly.

I would like to use a USB stick
The USB stick is generated , the ks.cfg files are existing in the root folder as well as is in the isolinux one.

As a first step, I am using a VM (vmware workstation) before using the target HW

I have been looking around to find the right command line in the isolinux.cfg file but none of them worked .
I got an error message saying a kickstart not found

Any suggestions ?

I tried :

append initrd=initrd.img ks=hd:sdb1:/isolinux/ks.cfg ksdevice=bootif lang= text
or
append initrd=initrd.img ks=hd:sdb1:/ks.cfg ksdevice=bootif lang= kssendmac text
or
append initrd=initrd.img ks=hd:sda1:/isolinux/ks.cfg ksdevice=bootif lang= kssendmac text
or
append initrd=initrd.img ks=hd:sda1:/ks.cfg ksdevice=bootif lang= kssendmac text
or
append initrd=initrd.img ks=file:sda1:/isolinux/ks.cfg ksdevice=bootif lang= kssendmac text
or
append initrd=initrd.img ks=file:sda1:/ks.cfg ksdevice=bootif lang= kssendmac text
or
append initrd=initrd.img ks=file:sdb1:/ks.cfg ksdevice=bootif lang= kssendmac text
or
append initrd=initrd.img ks=hd:/dev/sda1:/ks.cfg ksdevice=bootif lang= kssendmac text

cheers

Responses

try plugging the USB stick to a linux machine and get its UUID by running blkid command for example we will choose UUID : aab69f8f-942a-464d-9664-66daa8862696 then add it like this append initrd=initrd.img ks=hd:UUID=aab69f8f-942a-464d-9664-66daa8862696:/ks.cfg ksdevice=bootif lang= kssendmac text

In addition to UUID, the partition label should also work. For example, a USB partition with a label of "OEMUSB" may be accessed for kickstart as follows.

ks=hd:LABEL=OEMUSB:/ks.cfg

I just tried ks=hd:LABEL=:/isolinux/.cfg but does not work does it mean the kickstart has to be named ks.cfg and put in the root directory of the USB stick ?

In that case how to use 2 different profiles/ks on the same USB stick

ks=hd:LABEL=:/isolinux/.cfg

This would mean that the system would be trying to find a kickstart file named /isolinux/.cfg from a filesystem that has a zero-length label.

Matching on a zero-length label might be impossible, as it is either unlikely to be unique (if the mount command in the installer environment allows the use of LABEL= syntax on all disks, an empty value might match all uninitialized disks) or flat-out impossible (if the mount command allows the LABEL= syntax only for disks with non-zero-length labels and considers a zero-length filesystem label as equivalent to "no label").

Specifically, on a VFAT/FAT32 filesystem (that is common on USB sticks), I don't think a zero-length label is possible: specifying a zero-length label should tell the labeling utility to remove any existing filesystem label altogether, and then the filesystem would not be mountable by the LABEL= attribute at all, only by device name or by the UUID= option of the mount command. I'm unsure if UUID= can be used in specifying the location of the kickstart configuration file or not.

If your USB stick is mountable as e.g. /dev/sdh1 on the system you're using to build it, you should be able to label it using a command like:

mlabel -i /dev/sdh1 ::OEMDRV

OEMDRV is a special volume label that allows auto-detection of driver disk image files (with a .dd suffix) at the root of the USB stick filesystem. If you don't need that feature, you can of course label the partition on your USB stick any way you like.

If you wish to include several kickstart configuration files on the same installation media, just write a menu with multiple alternative boot selections into the (iso|sys)linux.conf file, each with a different ks= option. For example, if the VFAT/FAT32 filesystem on the USB stick is labeled "OEMUSB" and the kickstart files are named ks1.cfgand ks2.cfg in the root directory of the USB stick, the first boot selection should have a ks= option like this:

ks=hd:LABEL=OEMUSB:/ks1.cfg

And the second boot selection should have:

ks=hd:LABEL=OEMUSB:/ks2.cfg

Thanks for the reply My fault when I copied the command line,

In fact the real command I used ks=hd:LABEL=(Mylabel ):/isolinux/(myname).cfg where Mylabel is the Label set for the USB stick and ckecked with the command : lsblk -o name,label and myname is the kickstart name

But did not worked +---------------------------------------------------------------------------------+ When I looked in the logs, I got "failed to make device node for /dev/LABEL=...." Then I tried ks=hd:sda1:/isolinux/(myname).cfg and I got "Cannot find kickstart file on hard drive" but obvioulsy it does exist and in the logs : "searching for file on path /tmp/mnt/isolinux/(myname).cfg"

I do not know how to fix that

+---------------------------------------------------------------------------------+ After reading your post, I understand 1) I can use any kickstart name 2) the kickstart have to be in the root directory , not in a folder such as isolinux ...right ? +---------------------------------------------------------------------------------+ The USB bootable has been done with the dd command when running fdisk -l , the partition is identified as an NTFS not a FAT32 ( size of the ISO = 8GB) The mlabel does not work

Sorry, I did not realize you were installing RHEL 5. I think the feature that allows the use of LABEL= in specifying the location of a kickstart file was introduced in RHEL 6, so no wonder it does not work for you.

Using NTFS explains why mlabel does not work.

On the other hand, if the kickstart file is in a folder (e.g. in /isolinux/ks1.cfg) then you should just specify that:

ks=hd:sda1:/isolinux/ks1.cfg

So your syntax looks correct now.

However, the problem is probably that you cannot always predict the order in which the system detects the built-in storage vs. the USB storage. Depending on various things (probably at least device ordering on the PCI bus and the probing order of various storage driver modules), some server models detect USB-storage before system disks, so your stick would be sda1... but others will detect the built-in SCSI/SAS/SATA controller first, and your USB stick might be sdb1 instead... or if the system has multiple internal disks and no real hardware RAID controller, it might be sdc1 or even higher.

The only way to be sure with RHEL 5 installer is to start the installer, and when it displays the "Cannot find kickstart file on hard drive" error, press Control-Alt-F2 to get a shell, and then do a cat /proc/partitions to see how this particular system orders its storage. Repeat with every new server model, and possibly with every different server configuration.

You can easily see why customizing an installation CD used to be preferred over installation from USB storage media with RHEL 5 and older...

I just tried but I cannot access the prompt by pressing Control-Alt-F2. I only get a black screen So I cannot tell which partitions could be used ... I suppose then I have to guess between sda1,sdb1,sdc1,... Any other option ?

By the way Is there anything special to put in the kickstart file itself (as per cdrom) when using an USB stick ?

installation CD should be prefered ... yes .. but there is not always a CD drive around

cheers

If you leave out the kickstart boot options, does the normal non-kickstart installation start successfully?

I dug up my old notes about setting up a RHEL 5.x Kickstart USB stick, and in RHEL 5.9 and above I hit the same problem you had: the ISO is more than 4 GB in size, so it's too big for FAT32. I ended up using ext2 filesystem on the USB stick instead.

I didn't write down my rationale for that at the time, but I seem to recall that the installer kernel + initrd had problems accessing a NTFS filesystem... I think the installer kernel either did not support NTFS at all, or the NTFS version written by a modern Windows system was too new for it. Since the bootloader handles loading the kernel & initrd, boot will be successful, but the installer kernel could not successfully mount a NTFS filesystem.

My notes do include the fact that the kernel within the RHEL 5.9+ diskboot.img is stripped down too far to successfully complete an installation from an USB media. I used the network boot kernel & initrd images instead (available at /images/pxeboot on the installation DVD image).

Instead of cdrom the beginning of your kickstart file should say something like:

install
harddrive --partition=sdb1 --dir=

Obviously, the partition specification on the harddrive line should match the partition device name the installation source (USB stick) gets when performing the installation. As I placed the ISO image at the root of the USB stick, I left the --dir= option with an empty value.

Also, if you use the clearpart keyword in your USB-based kickstart configuration, you'll have to be careful: the installer will happily erase the partition table of the USB stick too if given the chance. Keep a backup of your kickstart media when testing.

If the USB media is detected before the install destination disk, you'll also need a bootloader --driveorder= option, to reflect the fact that the USB media won't be there when the system will be booting on its own, i.e. whatever the destination disk is, it should be listed as the first disk in the --driveorder option since it will be the first when the system is booting on its own. (Its device name will then also be different from what it was at installation time, but as the installer builds /etc/fstab using the LABEL= keyword instead of explicit device names, that's not going to be a problem.)

For example, if your system has the USB stick detected as sda in the installer environment, and the destination disk as sdb, the kickstart boot option was ks=hd:sda1:/kickstart.cfg and the tricky lines in kickstart.cfg would be:

install
harddrive --partition=sda1 --dir=
[...]
bootloader --location=mbr --driveorder=sdb,sda
[...]
zerombr
clearpart --drives=sdb --linux
part /boot --fstype ext3 --size=100 --ondisk=sdb --asprimary
part pv.1 --size=100 --grow --ondisk=sdb --asprimary
volgroup vgsys --pesize=32768 pv.1
[...etc...]

And if you need to run a post-installation script that needs to access the installation media, here's how I did it on RHEL 5.x:

%post --nochroot
( mkdir /mnt/sysimage/mnt/instRHEL
for i in /dev/sd[a-z]1; do
  mount $i /mnt/sysimage/mnt/instRHEL
  if [ -f /mnt/sysimage/mnt/instRHEL/postinstall.sh ]; then
    echo "Install media: $i"
    break
  fi
  umount /mnt/sysimage/mnt/instRHEL
done
echo "Directory: $(pwd)"
echo "Install-time environment:"
env
echo "---end environment---"
chroot /mnt/sysimage /bin/bash /mnt/instRHEL/postinstall.sh
umount /mnt/sysimage/mnt/instRHEL
rmdir /mnt/sysimage/mnt/instRHEL
) >/mnt/sysimage/root/post_install.log 2>&1
%end

This will first create a mount point for the installation media within the newly installed system, mounts the installation media in there, logs some environment information for debugging purposes, and then executes /postinstall.sh from the installation media inside the newly installed system environment (using chroot). Once complete, it cleans up the mount. The log of these postinstall actions will be placed into /root/post_install.log on the installed system.

About your question "If you leave out the kickstart boot options, does the normal non-kickstart installation start successfully?" yes , it does

I will try as soon as possible your suggestions

Many thanks for your time and your detailed answer

cheers

Hi I have been working on different topics in the meantime but I have tried your suggestion recently Nevertheless I am blocked due to the message "Invalid media value (0x57)" connected to the message "can't find an ext2 file system dev sdb1" So I suppose I am not correctly creating my USB stick This is the way I proceed 1) My iso file is created base on the buildiso command from cobbler (which is using mkisofs command ) 2) and I use the dd command to build my bootable USB stick 3) and I am using fdisk on the corresponding device to set the partition type as Linux (=83) 4) I boot on the USB and I get the interface where I can choose the profile

obviously this is not right

What I do not get it the fact the procedure is starting .... in the log it seems to find the profile so it can read the USB stick somehow !

How did you proceed to create the bootable USB as an ext2 ? An other question you suggest to use

    harddrive --partition=sda1 --dir=

dir = Directory containing the RedHat directory of the installation tree No sure to understand What should the dir item be set to ?

cheers

Hi I built a USB including your suggestions as FAT32 and I tried to install the Redhat . But I got an error saying it is not an ext2 partition When I am using an USB defined in ext2 , I have an error saying it is not a FAT32 partition ! On theother hand, it seems it does find the kickstart file

I guess I am missing someting cheers Cheers

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.