Chainloading from Grub2 to syslinux on a USB drive
Alright, what I thought would be a simple task has me tied in knots.
I wanted to make a multiboot USB flash drive that I could easily manipulate to switch to various distros easily. My plans were:
1. Partition my 8GB drive to one large first partition (5GB) so that windows could access it. (P.S. GParted didn't partition correctly, needed to use fdisk. THIS MIGHT BE IMPORTANT IN SOLVING THE PROBLEM BECAUSE THERE MIGHT BE A BLOCK ERROR). I then made an extended partition with 5 500MB logical partitions.
2. Install Grub2 to MBR from Ubuntu
3. Expand ISO's of varios distros (Acronis Recovery, Puppy linux, etc.)
to the partitions, and create syslinux.cfg files for each (from the isolinux.cfg files that were already there)
4. Install syslinux to each partition's boot sector
THE GRAND PROBLEM:
Grub2 loads, but when selecting what I want to boot, I get the error
which is syslinux, not grub2. So I know it's chainloading, but syslinux doesn't seem to find ldlinux.sys.
P.S. I'm not asking for other ways to make a multiboot drive, I know I can just direct boot from Grub2, but I want to be able to pass the boot to the boot loaders on the other logical partitions.
I found this page that someone has got this to work with a similar method:
I followed his instructions to no avail...
Maybe my bios is messed up and won't forward CHS information in a chain boot.
If I understand what you are trying to do you can test each procedure. Test one of your distros installed by itself and make sure it will boot on startup. That should eliminate any bios questions. I can not help because I still have problems building single distro usb live from scratch. It seems each one has its odd ways.
Well this howto you're referring to strikes me as a very messy one.
Another thing I don't get: why use Windows and GRUB4DOS to accomplish things which are easier to accomplish using native linux utils and from Linux itself?? Especially when all the thing is about booting various Linux distros?
Finally, why not try to use GRUB2 to boot directly from the ISO? That would take only 1 partition.This approach works fine for me to boot multiple distros without resorting to this highly suspectful configuration with multiple partitions on a USB drive, some of them even being logical discs...
OK, since you're set to stick to this idea, there is one thing you must try:
When you boot from the stick (after configuring your BIOS to boot from USB stick), you get into GRUB2 menu.
Good! Then you can press C to get into the GRUB prompt and from here you'll be able to actually see what can work and what can't.
So, in GRUB2 prompt you type `help`, which gives you the list of commands. You can print them out first from the online man page, though.
Then you have the `ls` command to list all available drives. OK, much better now!
Then you can `ls (hdX,Y)/` to see what's there on the drive. Just like searching the directory from BASH.
Thus you will be able to see which partitions are visible to your GRUB, and which (alas!) are not.
Once you make sure that ALL your partitions are visible to GRUB, that's a great relief.
Then try to issue your commands from your grub.cfg, but now from command line. You'll see which command fails. When you finally give your command `chainloader +1`(for example), GRUB will either swallow it, or give off error. If no error, the you type `boot` and see what happens. If it doesn't, then you'll have to spend I don't know how much time trying to figure out what is wrong with syslinux loader on the given partition...
then if nothing helps you can try the trick with installing syslinux into MBR and copying the bootsector into GRUB config folder and reinstall GRUB. It will point to the needed files on the partition to boot, given the partition is available to boot from.
But I must admit, the idea of booting from LOGICAL DISKS seems to be the most vulnerable point here. I never use logical disk even on HDD, let alone USB sticks, let alone making them bootable.
(And everything except Solaris and Windows XP can boot from a GPT partition. And one hardly needs Solaris on one of his GPT partitions, as the coolest feature of Solaris is their ZFS, which makes sense with really LARGE disks...)
BTW, since you have that great experience: is it possible to save boot sector of a *iso CD/DVD image? Or, alternatively, how can the boot image code be found on the CD? That would make multibooting from USB stick way easier to organize.
Alright, I actually got this to work.
There's a known bug that both grub legacy and grub 2 are affected by. They don't share CHS information with bootloaders that reside in logical partitions. There was a patch written back in 2008, but I don't have the patience to recompile grub.
Grub4DOS can do this becasue it's not affected by this bug. So I'm just using syslinux as the MBR bootloader (so I can retain CHS info), then chainloading to grub from syslinux, and then chainloading from grub4dos to all other partitions, and it works.
AFAIK an iso (CD/DVD) doesn't have any boot sector. An optical disk is made bootable with programs like isolinux http://syslinux.zytor.com/wiki/index.php/ISOLINUX. HTH.
<edit> Here http://www.dedoimedo.com/computers/kiwi.html is another nice article with lots of links </edit>
|All times are GMT -5. The time now is 07:04 AM.|