Wednesday, August 11, 2010

[Ubuntu] How To Restore GRUB - Problem With Reloc Offset Is Out Of Segment

My Ubuntu 10.04 suddenly cannot boot after the update process... I suspect that the BOOT Record is messed up or the Boot Manager is corrupted, but I have no experience in dealing with this problem in Ubuntu...so I google it..and found a solution from
http://forums.linuxmint.com/viewtopic.php?f=46&t=41555

The solution is as below:


Just had the same problem, which was specifically thanks to Dell DataSafe. First encountered the problem when Dell DataSafe did an update and restart and then Grub bailed at a very early stage leaving me with no interaction with the system at all.

After the panic subdued, and many hours googling, a restoration of Grub solved the problem. First thing I did after that was to log in to Windows 7 and uninstall Dell DataSafe - which of course, borked my MBR again! Doh! Thankfully, its a painless process to restore the mbr once I knew what I was doing.

Always read the more detailed topics for thorough advice, but Ill outline the solution that worked for me in case it helps others:

1. Boot up from live CD.
2. Open terminal.
3. Mount linux partition - sudo mkdir /mnt/mint; sudo mount /dev/sdb1 /mnt/mint (Needed in order for grub-install to work).
4. Restore grub to the mbr: sudo grub-install --root-directory=/mnt/mint /dev/sda

This installed a fresh copy of grub into the mbr but did not seem to pick up the correct configuration - on reboot, I at least managed to get to a grub> prompt rather than it just aborting, but there was no dual boot menu. Some research on manual booting taught me the following for booting from grub:

4.9 If you do not know which partition grub/kernel is installed on, use "find /boot/grub/stage1" to let grub locate it for you. This should return a partition locator in the form, (hdx, y). Use this value in the following commands.

5. root (hd1, 0)
6. "kernel (hd1, 0)/vmlinuz ro root=/dev/sdb1" - vmlinuz will autocomplete.
7. "initrd (hd1, 0)/initrd" - initrd will autocomplete.
8. boot

This booted my Linux Mint install... and helped me relax a bit. :) The last steps I had to do were:

9. Once booted, open a terminal.
10. sudo update-grub2 - this regenerates the grub config data. This might not be needed, but I definitely did it so Im not sure if its essential. Its likely the previous config was still OK I think.
11. Restore grub to the mbr again with sudo grub-install /dev/sda - since we are booted/running from the correct install, there is no need for --root-directory.

After this, my system was restored. Im sure there might be some steps that arent quite essential, and probably a slightly more efficient solution, but it worked for me.

0 comments:

Post a Comment