Fix a dual boot Windows Vista and Linux problem

Posted on in Categories Howto, Linux desktop, RedHat/Fedora Linux, Troubleshooting, Ubuntu Linux, Windows last updated November 22, 2006

How do you fix a dual boot system if you had to reinstall Windows Vista and you can no longer boot to Fedora Core 6 (FC6) or Fedora Linux ? Nobody wants to reinstall FC 6 or Fedora Linux again!

Almost all versions of Microsoft Windows (including XP, Vista and old versions) overwrite GRUB bootloader in MBR (master boot record). As a result Windows boot loader becomes a new boot loader and GRUB will not appear on screen (you will not able to see GRUB menu options).

But don’t worry you can easily fix the problem. Please note that if you are using Debian or Ubentu Linux just follow these instructions. Following instuctions are Fedora Linux only and should work with RHEL / CentOS too:

Step # 1: Boot from Fedora Core Linux 1st CD or DVD

Set BIOS to boot from CD/DVD rom. At boot: prompt type command linux rescue
boot: linux rescue

Just follow on screen instructions, when prompted let installer search Linux installation. If the search operation is successful, your old Linux installation will be available at special directory called /mnt/sysimage.

Step # 2: Prepare system for GRUB reinstallation

Type the following commands at shell prompt:
# chroot /mnt/sysimage
# cd /boot/grub

chroot command allows to run rest of all *COMMAND* with root directory set to NEWROOT called /mnt/sysimage. Without chroot environment you will not able to restore GRUB on Fedora Core 6.

Step # 3: Find out your GRUB bootloader installation location

If you have only one IDE hard disk default should be /dev/hda. You can use any of the following command to determine your device name:
# grep '#boot' grub.confOuput:

#boot=/dev/sda

Above output clearly point out that /dev/sda device where my GRUB bootloader was previously installed.

You can also try out fdisk -l command to list partitions and disk information:
# fdisk -l

Step # 4: Reinstall GRUB

Use grub-install command to install GRUB on your drive /dev/sda
# grub-install /dev/sda

Please note that if above command returned any error return with –recheck option to probe a device map even if it already exists
# grub-install --recheck /dev/sda

Step # 5: Reboot system

Exit from chrooted environment and reboot Linux:
# sync;sync;exit;exit
# reboot

Now GRUB will be able to boot both Windows Vista and Fedora Core 6. In UNIX/Linux dd command can be used to backup and restore the MBR πŸ™‚

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

23 comment

  1. I have installed Windows Vista on a seperat hard drive. Windows XP Home edition was running fine I installed the new hard drive and then installed Windows Vista Home Premium on the new drive. Did not use dual boot at the time of installation. How do I institute Bual boot from here?

  2. Thanks mate. The solution worked perfect. Even a novice like me could understand and execute. Thanks again

  3. very nice steps, but when I start the rescue, it tells me it failed to mount some parts of my system,
    the problem that after changing the root
    I find that /dev’ folder has no devices
    so grub-install gives error: “can’t find /dev/hda, or it’s not a block device”
    Do u have any idea how can I handle that please send to me on my personal mail [email protected]
    It’s very important I have a lot of data on my fedora core 6 installation, I don’t want to reinstall it

    Best Regards,
    Ahmed Barakat

  4. hi i installed vista and then linux fedora8 then i formated the partition that the linux was on how can i fix my boot sector to work on vista again please help

  5. Hi, I think you have to boot with the Vista CD/DVD and use the repair utility. Don’t know on Vista but on XP/2000 the command was FIXMBR. It’s seam that’s Vista as overtaken the mbr whitout asking on my multiboot system, that’s bad.

  6. the following error message appear when attempting to logon from my Linux desktop….

    When I attempt to log in as as user i’m seeing the following error directly after entering the password and username.

    “Your session only lasted less that ten seconds. If you have not logged out yourself, this could mean that there is some installation problem or that you may be out of diskspace. Try logging in with one of the failsafe sessions to see if you can fix the problem”

    Checkbox – View Details (~/.xsession-errors file) which when checked dsiplays the following.

    /home/user/.Xclients: line 8: /home/user/.Xclients-default: No such file or directory

    /home/user/.Xclients: line 8: exec: /home/user/.Xclients-default: cannot execute: No such file or directory

  7. hey installed server 2008 them redhat linux. now my system is now booting 2 windows. the linux just doesnt allow for windows 2 boot, as in it doesnt give even give any option for this 2 happen. plz help.

  8. I have install Wins Vista and then Linux Ubuntu, the boot system working fine till, I uninstall Ubuntu, the Vista Boot sector wouldn’t work again. I have tried to put the Visa CD installer to the boot system. However, the system recover denied the access to configuration due to vista require administrator password. But I don’t remember the vista Administrator password, or i don’t think i even set one for it. Could you tell me how to clear Administrator password, please? Or anyone have any suggestion to overcome and fix my vista booting sector. THANKS, Mate

  9. Thanks very much. Its very useful. Can anyone tell me how to get a subscription or login permit to this nixcraft.

  10. This has been of great help to me. Worked perfectly and saved me weeks of misery and tens of attempts ‘successfully’ reinstalling Fedora Linux and having the system boot straight to Windows Vista as if the Linux installation did not happen.

  11. hi guys i have win vista-after that i install linux centos now when i was in vista i format the drive that linux install on it.now linux boot show up like every time but no option to select black screen of gnu grub of centos show up now i can’t go to vista help me what should i do?
    thanks

  12. Hey I have the opposite problem! Every time i start my computer it starts with ubuntu linux and i need to boot with Windows Vista! How do i fix this so i can boot windows???

  13. Hi,

    I installed RHL 4 successfully to make my laptop to be dual boot alongwith Vista home premimum, RHL option does not come up while booting, so I followed steps given in this blog, I am still unable to fix boot issue.

    Please advise.

    Thx

Comments are closed.