LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-23-2011, 07:41 PM   #1
Yotefn
LQ Newbie
 
Registered: Mar 2011
Posts: 3

Rep: Reputation: 0
Question 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

Code:
#syslinux /dev/sdb5...
5. make grub.cfg on /dev/sdb1 chainload each partition.

THE GRAND PROBLEM:

Grub2 loads, but when selecting what I want to boot, I get the error

Boot error

which is syslinux, not grub2. So I know it's chainloading, but syslinux doesn't seem to find ldlinux.sys.

Any ideas?

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.
 
Old 03-24-2011, 05:39 PM   #2
Yotefn
LQ Newbie
 
Registered: Mar 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Anybody?

I found this page that someone has got this to work with a similar method:

http://comptb.cects.com/67-multi-boo...x-and-grub4dos

I followed his instructions to no avail...
Maybe my bios is messed up and won't forward CHS information in a chain boot.
 
Old 03-24-2011, 06:00 PM   #3
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
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.
 
Old 03-24-2011, 08:10 PM   #4
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 172
Blog Entries: 5

Rep: Reputation: 17
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.
 
Old 03-28-2011, 03:39 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,675

Rep: Reputation: Disabled
Quote:
Originally Posted by kostya View Post
...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.
I do that since the paleolithic at least . No honestly, no problem at all with that. And Linux does need no bootable flag at all. "fdisk" even complained recently that I should cease and desist with this deprecated cr*p (it found an old flag on a disk I just wanted to reorganize...). For win* you can use GRUB's "map" and or "hide" command(s) to tell it which partition is "C:\"

Last edited by JZL240I-U; 03-28-2011 at 03:41 AM.
 
Old 03-29-2011, 06:28 AM   #6
kostya
Member
 
Registered: Mar 2010
Location: Moscow, Russia
Distribution: Ubuntu Studio, antix(mepis), Fedora, FreeBSD
Posts: 172
Blog Entries: 5

Rep: Reputation: 17
Quote:
Originally Posted by JZL240I-U View Post
I do that since the paleolithic at least . No honestly, no problem at all with that.
Really? Well for you. Well I got done with logical disks after I changed my big HDD partition table into GPT. Just read about it online and liked the idea right away; and also I'm a great fan of new technologies, so I do it all rather for the fun of it, than for real necessity... So now I can have as many primary partitions as I like. Cool!
(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...)
Quote:
And Linux does need no bootable flag at all. "fdisk" even complained recently that I should cease and desist with this deprecated cr*p (it found an old flag on a disk I just wanted to reorganize...). For win* you can use GRUB's "map" and or "hide" command(s) to tell it which partition is "C:\"
Yeah, GRUB is cool. It took me about 1 year to get used to it, but then I understood its advantages. Meantime the developers made it more usable... And GRUB2 is even cooler than GRUB legacy. It can even boot from an ISO mapping a loopback mounted image to a "drive". Instead of "find" command it has "ls" command, which is more handy when you're booting from the prompt and are not sure about the name of the kernel image, which can be something like "vmlinuz-image-generic-2.6.38.22-2.fc13.i686.img" and you just didn't look it up before your bootloader crashed. And the grub "find" command doesn't support wildcards .

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.

Last edited by kostya; 03-29-2011 at 06:36 AM.
 
Old 03-29-2011, 09:32 AM   #7
Yotefn
LQ Newbie
 
Registered: Mar 2011
Posts: 3

Original Poster
Rep: Reputation: 0
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.

http://bugs.gentoo.org/230905

BUT....

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.
 
Old 04-04-2011, 04:15 AM   #8
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,675

Rep: Reputation: Disabled
Quote:
Originally Posted by kostya View Post
...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.
I'm not really experienced, I just like to learn and so my number of posts is just due to lots of curious questions .

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>

Last edited by JZL240I-U; 04-04-2011 at 06:10 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] chainloading with grub and grub2 houndhen Linux - General 3 12-20-2010 01:39 PM
Need help with chainloading grub2 for a multiboot setup streams &dragonflies Linux - General 2 11-24-2010 03:47 PM
Booting different partitions on a usb drive with syslinux narnie Linux - Software 4 03-22-2010 04:05 PM
GRUB chainloading a logical partition installed with SYSLINUX whho Linux - Software 5 07-11-2009 10:40 PM
syslinux error on USB flash drive downinthemine Linux - Distributions 3 12-12-2004 08:00 PM


All times are GMT -5. The time now is 08:05 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration