无法从 GRUB 2 启动 ISO

无法从 GRUB 2 启动 ISO

我在启动时遇到问题深入从 USB 中下载带有 GRUB 2 的 ISO 映像。我已经尝试修复这个问题将近一个星期了。以下是grub配置文件文件:

# GLEE USB GRUB2 Configuration

# Required with MBR for GUI
if [ "${grub_platform}" = "pc" ]; then
    insmod vbe
fi

# Required with EFI for GUI and to prevent "No video mode set" error
if [ "${grub_platform}" = "efi" ]; then
    insmod efi_gop
fi

# Keep the same graphic mode for kernel booting (passed as vga=)
# other values are "text" or any gfxmode value
set gfxpayload=keep

# Enable GUI
#GRUB_FONT=/boot/grub/fonts/unicode.pf2
if loadfont /boot/grub/fonts/unicode.pf2 ; then
    insmod gfxterm
    terminal_output gfxterm
fi

# EFI: special characters (lines composing menu frame)
# replaced by '?' in text _fallback_ text mode if absent
# (useless if gfxterm is not enabled or if GUI theme loading success)
#loadfont ascii

insmod png
set theme=${prefix}/themes/Vimix_+_Atomic/theme.txt

set isopath=/boot/iso
# Required to have these available in other configfile files
export theme
export isopath

# Menu!

if [ -e ${isopath}/antergos ]; then
    menuentry "Antergos >" --class antergos {
        configfile "${prefix}/inc-antergos.cfg"
    }
fi

if [ -e ${isopath}/antix ]; then
    menuentry "antiX >" --class antix {
        configfile "${prefix}/inc-antix.cfg"
    }
fi

if [ -e ${isopath}/arch ]; then
    menuentry "Arch Linux >" --class arch {
        configfile "${prefix}/inc-arch.cfg"
    }
fi

if [ -e ${isopath}/bodhi ]; then
    menuentry "Bodhi Linux >" --class bodhi {
        configfile "${prefix}/inc-bodhi.cfg"
    }
fi

if [ -e ${isopath}/centos ]; then
    menuentry "CentOS >" --class centos {
        configfile "${prefix}/inc-centos.cfg"
    }
fi

if [ -e ${isopath}/clonezilla ]; then
    menuentry "Clonezilla >" --class clonezilla {
        configfile "${prefix}/inc-clonezilla.cfg"
    }
fi

if [ -e ${isopath}/debian ]; then
    menuentry "Debian >" --class debian {
        configfile "${prefix}/inc-debian.cfg"
    }
fi

if [ -e ${isopath}/deepin ]; then
    menuentry "Deepin >" --class deepin {
        configfile "${prefix}/inc-deepin.cfg"
    }
fi

if [ -e ${isopath}/doudoulinux ]; then
    menuentry "DoudouLinux>" --class doudoulinux {
        configfile "${prefix}/inc-doudoulinux.cfg"
    }
fi

if [ -e ${isopath}/elementary ]; then
    menuentry "elementary OS >" --class elementary {
        configfile "${prefix}/inc-elementary.cfg"
    }
fi

if [ -e ${isopath}/fedora ]; then
    menuentry "Fedora >" --class fedora {
        configfile "${prefix}/inc-fedora.cfg"
    }
fi

if [ -e ${isopath}/gparted ]; then
    menuentry "GParted >" --class gparted {
        configfile "${prefix}/inc-gparted.cfg"
    }
fi

if [ -e ${isopath}/grml ]; then
    menuentry "Grml >" --class grml {
        configfile "${prefix}/inc-grml.cfg"
    }
fi

if [ -e ${isopath}/ipxe ]; then
    menuentry "iPXE >" --class ipxe {
        configfile "${prefix}/inc-ipxe.cfg"
    }
fi

if [ -e ${isopath}/kali ]; then
    menuentry "Kali >" --class kali {
        configfile "${prefix}/inc-kali.cfg"
    }
fi

if [ -e ${isopath}/linux-mint ]; then
    menuentry "Linux Mint >" --class linux-mint {
        configfile "${prefix}/inc-linux-mint.cfg"
    }
fi

if [ -e ${isopath}/manjaro ]; then
    menuentry "Manjaro >" --class manjaro {
        configfile "${prefix}/inc-manjaro.cfg"
    }
fi

if [ -e ${isopath}/netrunner ]; then
    menuentry "Netrunner >" --class netrunner {
        configfile "${prefix}/inc-netrunner.cfg"
    }
fi

if [ -e ${isopath}/porteus ]; then
    menuentry "Porteus >" --class porteus {
        configfile "${prefix}/inc-porteus.cfg"
    }
fi

if [ -e ${isopath}/rhel ]; then
    menuentry "Red Hat Enterprise Linux >" --class rhel {
        configfile "${prefix}/inc-rhel.cfg"
    }
fi

if [ -e ${isopath}/sabayon ]; then
    menuentry "Sabayon >" --class sabayon {
        configfile "${prefix}/inc-sabayon.cfg"
    }
fi

if [ -e ${isopath}/sysrescd ]; then
    menuentry "System RescueCD >" --class sysrescd {
        configfile "${prefix}/inc-sysrescd.cfg"
    }
fi

if [ -e ${isopath}/tails ]; then
    menuentry "Tails >" --class tails {
        configfile "${prefix}/inc-tails.cfg"
    }
fi

if [ -e ${isopath}/ubuntu ]; then
    menuentry "Ubuntu >" --class ubuntu {
        configfile "${prefix}/inc-ubuntu.cfg"
    }
fi

if [ -e ${isopath}/ubuntumate ]; then
    menuentry "Ubuntu MATE >" --class ubuntumate {
        configfile "${prefix}/inc-ubuntumate.cfg"
    }
fi

if [ -e ${isopath}/xubuntu ]; then
    menuentry "Xubuntu >" --class xubuntu {
        configfile "${prefix}/inc-xubuntu.cfg"
    }
fi

if [ -e /KERNEL ]; then
    menuentry "OpenELEC >" --class openelec {
        configfile "${prefix}/inc-openelec.cfg"
    }
fi

menuentry "Shutdown" --class shutdown {
  halt
}

menuentry "Restart" --class restart {
  reboot
}

现在我尝试启动的ISO镜像是“Deepin”,菜单项是:

if [ -e ${isopath}/deepin ]; then
menuentry "Deepin >" --class deepin {
  configfile "${prefix}/inc-deepin.cfg"
}
fi

这是配置文件inc-deepin.cfg

# Deepin
if cpuid -l; then
menuentry "Deepin Live 15.5 amd64" --class deepin {
    set isoname="deepin-15.5-amd64.iso"
    set isofile="${isopath}/deepin/${isoname}"
    echo "Using ${isoname}..."
    loopback loop $isofile
    linux (loop)/live/vmlinuz boot=live iso-scan/ask_second_pass=true findiso=${isofile}
    initrd (loop)/live/initrd.lz
}

这个设置适用于 Ubuntu 的 GRUB 2(已测试 3-4 次),它是 Ubuntu 自带的默认引导程序(我用它来测试问题是否出在脚本本身(通过将菜单项(Deepin)添加到目录中的 40_custom 文件中)/etc/grub.d

当使用上述设置通过 USB 启动时,会出现以下错误:

error: out of memory
error: syntax error
error: Incorrect command
error: syntax error

尝试使用 memdisk 启动时也会出现此错误。我该如何修复此问题?

我目前的想法是……

  1. 问题可能与大小或 RAM 无关。因为此设置在使用 Ubuntu 的 GRUB 进行测试时有效,但在使用 USB 启动 ISO 映像时失败。

  2. 由于 Deepin OS 基于Debian,我假设启动配置文件和Debian相同。

  3. 我在将 GRUB 安装到 USB 时使用了以下命令:

    GRUB_TARGET="--target=x86_64-efi --efi-directory=${MOUNT_POINT}
    --removable"
    
    GRUB2_INSTALL="grub2-install"
    
    MOUNT_POINT=/media/microsoft10/MMI
    
    PARTITION=/dev/sdb1
    
    sudo ${GRUB2_INSTALL} ${GRUB_TARGET}
    --boot-directory=${MOUNT_POINT}/boot ${PARTITION}
    

相关内容