How do I chain boot from grub to syslinux?
I am expanding my rescue usb flash disk. The USB's partition is bootable, and I have installed GRUB to the MBR of the jump drive. It works pretty well - I can boot Freedos and run some utilities,and I can boot PING.
I would like to add the Ubuntu 9.10 LiveCD to this rescue usb drive. I have a working jumpdrive, so I can pretty easily copy over the files. I could hunt down the needed menu.lst
entries needed for GRUB, but the Ubuntu LiveUSB uses a fairly complicated syslinux configuration. Besides, I would like to keep as much of the current LiveCD/LiveUSB look-n-feel without porting the syslinux config over to GRUB.
At the suggestion of ~quack I tried a menu.lst
entry of:
title Ubuntu 9.10 LiveCD
root=(hd0,0)
kernel /ubuntu-9.10/syslinux/isolinux.bin
but GRUB responded with an Error 13: Invalid or unsupported executable format
. At the GRUB commandline I then tried:
grub> root=(hd0,0)
grub> kernel /syslinux/isolinux.bin
because I have a second isolinux.bin
file in that location, but GRUB responded with the same error. I also tried:
grub> chainloader /syslinux/isolinux.bin
and once again received the Error 13. Finally, I tried at the GRUB command line:
grub> root=(hd0,0)
grub> kernel /ubuntu-9.10/install/mt86plus
grub> boot
and that worked
What I would really like is a way to have GRUB call syslinux/isolinux bootloader. Then syslinux could load its own menu and whatnot.
Anyone know how to do this?
Solution 1:
Update: Based on your entry, I found the article "Grub chainloads syslinux and back", which basically says "patch grub":
Chainloading syslinux from GRUB seems not to be possible without a patch. I don't know about GRUB2. This could be useful for multi-booting (syslinux-based) partitions.
Chainloading syslinux from GRUB4dos (on different partitions) is possible. I managed it through the mapping, explained (again) here. It solves some problems in multi-booting usb devices.
The patch page mentions a similar patch was posted to grub-devel for Grub v2; this post may be that patch. Or this message, which points to this bug report (dated Nov.2009, so it's very recent) for a Grub v2 patch.
To use one of the patches, you'd need to download the Grub source code for your preferred Grub version, check that it doesn't include the patch already, try applying the patch, and recompile and reinstall your new Grub.
Original answer:
I'd try testing a simple Grub entry first. This is a standard Grub entry for the Memtest86+ utility on a Debian system:
title Debian, memtest86+
root (hd0,0)
kernel /boot/memtest86+.bin
Just try tweaking those with your values (change the root partition or kernel path as necessary):
title Ubuntu LiveUSB SysLinux boot
root (hd0,0)
kernel /syslinux/isolinux.bin
I don't think you'd need the chainloader+
command for this task.
Solution 2:
title UBUNTU 9.1 ISO Boot
find --set-root /ubuntu9.1.iso
map /ubuntu9.1.iso (hd32)
map --hook
root (hd32)
chainloader (hd32)
add this to ur menu.lst, and copy ubuntu9.1.iso to the drive on which menu.lst exists.
Solution 3:
You can definitely chainload syslinux easily from grub2. The easiest and most general way would be:
Hit 'c' at the grub menu to get a command line.
set root='hd1,msdos1'
chainloader +1
boot
where 'hd1,msdos1' is a common-enough value booting off USB, but you can search most filesystems with ls
, e.g., ls (hd1,msdos1)
will tell you about the part, then ls (hd1,msdos1)/
will show you files. If it's a filesystem that grub normal
doesn't recognize, then you may have to install an fs module with insmod
. You can use grub's search
command to find it. search --no-floppy --set=root
However, you likely don't need to chainload syslinux (or anything else). grub is flexible. For example, on my alpine USB stick, I often just do this:
set root='hd2,msdos1'
configfile /boot/grub/grub.cfg
Which goes right into a menu. Of course, that's with a grub cfg on it. You can also manually setup the boot from grub w/o syslinux or grub on the disk.
set root='hd2,msdos1' # or search...
linux /boot/vmlinuz
initrd /boot/initramfs
For me, I can even do something like this on my Xen'd up Alpine USB stick
multiboot2 /boot/xen.gz
module2 /boot/vmlinuz-vanilla modules=loop,squashfs,sd-mod,usb-storage
module2 /boot/initramfs-vanilla
But, that's basically what's in the /boot/grub.cfg
that seems to come with Alpine now. The point is that it could point do different and varying OS, initramfs and kernels. I think you can also directly load the syslinux binary with chainloader $path_to_bin
and my grub actually has a syslinux_configfile
and syslinux_source
commands, so this seems to work, too:
syslinux_source /boot/syslinux.bin
syslinux_configfile /boot/syslinux/syslinux.cfg
Hope one of those works for you. Learning my way around grub has been a life-saver so many times. I have saved a linux install with a corrupt config or a moved/changed HDD on a remote machine in Amsterdam from the US by hitting grub-rescue> over serial and loading modules off the existing HDD and booting into the old partition/OS in order to fix/reconfigure it.