grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grub2 sci-fi, the usb problem and the solution


From: adrian15
Subject: grub2 sci-fi, the usb problem and the solution
Date: Tue, 23 Jan 2007 18:27:31 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Science fiction part...
========================

        It is the 28th February 2009 and grub2 is stable enough and used on all
main linux distributions, as always Debian Stable uses grub legacy.

        The MDP* success has made that no one uses cdrom anymore and floppies
are a museum piece. adrian15 decides not working any more on Super Grub
Disk (Based on Grub Legacy) but working on a thing called Super Grub2
Disk. Marco_Gerards reads him on the irc and says: "You have been very
late on making your decision :)"

        So adrian15 tries to install this brand new thing: grub2 in a MDP (Read
a current USB drive)... and when he tries to implement the Boot Linux
option.** he sees that he can see the first hard disk partitions as the
second hard disk partitions. (He sees hd1 where usually it is hd0).
        Trying to boot its first hard disk (not the usb one) makes an error
about a not found partition!

        And then he remembers... yes... that's it. The BIOS sets the pendrive
as the first hard drive so grub2 sees it as hd0, and the first hard disk
is set as the second hard disk. Shit! I had the same problem with grub
legacy and they had not fixed it!!! What the hell have Marco Gerards,
Okuji and the other guys doing all these 2 long years? Ah, yes,
scripting, Hurd and Xen support!

Back to the reality...
==========================

Scenario: Every distro installer has decided that when booting a Linux
kernel root command should be run before the kernel and initrd commands,
that it means that gives problem when booting grub from a usb drive.

You boot grub from a usb drive, BIOS sets the usb drive as hd0.
You try to boot your linux distro in hda2 like this:
grub> configfile (hd1,1)/boot/grub/menu.lst
and after the timeout an error issues:
(hd0,1) partition does not exists.

Oh, yes, the usb pendrive only has one partition.

My solution for grub legacy is more or less (I need some advice if you
do not mind) this one:

1) Add a "preprocessor if" somewhere to see if we're going to build a
normal grub or a usb rescue grub.

# if defined(USB_RESCUE)
static const char *preset_menu = "usbshift\n";
# endif

I think that activates the preset menu or kind of.

Then usbshift command checks if grub is running from hd0,
if it is true it should do the following thing with map commands.

Before:
usb1 disk1 disk2 disk3 disk4 disk5
hd0  hd1   hd2   hd3   hd4   hd5
After:
disk1 disk2 disk3 disk4 disk5 usb1
hd0   hd1   hd2   hd3   hd4   hd5

then it should boot hd5 (last phisical hard disk) with these commands:
rootnoverify (hd5)
chainloader +1
boot

Now Boot Linux works perfectly.

Thoughts
==========

        As long as I know grub2 depends on BIOS naming for deciding which hard
diks is the first one or the second one or... so you have the same
problem as I do with usb drives (pretented to be rescue usb drives) that
have grub2 installed.

        You know that you can also have installed grub2 on a usb drive for
installing there a linux distro. (I mean this distro should work only
when hd0=usb drive.)

        If you want to install a Linux distro in a usb pendrive you have to use
the normal grub.

        If you want to install a Linux distro in a usb pendrive and being able
to use if as a rescue grub you have to use the normal grub patched so
that lets you run manually the usbshift command.



adrian15


*: Movable Data Pieces are these digital camera memory sticks that exist
 right now but with 1024 times its current storage. You insert it into
your pendrive (All the new pendrives have MDP slots) and you can read it
in any computer with usb support as a hard disk. Now the last Spanish
films (Spanish film industry has won the Hollywood industry.) are sold
in read-only MDPs. MDP are also very popular in portable media devices
like iphones.

**: Boot Linux option: Shows you the partitions on all your hard disk
where /boot/grub/grub2.cfg or /grub/grub2.cfg is found and tries to load
it when you select the desired partition. (SGD currently has a
equivalent option that works with menu.lst or grub.conf)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]