How to change partition Grub looks for menu.lst file in.
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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>
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.
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?
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.
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!
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.