Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
I have (among others) these partitions:
/dev/sda5 'newsys' - my current system partition (Ubuntu Karmic, 64-bit)
/dev/sda2 'oldsys' - the original system partition
/dev/sda1 'boot' - mounted at /boot when running 'newsys'
'boot' and 'oldsys' both have copies of Grub2.
The two copies of grub.cfg are identical except for a
menuentry title, so I can tell which one is being used.
When I boot, the grub menu shown is the one from 'oldsys'.
(Running 'fdisk -l' shows that /dev/sda1 ('boot') is the "Boot"
partition, but I understand that is not relevant for Grub.)
So my problem is that I am otherwise done with 'oldsys'
and I want to delete it, but I can't because
it seems to be used in the boot process.
(1) How does Grub2 find the grub.cfg file?
(Is it in the MBR's bootloader code?)
(2) Can I tell which one it will find without actually booting?
(3) And, most importantly, how can I get Grub2 to use 'boot'
instead of 'oldsys' ?
Any SW--application, utility, etc.--is programmed to specify where it is supposed to look for its files. This is often done in configuration files that are read in at the start of the program.
In the case of GRUB 0.97 (Why did they go to 2 if they couldn't finish 1??), the location of /boot/grub/menu.lst is "hard-coded" into the stage-I code when GRUB is installed. (Stage-I being what goes in the MBR.) I would assume that GRUB-2 does something similar----reading the manual would be the place to start.
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
What do you mean by oldsys and newsys ?
Did you install UBUNTU Karmic twice or do you an other version of Ubuntu installed ?
Which kernels are mentioned in the boot options from oldsys or newsys or both ?
Thanks for your help. I did look back over the docs
(the online info files) and decided that I should try (as root):
grub-setup -r '(hd0,1)' /dev/sda
I was diappointed to find that the MBR hadn't changed.
But I thought I would try rebooting anyway .... and ....
IT WORKED !! - The Grub menu came from my 'boot' partition !
I then compared my entire /boot directory tree with a backup.
The ONLY change was removal of an empty file:
For totally gruesome completeness, I put back the empty file
and rebooted again - STILL boots from 'boot' Hurray!!
So it is still a mystery as to what tells grub where to find
I can proceed to delete the obsolete partition, but I'd sure
like to know what is going on.
Any more thoughts? Maybe I'll try the help-grub list.
I'll let you know if I find anything.
PS Not sure if this thread should be marked "Solved"
- I believe my problem is solved, but I still can't answer the question in the title
BTW, the 'oldsys' partition is the same O/S . It came with the system and
included the /boot directory. I built 'newsys' and 'boot' .
When you install a bootloader, there is code that goes in the MBR, but that usually links to more code that is beyond the MBR----in the first 63 sectors of the drive (before the first partition). I have no clue as to the details of how grub-2 works in this regard.
BINGO!! I of course have no record of what those 63 sectors were
before I ran grub-setup, I tried to recreate the old data
by running grub-setup again again with -r '(hd0,2)'
And indeed the only change was that byte 0x414 = 1044 changed from
0x00 to 0x01. (BTW, about 50 of the 63 sectors were used.)
So I know that grub-setup does make its change in that first ("hidden")
track. BUT, I also know that I did not successfully recreate the old
data because trying to boot threw me into a "grub rescue>" prompt.
I managed to climb out of that tiger-trap, and another grub-setup fixed it.
I suspect the remaining confusion may involve the fact that on
'oldsys' the grub dir is /boot/grub while on 'boot' it's just /grub .
So I don't quite understand what's going on, but it's close enough for me,
and I'm marking this thread as "Solved" .