I installed Ubuntu yesterday alongside Windows 7 and whenever I start my computer I don't have the option to boot Windows. When the computer starts it goes straight to Ubuntu without giving me an OS selection menu. When it goes to Ubuntu it gives me Ubuntu repair options and Ubuntu normal start option. I still have all of the Windows 7 files on my hard drive, but Windows 7 has no way to boot.
Ubuntu – Can’t boot Windows 7 after installing Ubuntu
bootdual-bootwindows
Related Solutions
When you install Windows, Windows assumes it is the only operating system (OS) on the machine, or at least it does not account for Linux. So it replaces GRUB with its own boot loader. What you have to do is replace the Windows boot loader with GRUB. I've seen various instructions for replacing GRUB by mucking around with GRUB commands or some such, but to me the easiest way is to simply chroot
into your install and run update-grub
. chroot
is great because it allows you to work on your actual install, instead of trying to redirect things here and there. It is really clean.
Here's how:
- Boot from the live CD or live USB, in "Try Ubuntu" mode.
Determine the partition number of your main partition.
sudo fdisk -l
,sudo blkid
or GParted (which should already be installed, by default, on the live session) can help you here. I'm going to assume in this answer that it's/dev/sda2
, but make sure you use the correct partition number for your system!If your main partition is in an LVM, the device will instead be located in
/dev/mapper/
, most likely,/dev/mapper/{volume}--{os}-root
where{volume}
is the LVM volume name and{os}
is the operating system. Executels /dev/mapper
for the exact name.Mount your partition:
sudo mount /dev/sda2 /mnt #Replace sda2 with the partition from step 2
If you have a separate
/boot
,/var
or/usr
partitions, repeat steps 2 and 3 to mount these partitions to/mnt/boot
,/mnt/var
and/mnt/usr
respectively. For example,sudo mount /dev/sdXW /mnt/boot sudo mount /dev/sdXY /mnt/var sudo mount /dev/sdXZ /mnt/usr
replacing
sdXW
,sdXY
, andsdXZ
with the respective partition numbers.Bind mount some other necessary stuff:
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
If Ubuntu is installed in EFI mode (see this answer if you're unsure), use
sudo fdisk -l | grep -i efi
or GParted to find your EFI partition. It will have a label ofEFI
. Mount this partition, replacingsdXY
with the actual partition number for your system:sudo mount /dev/sdXY /mnt/boot/efi
chroot
into your Ubuntu install:sudo chroot /mnt
At this point, you're in your install, not the live session, and running as root. Update grub:
update-grub
If you get errors or if going up to step 7 didn't fix your problem, go to step 8. (Otherwise, it is optional.)
Depending on your situation, you might have to reinstall grub:
grub-install /dev/sda update-grub # In order to find and add windows to grub menu.
If Ubuntu is installed in EFI mode, and EFI partition UUID has changed, you may need to update it in
/etc/fstab
. Compare it:blkid | grep -i efi grep -i efi /etc/fstab
If current EFI partition UUID (from
blkid
) differs from the one in/etc/fstab
, update/etc/fstab
with current UUID.If everything worked without errors, then you're all set:
exit sudo reboot
At this point, you should be able to boot normally.
If you cannot boot normally, and didn't do step 8 because there were no error messages, try again with step 8.
- Sometimes giving GRUB2 the correct configuration for your partitions is not enough, and you must actually install it (or reinstall it) to the Master Boot Record, which step 8 does. Experience helping users in chat has shown that step 8 is sometimes necessary even when no error messages are shown.
I had the same experience as the OP with two main differences:
1) Desktop machine with two physical HDDs.
2) Windows XP was installed on the first HDD.
Instead of messing with the boot loader, all I had to do was change the order of the drives listed in the BIOS so that #1 was the HDD with Ubuntu installed, and #2 was the WinXP drive.
After doing so I was presented with the linux version of the boot selector, and could choose Ubuntu or WinXP as I had originally desired.
I'm not sure if this will apply to the original question, but it may be useful for others.
Best Answer
First thing first, you need to repair your WIn7 bootloader, and you can visit this page to learn how to do this. Write down on a piece of paper the required commands for fixing both boot and mbr. You'll be using those codes after getting to the Command Prompt screen.
Next you can download Boot Repair iso image as suggested in the previous answer by 'user3005324'. Choose 64 bit iso image if you have installed Ubuntu 64 bit or choose 32 bit iso image if you have Ubuntu 32 bit. I hope Win7 is the same architecture with Ubuntu, I mean you have either Win7 32 bit and Ubuntu 32 bit, or you have Win7 64 bit and Ubuntu 64 bit.
Burn the iso image, and restart your computer with the new Boot Repair CD in tray. You can write Boot Repair iso image on a USB pendrive with Unetbootin tool if you don't have a regular CD to use. Read instructions on how to use Unetbootin in Linux/Ubuntu, they are located at the middle of this page: http://unetbootin.sourceforge.net/ .
After Boot Repair cd or usb pendrive finish loading, you can press the 'Recommended Repair' option, wait to finish and after you get the message 'success' you can reboot and use Win7 and Ubuntu which will be present both in your start-up boot menu.