[clug] Repairing bootloader

David Schoen neerolyte at gmail.com
Wed Sep 30 05:25:56 MDT 2009


The process I follow that's loosely described below is this (from
memory, please forgive mistakes):

Boot off live cd, find a root prompt on a terminal somewhere

Mount root partition at something like /mnt/ubuntu , e.g:
# mkdir -p /mnt/ubuntu; mount /dev/sda1 /mnt/ubuntu

Mount proc (out of habit, not sure if it's needed):
# mount -t proc NONE /mnt/ubuntu/proc

Mount /boot, /usr and /var if they are separate partitions (or any
others that seem important that you may have).

chroot in to the ubuntu (non-live cd) environment:
# chroot /mnt/ubuntu

run grub to enter the grub prompt:
# grub

Tell grub where /boot is (or / if you have no /boot):
grub> root (hd0,0)

Tell grub to install itself on to the MBR of my first drive:
grub> setup (hd0)

Then quit everything back to the livecd, umount all the mounted stuff,
reboot, hope.

The above commands need to be tailored to your exact configuration but
hopefully the example helps.

Also once you're in the chroot terminal most people report more
success with grub-install:
# grub-install /dev/sda
but grub-install seems to hates me passionately.


Have fun,
Dave

2009/9/30 Boyd <boydwilding at gmail.com>:
> A quick search of the ubuntu forums has a few solutions.
>
> As far as windows 7 goes, I haven't touched that yet, however I've fixed
> vista and debian/ubuntu dual-boot installs before without problems.
>
> The basic process is: you boot off the ubuntu CD and just reinstall grub to
> /dev/sda (with specific command-lines found somewhere in the aforementioned
> forums) and it should load GRUB first on boot, giving you the boot menu
> showing the linux and windows boot options. If you choose windows, it then
> loads the vista boot loader for you and everything that that contains. (some
> people install vista and XP side by side, so this menu may contain vista as
> well as xp as a windows OS choice).
>
> There is also the sledgehammer solution, to just reinstall debian/ubuntu,
> which then reinstalls grub at the end of the process, detecting any other
> OS's, and everything usually works well once doing that.
>
> YMMV.
>
> On Thu, Sep 24, 2009 at 10:18 AM, BAXTER,Adam <adam.baxter at deewr.gov.au>wrote:
>
>> Hi guys,
>> I know I've left this til the last minute, but I'd like to have my
>> dual-boot machine back up and running before the LUG so I can SSH into it
>> for some troubleshooting by the gurus.
>>
>> I recently installed Windows 7 (yeah yeah, I know), and of course the
>> installer clobbered GRUB. Is there an easy way to fix this from a
>> LiveCD/USB? Every time I try I seem to destroy Windows' bootloader too.
>>
>> My setup is this:
>> Sda1 is Windows
>> Sda2 is Ubuntu
>>
>> I'm assuming the MBR is on /dev/sda, Windows bootloader (bootmgr/ntldr) is
>> on /dev/sda1 and GRUB needs to be installed on /dev/sda.
>>
>> What's the best way to do this?
>>
>> --Adam
>> Notice:
>>
>> The information contained in this email message and any attached files may
>> be confidential information, and may also be the subject of legal
>> professional privilege. If you are not the intended recipient any use,
>> disclosure or copying of this email is unauthorised. If you received this
>> email in error, please notify the DEEWR Service Desk by calling (02) 6240
>> 9999 and delete all copies of this transmission together with any
>> attachments.
>>
>> --
>> linux mailing list
>> linux at lists.samba.org
>> https://lists.samba.org/mailman/listinfo/linux
>>
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux
>


More information about the linux mailing list