I am trying to build an installation image (to be transferred to USB media) for Red Hat Linux 7.4 with a custom kickstart file, and the corresponding ks=
argument added to grub, but and can't figure out how to do it.
Here are the approaches I have tried:
dd if=rhel-server-7.4-x86_64-dvd.iso of=/dev/sdb
This builds the a bootable USB stick, but of course without the kickstart file.
Next, I copied the content of the ISO to a temporary file, added my ks.cfg
and modified the grub configuration, and then used genisoimage
to rebuild a new image.
genisoimage \
-untranslated-filenames \
-rational-rock \
-v \
-translation-table \
-input-charset "default" \
-J \
-joliet-long \
$VOLLABELARGS
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-eltorito-alt-boot \
-efi-boot images/efiboot.img \
-no-emul-boot \
-o $THISDIR/$VOLLABEL.iso \
This is based on Red Hat's own instructions for RHEL 6 - I am, of course, using RHEL 7. This works for BIOS booting, but when I try it on the UEFI system, the resulting image is rejected as "not compatible".
The resulting image is also noticeably larger than the original RHEL ISO.
Examining it with xorriso
shows that it is also substantially different from the original. isohybrid
helps some, but not enough to make the image bootable.
The output of xorriso -report
on Red Hat's ISO:
xorriso -indev rhel-server-7.4-x86_64-dvd.iso -report_el_torito cmd
-volid 'RHEL-7.4 Server.x86_64'
-volume_date uuid '2017071101014600'
-boot_image isolinux system_area=--interval:imported_iso:0s-15s:zero_mbrpt,zero_gpt:'rhel-server-7.4-x86_64-boot.iso'
-boot_image any partition_cyl_align=on
-boot_image any partition_offset=0
-boot_image any partition_hd_cyl=64
-boot_image any partition_sec_hd=32
-boot_image any iso_mbr_part_type=0x00
-boot_image any cat_path='/isolinux/boot.cat'
-boot_image isolinux bin_path='/isolinux/isolinux.bin'
-boot_image any platform_id=0x00
-boot_image any emul_type=no_emulation
-boot_image any load_size=2048
-boot_image any boot_info_table=on
-boot_image any next
-boot_image any efi_path='/images/efiboot.img'
-boot_image any platform_id=0xef
-boot_image any emul_type=no_emulation
-boot_image any load_size=9211904
-boot_image isolinux partition_entry=gpt_basdat
And the output of xorriso
on my image:
xorriso -indev myimage.iso -report_el_torito cmd
-volid '"MYIMAGE"'
-volume_date uuid '2018011923504500'
-boot_image isolinux system_area=--interval:imported_iso:0s-15s:zero_mbrpt:'MYIMAGE.iso'
-boot_image any partition_cyl_align=on
-boot_image any partition_offset=0
-boot_image any partition_hd_cyl=64
-boot_image any partition_sec_hd=32
-boot_image any iso_mbr_part_type=0x17
-boot_image any cat_path='/isolinux/boot.cat'
-boot_image isolinux bin_path='/isolinux/isolinux.bin'
-boot_image any platform_id=0x00
-boot_image any emul_type=no_emulation
-boot_image any load_size=2048
-boot_image any boot_info_table=on
-boot_image any next
-boot_image any efi_path='/images/efiboot.img'
-boot_image any platform_id=0xef
-boot_image any emul_type=no_emulation
-boot_image any load_size=9211904
Comparing these two, Red Hat has a few GPT-related entries that my image is missing.
Other approaches I have looked at but am not even sure if I'm going off in the wrong direction with those.
Using lorax/livemedia-creator. I find the instructions quite confusing. It appears to be used to build a live image, but I can't figure out how to invoke Anaconda.
Format the USB stick as a standard three-partition hard drive. I can't figure out how to make this bootable, though.
What is the best/easiest way to accomplish what I want?
My requirements:
- Must be Linux command line; I want to script this process.
- Should generate an image file, I don't want to write directly to my USB script if I can avoid it.
- Should be able to run as non-root user.
The image file does not need to support CD/DVD booting.
man
page forgrub2-install
? (systutorials.com/docs/linux/man/8-grub2-install) There's an option:--efi-directory=DIR
that might be of use to you. I honestly think the route of installing grub on one partition and putting together a grub config is the easiest route when it comes to booting off USBs. I haven't had much luck finding a tool to do it for me.genisoimage
, it is full of well known bugs and unmaintained by the publishers. Better use the original softwaremkisofs
that has no known bugs and is maintained.