Kev*_*ane 5 rhel kickstart uefi
我正在尝试使用自定义的 kickstart 文件为 Red Hat Linux 7.4 构建安装映像(将传输到 USB 介质),并将相应的参数ks=
添加到 grub 中,但无法弄清楚如何执行此操作。
以下是我尝试过的方法:
dd if=rhel-server-7.4-x86_64-dvd.iso of=/dev/sdb
Run Code Online (Sandbox Code Playgroud)
这将构建一个可启动的 USB 记忆棒,但当然没有 kickstart 文件。
接下来,我将 ISO 的内容复制到临时文件中,添加我的ks.cfg
并修改 grub 配置,然后用于genisoimage
重建新映像。
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 \
Run Code Online (Sandbox Code Playgroud)
这是基于 Red Hat 自己的 RHEL 6 说明 - 当然,我使用的是 RHEL 7。这适用于 BIOS 引导,但当我在 UEFI 系统上尝试它时,生成的映像因“不兼容”而被拒绝。
生成的图像也明显大于原始 RHEL ISO。
通过检查xorriso
发现它与原始版本也有很大不同。isohybrid
有一些帮助,但不足以使映像可启动。
xorriso -report
Red Hat 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
Run Code Online (Sandbox Code Playgroud)
xorriso
我的图像上的输出:
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
Run Code Online (Sandbox Code Playgroud)
比较这两个,Red Hat 有一些与 GPT 相关的条目,但我的图像丢失了。
我看过其他方法,但我什至不确定我是否走错了方向。
使用 lorax/livemedia-creator。我发现这些说明很混乱。它似乎用于构建实时图像,但我不知道如何调用 Anaconda。
将 USB 记忆棒格式化为标准的三分区硬盘驱动器。不过,我不知道如何使其可启动。
实现我想要的最好/最简单的方法是什么?
我的要求:
镜像文件不需要支持CD/DVD启动。
小智 1
现在有一种更简单的方法,可能适用于 RHEL/CentOS 和 Fedora ISO,因为它是lorax
RHEL 和 Fedora 最初用来构建其 ISO 的项目mkksiso的一部分。不过我只在 Fedora 32 上测试过。
我在测试时发现了一个错误;如果源 ISO 可在 UEFI 和 Mac 上启动,则新 ISO 只能在 Mac 和旧版 BIOS 系统上启动。此 PR已修复,但尚未发布,但它mkksiso
是一个简单的 Python 脚本,如果安装了其余部分,您可以单独下载lorax
。
注入 kickstart 现在非常简单:
sudo dnf install lorax
wget -cN https://raw.githubusercontent.com/weldr/lorax/master/src/sbin/mkksiso
chmod +x mkksiso
sudo ./mkksiso -V MyNewVolumeID path/to/kickstart path/to/orig.iso path/to/
Run Code Online (Sandbox Code Playgroud)
参见例如https://github.com/michel-slm/luks-kickstarts/blob/master/rebuild.sh