I have a problem when booting a Deepin ISO image with GRUB 2 from USB. I have been trying to fix the problem for almost a week now. Here is the grub.cfg file:
# 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
}
Now, the ISO image I am trying to boot is "Deepin", and the menuentry is:
if [ -e ${isopath}/deepin ]; then
menuentry "Deepin >" --class deepin {
configfile "${prefix}/inc-deepin.cfg"
}
fi
Here is the configuration file for 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
}
This setup works (tested 3-4 times already) with Ubuntu's GRUB 2, which is the default bootloader that comes with Ubuntu (I used this to test if the problem is with the script itself or not (by adding the menuentry (Deepin) to 40_custom file in directory /etc/grub.d.)
When the above setup is used with booting on USB, it spits out the error below:
error: out of memory
error: syntax error
error: Incorrect command
error: syntax error
This error also occurs when trying to boot with memdisk. How can I fix this?
What I think so far...
The problem may not be related to the size or the RAM. As this setup works when using Ubuntu's GRUB for testing and fail when using with USB to boot the ISO image.
As Deepin OS is based on Debian, I assume the booting configuration file is the same with Debian.
I used this command when installing GRUB to 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}