LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-26-2007, 05:08 PM   #1
Mountain Man
Member
 
Registered: Jul 2006
Distribution: Ubuntu 11.10 (desktop), lubuntu 11.10 (netbook)
Posts: 73

Rep: Reputation: 15
How to change partition Grub looks for menu.lst file in. (Solved)


I just installed a new SATA hard drive and then installed Ubuntu 64 bit on it. It boots up fine, but I noticed that grub is installed on the MBR of the IDE drive, not the SATA. To get GRUB installed on the MBR of the SATA drive, I reinstalled ubuntu on a second partition of the SATA drive with the power cord temporarily unplugged for the IDE drive. This gets me a step closer, but what I want now is to have GRUB on the SATA drive MBR use the menu.lst file in "/boot/grub" on /dev/sda1, instead of on /dev/sda2 where it now looks. I know I could just edit the menu.lst file on the second partition to make the version on the first partition boot by default, but I'm hoping to figure out how to do this with grub instead.

While searching for an answer on this I found this thread which looks very promising. However, when I do what it says I get the following error:

Code:
mountainman@mountainman-desktop:~$ grub
Probing devices to guess BIOS drives. This may take a long time.

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> root (hd0,0)
root (hd0,0)

Error 21: Selected disk does not exist
grub>
Here is the output I get when I run fdisk -l in case this helps:
Code:
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000131f7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        2432    19535008+  83  Linux
/dev/sda2   *        2433        4864    19535040   83  Linux
/dev/sda3            4865        5350     3903795   82  Linux swap / Solaris
/dev/sda4            5351       60801   445410157+  83  Linux

Disk /dev/hda: 80.0 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0001bdd9

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1912    15358108+   5  Extended
/dev/hda2            1913        3824    15358140   83  Linux
/dev/hda3            3825        5736    15358140   83  Linux
/dev/hda4            5737        9733    32105902+  83  Linux
/dev/hda5               1          62      497952   82  Linux swap / Solaris
/dev/hda6              63        1912    14860093+  83  Linux
Any suggestions would be greatly appreciated!

Last edited by Mountain Man; 12-26-2007 at 08:24 PM. Reason: Changing Title to reflect problem solved.
 
Old 12-26-2007, 05:16 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Read the first line of the answer in that other thread ...
 
Old 12-26-2007, 05:22 PM   #3
Mountain Man
Member
 
Registered: Jul 2006
Distribution: Ubuntu 11.10 (desktop), lubuntu 11.10 (netbook)
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
Read the first line of the answer in that other thread ...
ah! Thanks. Stupid mistake. I tried it again, this time as root. Any thoughts on the new error message?

Code:
mountainman@mountainman-desktop:~$ sudo grub
[sudo] password for mountainman:
Probing devices to guess BIOS drives. This may take a long time.

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> root (hd0,0)
root (hd0,0)
grub> setup (hd0)
setup (hd0)

Error 17: Cannot mount selected partition
grub>
 
Old 12-26-2007, 05:38 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
You're hitting the wrong disk - you can't (directly) address an extended partition.
As it says, tab completion is supported; type in root "(hd0,<tab>" to see the partitions for that disk. Handy way to determine which disk you're attacking.
 
Old 12-26-2007, 06:15 PM   #5
Mountain Man
Member
 
Registered: Jul 2006
Distribution: Ubuntu 11.10 (desktop), lubuntu 11.10 (netbook)
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
You're hitting the wrong disk - you can't (directly) address an extended partition.
As it says, tab completion is supported; type in root "(hd0,<tab>" to see the partitions for that disk. Handy way to determine which disk you're attacking.
I'm not sure what is wrong, but when I hit tab all it does is create white space. Is there another way to see the partitions (I posted the fdisk -l response above) to figure out what I need to use as arguments?
 
Old 12-26-2007, 06:21 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
D'oh - my attempt at indicating the command; try "root (hd0,<tab>"
(without the quotes ...)
 
Old 12-26-2007, 06:32 PM   #7
Mountain Man
Member
 
Registered: Jul 2006
Distribution: Ubuntu 11.10 (desktop), lubuntu 11.10 (netbook)
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
D'oh - my attempt at indicating the command; try "root (hd0,<tab>"
(without the quotes ...)
Thanks. I might still be doing something wrong. Here is what I get:

Code:
mountainman@mountainman-desktop:~$ sudo grub
[sudo] password for mountainman:
Probing devices to guess BIOS drives. This may take a long time.

       [ Minimal BASH-like line editing is supported.   For
         the   first   word,  TAB  lists  possible  command
         completions.  Anywhere else TAB lists the possible
         completions of a device/filename. ]
grub> root (hd0,<tab>
root (hd0,<tab>

Error 11: Unrecognized device string
grub> root (hd0,
root (hd0,

Error 11: Unrecognized device string
grub>
The second time I tried hitting the tab key in place of <tab>. Same results.

Last edited by Mountain Man; 12-26-2007 at 06:34 PM.
 
Old 12-26-2007, 08:23 PM   #8
Mountain Man
Member
 
Registered: Jul 2006
Distribution: Ubuntu 11.10 (desktop), lubuntu 11.10 (netbook)
Posts: 73

Original Poster
Rep: Reputation: 15
Fixed it!

Ok. I figured this out. I poked around all three menu.lst files to see what grub saw each drive partition as. I was thinking the SATA drive was hd0 because that is what it was listed as in the version of the file that grub was using, and that one worked. I went back to the file for the first SATA installation partition (installed ubuntu with both drives powered up), and saw that it listed the SATA drive as hd1. I plugged this in to the commands linked from the first post, and it worked perfectly! Strangely, I wasn't able to boot after that until I changed the menu.lst file in that partition to call the SATA drive hd0 !!!?. From the way it behaved I would say GRUB considers the SATA drive hd1 when configuring it from the command prompt, but when first booting whichever drive grub loaded on the MBR from is considered hd0, and the other becomes hd1. I say this because when I temporarily changed the bios to have GRUB run from the IDE drive MBR, it worked with the SATA drive labeled as hd1. I'm not sure why this would be the case but now that it is working the way I want I'm going to stop tinkering with it.

Thanks syg00 for taking the time to help me out with this!
 
Old 12-27-2007, 11:47 AM   #9
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by Mountain Man View Post
Ok. I figured this out. I poked around all three menu.lst files to see what grub saw each drive partition as. I was thinking the SATA drive was hd0 because that is what it was listed as in the version of the file that grub was using, and that one worked. I went back to the file for the first SATA installation partition (installed ubuntu with both drives powered up), and saw that it listed the SATA drive as hd1. I plugged this in to the commands linked from the first post, and it worked perfectly! Strangely, I wasn't able to boot after that until I changed the menu.lst file in that partition to call the SATA drive hd0 !!!?. From the way it behaved I would say GRUB considers the SATA drive hd1 when configuring it from the command prompt, but when first booting whichever drive grub loaded on the MBR from is considered hd0, and the other becomes hd1. I say this because when I temporarily changed the bios to have GRUB run from the IDE drive MBR, it worked with the SATA drive labeled as hd1. I'm not sure why this would be the case but now that it is working the way I want I'm going to stop tinkering with it.

Thanks syg00 for taking the time to help me out with this!
Yes, you have it sorted out. When doing setup, grub takes the drive ordering as listed in bios since that is all it knows. But when you actually do your mounting, you have to use remap the drives (I do it in device.map) so that the boot drive is known as hd0.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configuration of the file 'menu.lst' in GRUB Gins Linux - General 7 08-27-2007 11:23 PM
Grub Menu doesn't reflect menu.lst file fatsheep Linux - Software 4 06-11-2007 01:29 PM
GRUB menu.lst/grub.conf file with multiple partitions dasy2k1 Linux - General 1 04-19-2007 08:42 AM
/grub/menu.lst file disappeared but computer still boots (grub) rrrssssss Linux - General 5 04-08-2007 09:02 AM
Grub - how do I change which partition is used to find menu.lst nickhen Linux - General 1 01-24-2005 01:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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
Open Source Consulting | Domain Registration