LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do i configure GRUB to actually boot an OS? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-configure-grub-to-actually-boot-an-os-807581/)

Lyle 05-13-2010 08:13 AM

How do i configure GRUB to actually boot an OS?
 
I have yet to find any coherent instructions anywhere on earth on this and im wondering if its ever actually been done before.

Assuming i have root partitions on /dev/hda1, /dev/hda2, /dev/hda7

How would i do it? What would i type in the terminal?

syg00 05-13-2010 08:36 AM

You are unlikely to get coherent answers without coherent requirements.
It's very difficult to boot anything from a terminal.

See what I mean ...

Lyle 05-13-2010 09:02 AM

Quote:

Originally Posted by syg00 (Post 3966989)
You are unlikely to get coherent answers without coherent requirements.
It's very difficult to boot anything from a terminal.

See what I mean ...


No, because Im not interested in booting through a terminal im interested in confiruing grub from the terminal.

kmacphail 05-13-2010 09:07 AM

Lyle

For us to go any further forward we need a bit more information. First of all what type of GRUB are you running is it GRUB legacy or GRUB2 (GRUB 1.98) as this will prove two very different answers.

I can help you with grub legacy, but don't have much experience with grub2 yet (I don't need to). If you do not know which one you have then go to the terminal and type:

Code:

ls /boot/grub/
Now look at the files, if you see a file called menu.lst then you have GRUB legacy, if you see a file called grub.cfg then you are using GRUB2.

Post back once you have done this :)

Lyle 05-13-2010 09:30 AM

Quote:

Originally Posted by kmacphail (Post 3967031)
Lyle

For us to go any further forward we need a bit more information. First of all what type of GRUB are you running is it GRUB legacy or GRUB2 (GRUB 1.98) as this will prove two very different answers.

I can help you with grub legacy, but don't have much experience with grub2 yet (I don't need to). If you do not know which one you have then go to the terminal and type:

Code:

ls /boot/grub/
Now look at the files, if you see a file called menu.lst then you have GRUB legacy, if you see a file called grub.cfg then you are using GRUB2.

Post back once you have done this :)

thanks, i was just about to ask about the lack of a menu.lst. I have none but i do have the grub.cfg so i have GRUB2 it seems.

kmacphail 05-13-2010 09:57 AM

in the terminal type
Code:

cat /boot/grub/grub.cfg
This will let you see the contents of the file grub.cfg but not edit them. Have a look in the file and find the distro you wish to boot by default it will start with the term menuentry.

Now there are two ways to do this:
1. Note down or copy the exact menu entry file in the inverted comas eg 'Gentoo Linux 2.6.24-r5'
or
2. Find the distro you want to load by default, and count the number of lines that start with menuentry from the top to your chosen distro, remember to start the count at 0.

in the terminal, go into super user (su) mode and type:

Code:

nano /etc/default/grub
depending on your chosen method this will differ slightly:

1. for the exact menu entry:
Code:

GRUB_DEFAULT="{your distro choice here}"
(note the inverted comas)

2. for number:
Quote:

GRUB_DEFAULT={number of your chosen distro}
Once you have saved and exited then type:

Code:

update-grub
This should update your menu and the next time you reboot your distro of choice should boot automatically :)

This is about the extent of my knowledge on GRUB2 so I'm glad it was a relatively straightforward problem.

Let us know how you get on.

dauphinfay 05-22-2010 02:29 PM

I am not quite sure but I think I'm looking for the same answer but for legacy (as I have a "menu.lst" showing. I need to adjust the "kernel" line to reflect exactly which kernel it is. I'm installing Gentoo via an Ubuntu live CD and can't think of a way to extrapolate the exact kernel label.

AwesomeMachine 05-23-2010 01:26 AM

You can boot into a rescue system, chroot to the installed system, and install grub. That will find every root partition and set the proper parameters in /boot/grub.cfg. If you want to get your hands dirty, you can hit 'e' at the bootup, after the grub menu pops up, and directly edit the entire 'grub.cfg' entry. But the changes won't stick until you edit the grub.cfg templates in '/etc/grub', and run 'update-grub'.

kmacphail 05-23-2010 03:16 AM

dauphinfay Welcome to Gentoo, yes you do have grub legacy. However we need to know one piece of information before we setup anything: did you setup the kernel manually or did you use the genkernel command? As the grub will be different for the two scenarios.

saikee 05-23-2010 07:13 AM

If you have an operating system in each of /dev/hda1, /dev/hda2 and /dev/hda7 you can boot them in Grub1 with
Code:

root (hd0,0)
configfile /boot/grub/menu.lst

Code:

root (hd0,1)
configfile /boot/grub/menu.lst

Code:

root (hd0,06)
configfile /boot/grub/menu.lst

if you place/restore/put/leave Grub1 inside the root partition they can be booted by commands
Code:

root (hd0,0)
chainloader +1
boot

Code:

root (hd0,1)
chainloader +1
boot

Code:

root (hd0,6)
chainloader +1
boot


With Grub2 the commands are
Code:

set root=(hd0,1)
configfile /boot/grub/menu.lst

Code:

set root=(hd0,2)
configfile /boot/grub/menu.lst

Code:

set root=(hd0,7)
configfile /boot/grub/menu.lst

and
Code:

set root=(hd0,1)
chainloader +1
boot

Code:

set root=(hd0,2)
chainloader +1
boot

Code:

set root=(hd0,7)
chainloader +1
boot

The commands you enter in a Grub terminal are the same lines you put in the menu.lst or grub.cfg.

Everything you want to know is inside the Grub manual availabel in GNU/Grub site.


All times are GMT -5. The time now is 07:11 PM.