[clug] Repairing bootloader

David Schoen neerolyte at gmail.com
Wed Sep 30 05:40:09 MDT 2009


Whoops left out getting back in to windows...

What I wrote will get grub reinstalled but not give you access to the
windows boot menu.

Windows XP looks like so (as far as I'm aware Vista/7 work the same
also, but I haven't yet tried either) in your /boot/grub/menu.list
file:
title		Microsoft Windows XP Professional
# my windows install is on the first partition on my first hard drive,
or /dev/sda1
rootnoverify	(hd0,0)
savedefault
makeactive
chainloader	+1


If you get to a grub menu during your boot sequence you can press
something "c" to enter a grub console from which you should be able to
enter:
grub> rootnoverify (hd0,0) # windows partition
grub> makeactive
grub> chainload +1

and try different drives/partitions until you find your windows one
(note that they tab complete at the boot console).

This way if you're not sure which one is the windows install you can
figure it out (although there's probably a better way).

Once you know the right sequence you can put it back in /boot/grub/menu.lst

Have fun,
Dave

2009/9/30 David Schoen <neerolyte at gmail.com>:
> 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