LinuxQuestions.org
Review your favorite Linux distribution.
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 05-13-2010, 08:13 AM   #1
Lyle
Member
 
Registered: May 2010
Location: Guyana, South America
Distribution: Debian, Sabayon
Posts: 37

Rep: Reputation: 15
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?
 
Old 05-13-2010, 08:36 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,619

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

See what I mean ...
 
0 members found this post helpful.
Old 05-13-2010, 09:02 AM   #3
Lyle
Member
 
Registered: May 2010
Location: Guyana, South America
Distribution: Debian, Sabayon
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
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.
 
Old 05-13-2010, 09:07 AM   #4
kmacphail
Member
 
Registered: Jan 2009
Location: Isle of Lewis
Distribution: Gentoo, Crunchbang (XFCE)
Posts: 133
Blog Entries: 1

Rep: Reputation: 18
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
 
Old 05-13-2010, 09:30 AM   #5
Lyle
Member
 
Registered: May 2010
Location: Guyana, South America
Distribution: Debian, Sabayon
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kmacphail View Post
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.
 
Old 05-13-2010, 09:57 AM   #6
kmacphail
Member
 
Registered: Jan 2009
Location: Isle of Lewis
Distribution: Gentoo, Crunchbang (XFCE)
Posts: 133
Blog Entries: 1

Rep: Reputation: 18
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.

Last edited by kmacphail; 05-13-2010 at 10:00 AM.
 
Old 05-22-2010, 02:29 PM   #7
dauphinfay
Member
 
Registered: Jan 2004
Location: Earth
Distribution: Ubuntu
Posts: 287

Rep: Reputation: 30
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.
 
Old 05-23-2010, 01:26 AM   #8
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 2,556

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
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'.
 
Old 05-23-2010, 03:16 AM   #9
kmacphail
Member
 
Registered: Jan 2009
Location: Isle of Lewis
Distribution: Gentoo, Crunchbang (XFCE)
Posts: 133
Blog Entries: 1

Rep: Reputation: 18
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.
 
Old 05-23-2010, 07:13 AM   #10
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
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.

Last edited by saikee; 05-23-2010 at 07:18 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
unable to configure /boot/grub/menu.lst avee137 Linux - Newbie 24 05-14-2010 02:40 AM
configure GRUB to boot FreeBSD ? thelonius *BSD 3 10-05-2006 05:04 AM
configure grub to dual boot - not working. John5788 Linux - General 8 04-12-2005 01:23 PM
Configure grub (dual boot) with 2 OP installed already fere Linux - Newbie 2 06-07-2004 10:58 PM
GRUB can't boot my new configure kernal. What's wrong? sabaka Linux - Newbie 1 11-23-2003 03:37 AM


All times are GMT -5. The time now is 09:06 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration