Modifying Grub Configuration if Windows is Not Listed (Dual Boot Windows/Linux)

When you install Linux along side Windows, you should select the option "something else" in the menu to be sure you customize your installation to allow for dual booting Windows.  See my link under Linux Troubleshooting regarding Dual Boot Windows and Linux for more details on this.

IMPORTANT WARNING: NEVER ATTEMPT TO INSTALL ANOTHER OPERATING SYSTEM ALONG SIDE WINDOWS ONTO A PC WITHOUT FIRST COMPLETELY BACKING UP YOUR WINDOWS IMAGE USING AN IMAGE BACKUP UTILITY FIRST.  (Tips on using Windows Image backup are in my page on PC Troubleshooting).

If for some reason the grub boot menu does not appear after installing Linux, it may be an issue with your UEFI settings not being reconfigured after the Linux install.  If it is not a UEFI PC, and the grub menu doesn't show Windows as an option in the Menu, or the Grub MENU doesn't appear at all, at you have to replace the Windows boot loader with GRUB.  Here's how:

1. Boot from the live CD or live USB, in "Try Ubuntu" mode and open a terminal session.
2. Determine the partition number of your main partition. GParted (which should already be installed, by default, on the live session) can help you here. To load it, type parted at the shell prompt.  Use the print command to list the partitions. If the main linux partition is #4, this answer is that it is /dev/sda4, but make sure you use the correct partition number (the numbers in the first column of the list) for your system!
3. Mount your partition:
4. sudo mount /dev/sda4 /mnt  #Replace sda4 with your specific partition number (was in left column of list when you ran parted)
5. Bind mount some other necessary stuff by typing the next command exactly:
  for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
6. If Ubuntu is installed in EFI mode (see this answer if you're unsure), use GParted to find your EFI partition. It will have a label of EFI. Mount this partition, replacing sdXY with the actual partition number for your system:
7. sudo mount /dev/sdXY /mnt/boot/efi
8. chroot into your Ubuntu install:
9. sudo chroot /mnt
10. At this point, you're in your install, not the live session, and running as root. Update grub:
11. 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.)
12. Depending on your situation, you might have to reinstall grub:
13. grub-install /dev/sda
14. update-grub # In order to find and add windows to grub menu.
15. If everything worked without errors, then you're all set:
16. exit
17. sudo reboot
18. At this point, you should be able to boot normally.
If you cannot boot normally, and didn't do step 6 because there were no error messages, try again with step 6.

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 6 does. Experience helping users in chat has shown that step 6 is sometimes necessary even when no error messages are shown.

No comments:

Post a Comment

What do you think? (Comments are moderated and spam will be removed)