LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Running GRUB at its prompter (https://www.linuxquestions.org/questions/linux-general-1/running-grub-at-its-prompter-364273/)

grautu 09-17-2005 02:05 PM

Running GRUB at its prompter
 
Hi to all!
PROBLEM: To load various installed OSs by a GRUB loader which is installed in MBR but does not know where to load from. So, just after booting attempt, the user will get the "grub> " prompt and should provide GRUB with needed information, at command line.
REFERENCE: Chapter 4 of GRUB manual at <http://www.gnu.org/software/grub/manual/grub.html>.
WHAT DOES WORK FINE: Loading unsupported OSs (such as Windows) according to manual's recipe at Section 4.1.2
Code:

grub> rootnoverify (hd0,0)
grub> makeactive
grub> chainloader +1
grub> boot

WHAT FAILS TO WORK: Loading Linux OSs according to manual's recipe at Section 4.1.1
Code:

grub> root (hd0,1)
grub> kernel /vmlinuz-2.4.27-2-386 root=/dev/hda5 ro
grub> boot

In my setting, (hd0,1) is the primary /boot partition while /dev/hda5 is an extended partition containing the root / , a swap, a /home etc).
WHAT THE ERROR MESSAGE IS: The "grub> boot" command does launch the boot process but that process stops after a while with the following message
Code:

VFS: Cannot open root device "hda5" or 03:05
Please append a correct "root=" boot option
Kernel panic: VFS: Unable to mount root fs on 03:05

OTHER USERS-THE SAME UNSOLVED PROBLEM: See <http://www.linuxquestions.org/questi...=&threadid=559>.

Any idea (on how to load Linux OSs at "grub> " prompt) would be gratefully appreciated.

bigrigdriver 09-17-2005 08:37 PM

If your /dev/hda5 is an extended partition, with root /, swap, and /home partitions inside the extended partition, then root / is probably /dev/hda6, swap is probably /dev/hda7, and /home is probably /dev/hda8, if they are in the order you listed then in your post.

You should edit the kernel line, specifically root=/dev/hda5 to read root=/dev/hda6 (the root partition).

The example in the manual is just that, an example. It is not meant to be an absolute parameter for all Linux installations. Examples from manuals must be edited to show the actual setup of your own installation.

grautu 09-18-2005 04:41 AM

Quote:

Originally posted by bigrigdriver
If your /dev/hda5 is an extended partition, with root /, swap, and /home partitions inside the extended partition, then root / is probably /dev/hda6, swap is probably /dev/hda7, and /home is probably /dev/hda8, if they are in the order you listed then in your post.

You should edit the kernel line, specifically root=/dev/hda5 to read root=/dev/hda6 (the root partition).

The example in the manual is just that, an example. It is not meant to be an absolute parameter for all Linux installations. Examples from manuals must be edited to show the actual setup of your own installation.

Hi, brigrigdriver
and thanks for your answer. However I did work absolutely correct (though posted differently, please do excuse me for that!) in that my real setting is the following: extended partition /dev/hda3 (not /dev/hda5) with root partition / named indeed as /dev/hda5 (once again, I bag apologise for reporting the extended partition as /hda5 instead of /hda3). Therefore my root partition is /dev/hda5 indeed and the command I used
Code:

grub> kernel /vmlinuz-2.4.27-2-386 root=/dev/hda5 ro
is right. Anyway, I was already adapted the commands to my setting at least in that the GRUB manual does not provide examples (as you was believing) but general frameworks such as
Code:

kernel file
where the filename file should be replaced according to the actual setting (as I did replace).
Therefore the problem I posted remains unanswered.
Thanks again!

saikee 09-18-2005 01:41 PM

For those booting Grub manually in Grub prompt I want to share a secret with you. You can boot any system with these 3 lines

root (hdi,j)
chainloader +1
boot

Any system=DOS, Win3x, Win9x, 2k, XP, any Linux, any BSD and Solaris.

The "ONLY" thing you need is to do is to have the boot loader at the root partition of every operation system. i=disk No. and j=partition No. remember Grub counts from 0

For DOS, Win3x, Win9x, 2k, XP, any BSD and Solaris this is automatically arranged when you intsall the software.

For Linux it normally gives you 3 choices for the boot loader

(1) MBR
(2) root partition
(3) a Floppy (not always offered )

The (2) can always be replicated later when you are in that Linux by typing

gub-install /dev/hdax for Grub and x=partition No. (use sdax for Sata)

lilo -b /dev/hdax for Lilo

The manual booting process can be automated by amending the /boot/grub/menu.lst but the above 3 lines have to changed slightly to

title this is my system in hda9 # using hda9 as example
root (hd0,8)
chainloader +1

-----------------------

Typing the kernel is another method to boot is one method but can't be applied to a system foriegn to Grub (without a kernel like M$ Windows).

The other method described by the above is "chain loading". It is generic and usable on all systems.

grautu 09-18-2005 06:40 PM

Quote:

Originally posted by saikee
For those booting Grub manually in Grub prompt I want to share a secret with you. You can boot any system with these 3 lines
Code:

root (hdi,j)
chainloader +1
boot

Any system=DOS, Win3x, Win9x, 2k, XP, any Linux, any BSD and Solaris.
The "ONLY" thing you need is to do is to have the boot loader at the root partition of every operation system.
Thanks a lot saikee! Though your great trick failed to work in my case, I intend to learn why. Maybe, because of my root partition, which is "hidden" (as /dev/hda5) inside an extended partition /dev/hda3? Anyway, installing grub in / was indeed producing a certain difference in GRUB's behaviour, but not enough to go through and load my Debian from the "grub> " prompt. I would appreciate very much if somebody else would post here testing results in various configurations.
Thanks again for the trick and thanks in advance for other tests or remarks!

saikee 09-19-2005 04:33 AM

Hda5 is the 1st logical partition in the hdd. Your hda3 extended partition is a box containing all the logical partition. An extended partition has no usable space. It is just a border boundary! If you have only one logical partition then hda3 should be indentical in size and cylinder numbers to hda5.

If you are working in Grub prompt, type help to see the commands available. "unhide" is one of the commands available

You can use

unhide (hd0,4)

to unhide your hda5. It will be bootable if it has a boot loader inside hda5.

Grub can only pull any system up if that system is bootable originally. Grub can't repair it.

I am not telling tricks here. All the bits I described on Grub can be read in the Grub Manual.

grautu 09-19-2005 09:01 AM

I will insist to understand your trick, grateful thanks!


All times are GMT -5. The time now is 03:39 PM.