kickstart from USB stick
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
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
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...
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.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
