Dear catlett,
I got it working.
To recap from some earlier posts and update, I have a separate /boot partition that seems to have gotten corrupted by a Windows recovery boot. A more detailed description of my system and what I tried that did not work is here: http://ubuntuforums.org/showpost.php...9&postcount=42
Here's what worked to restore grub using only the Live/Install CD to access the problem hard drive. No other drives, floppies, pen drives, or other CD's were used.
1. Made a new directory under /mnt as a mountpoint for mounting the ubuntu root partition
Code:
sudo mkdir /mnt/ubuntu
Explanation: The live cd does not automatically mount your hard drive. You have to do this manually, partition by partition.
2. Mounted the ubuntu root partiton
Code:
sudo mount -t ext3 /dev/hda7 /mnt/ubuntu
3. Mounted the boot partition to the boot directory of the mounted ubuntu root
Code:
sudo mount -t ext2 /dev/hda5 /mnt/ubuntu/boot
Explanation: This mounts the boot partiton in the same place it would be mounted if the hard drive were booted to the ubuntu distro installed on hda7.
4. Changed to the package archives directory.
Code:
cd /var/cache/apt/archives
Explanation: This is where the latest kernel package would be.
5. Found the latest kernel image. 6. Forced a kernel install into the /boot partition.
Code:
sudo dpkg -i --root=/mnt/ubuntu --force-overwrite linux[XXX].deb
Explanation: Running dpkg on a kernel package places the kernel image into the /boot directory. In this case, since the /boot directory of the mounted ubuntu root is really the /boot partition mounted on the mounted ubuntu root, the kernel ends up in the /boot partition.
7. Since the previous item gave some notification of grub errors, downloaded the latest grub .deb file, then did a force install of the grub package.
Code:
sudo dpkg -i --root=/mnt/ubuntu --force-overwrite grub[XXX].deb
8. Said yes when asked to have a menu.lst file created.
9. Repeated step 6. This time there were no grub errors reported. It is possible that reversing steps 6 and 7 would have avoided this step.
10. Ran grub-install to the device, not the partition, using the mounted ubuntu partition as the root directory.
Code:
sudo grub-install --root-directory=/mnt/ubuntu /dev/hda
This also created the previously missing stage1 file, the lack of which was preventing earlier attempts to fix grub from working.
Note. This did not work an earlier time when the boot partition was not mounted on /boot of the mounted root partition.
I also believe that using the
Code:
--root-directory=[path to your mounted root directory]
option is critical with using this command from the live CD. Others have reported that this command does not work from the live CD. It should work fine if you use this option.
11. Used to edit the root line of /mnt/ubuntu/boot/grub/menu.lst from (hd0,0) to (hd0,4).
NOTE_0,0 (note_a1): If a boot partition exists (as in this case), use its location instead of the location of the root partition. This can be confusing because it is asking for the root location and you are answering with the boot location. On many systems they are the same, but not if you have a /boot partition.
NOTE_0,1 (note_a2): There are two counting systems. The alphabetized system, e.g.: hda, hdb, etc, begins counting partitions at 1, whereas the numerical system, e.g.: hd0, hd1, etc, begins counting partitions at 0. So, for example, in this case, the boot partition, hda5, is hd0,4.
NOTE_0,2 (note_a3): I realize now that, at this point, I could have used sudo grub and followed the instructions in catlett's opening post to this thread http://ubuntuforums.org/showpost.php...95&postcount=1 to set the root partition, since I now had a stage1 file. I had tried it before I had a stage1 file and that solution wasn't working because it couldn't find the stage1 file. Because step 10 created the missing stage1 file, catlett's solution would probably have worked at this point, but I didn't think of it at the time.
NOTE_0,3 (note_a4):At some time in the future, I can edit the meun.lst for more choices, such as to my alternate distro on hda6, booting to a command prompt, or even booting to Windows (if I ever wanted to do that again).
12. Shut the computer completely down. When doing major changes, particularly when dealing with booting issues, I have found that changes stick more often than when just rebooting. YMMV.
13. Restarted.
14. Logged onto this site to share what worked and express my gratitude.
While this might not be the most elegant way to restore grub, the bottom line is that it did work. I'm so glad to be back up on my usual system with all my programs, settings and files. Thanks for all your help. Thanks to the folks in my local LUG who helped, too.
Bookmarks