CentOS grub2 通过环回启动 iso

CentOS grub2 通过环回启动 iso

我有一个 USB 密钥设置来多重启动不同的 Linux 映像。我正在尝试添加 CentOS,这是发布类似条目为了grub.cfg

set drive_label=multipass01
set isopath=/iso

menuentry "CentOS-6.3-x86_64-LiveCD" {

# Tried the following root designations;
# root=live:LABEL="multipass01" 
# root=live:LABEL=multipass01 
# root=live:LABEL="multipass01":$isofile
# root=live:LABEL=multipass01:$isofile
# root=live:/dev/disk/by-label/$drive_label$isofile
# root=live:UUID=3A55-12BC:$isofile
# root=live:UUID=:$isofile
# root=UUID=3A55-12BC
# root=live:$isofile
# iso-scan/filename=$isofile

    set isofile="$isopath/CentOS-6.3-x86_64-LiveCD.iso"
    loopback loop $isofile
    linux (loop)/isolinux/vmlinuz0 boot=isolinux root=live:LABEL=multipass01:$isofile rootfstype=auto ro liveimg 3 rhgb rd.luks=0 rd.md=0 rd.dm=0 splash --
    initrd (loop)/isolinux/initrd0.img
}

这是尝试启动此条目的结果(无论哪个root=);

内核恐慌

编辑;相关的 Fedora 错误

答案1

我尝试了与你相同的方法(但liveos对我来说是Fedora 17),我也失败了,我们不能使用isofile作为root=live:选项。root=live:LABEL=multipass01:$isofile无法识别(也许在以后的修复中可以识别,但我等不及了)。

所以我使用了不同的方法:

#step 1 create a blank partition that can hold the liveos.(/dev/sdb5)

#step 2 copy the liveos to the partition
dd if=/my-path-to-f17-live-iso of=/dev/sdb5

#step 3 change the grub.cfg,
#note1: don't need to use loopback, just use (hdX,Y).
#note2: "root=" becomes "root=live:/dev/sdb5"
menuentry 'F17 install' --class fedora --class gnu-linux --class gnu --class os {
    insmod part_msdos
    linux (hd1,5)/isolinux/vmlinuz0 linux root=live:/dev/sdb5 rootfstype=auto ro liveimg rd.luks=0 rd.md=0 rd.dm=0 
    initrd (hd1,5)/isolinux/initrd0.img
}

你也可以尝试这种方法,/dev/sdb5在这种方法中充当CD/DVD-ROM。

另一种方法是更改​​ python 脚本以dracut使其识别此类选项,但我认为不值得。

答案2

像这样

menuentry "CentOS-7.0-1406-x86_64-DVD" {
    set root='hd1,msdos1'
    set isofile='/CentOS-7.0-1406-x86_64-DVD.iso'
    loopback loop $isofile
    linux (loop)/isolinux/vmlinuz noeject inst.stage2=hd:/dev/vdb1:$isofile
    initrd (loop)/isolinux/initrd.img
}

答案3

也未能找到可行的答案。但现在看来已经实施了。

邮政提到了一个在 dracut 中实现所述功能的提交(这就是你想要的)。

请记住 root= 选项是核心命令行参数:

root=       [KNL] Root filesystem
        See name_to_dev_t comment in init/do_mounts.c.

为了使这些类型的设置起作用,您必须查看 initramfs 基础设施内部并查看是否支持。 (即作为 root 使用的内核安装 .iso 显然不是内核任务?)

如果您查看第 38 条及之后的注释,您将看到某种分步说明。我现在要亲自测试一下。

编辑:这对于 Centos 6.4 来说是行不通的:/ 它有一个古代版本的dracut

相关内容