0

Today I installed Windows 8.1 and it broke my GRUB. I tried to run the boot-repair GUI on a live session of Ubuntu but after the restart of the PC GRUB displays ONLY Ubuntu.

Before the installation I had on the first HD Ubuntu installed alongside with Windows 7 and the grub displayed both of them without problem.

After I installed Windows 8.1 on the second HD the boot loader(?) was replaced with the Windows one and I could select only between Windows 7 and 8 to boot, but not Ubuntu.

How can I fix GRUB now? I wish GRUB could displays all the three OSs (even if different HDs). If not possible I wish I could just choose which HD to boot and then the grub to displays correctly the OS of that HD.

This is the output of boot-repair (broken link).

Zanna
  • 70,465
Luca
  • 11
  • 3

2 Answers2

1

I'm glad you fixed the problem. For future reference, you can use GRUB (or any other EFI boot manager) to switch between two versions of Windows. The way I know to do this requires planning before installing your second Windows, though:

  1. Install the first Windows normally.
  2. Boot to a Linux emergency disk (the Ubuntu installer in "try before installing" mode should work fine).
  3. Change the type code of the EFI System Partition (ESP) to something that Windows will ignore. gdisk is most flexible about this, since you can set the type code to anything you like, such as 8300 (the code used by Linux). You might optionally change the type code of the Windows partition, too, to keep it out of the second installation's boot loader. If you use gdisk, be sure to save your changes with w.
  4. Install your second Windows. The installation should create a second ESP on the disk, and your computer should boot to this version of Windows. (If you did not hide the first Windows by changing its type code, it will probably show up as an option in the Windows boot loader.)
  5. Boot the Ubuntu installer in "try before installing" mode again.
  6. Change the type code on the first ESP back to the right thing (EF00 in gdisk). If you changed the type code of the first Windows partition, change it back (to 0700 in gdisk) at the same time.
  7. Run the Ubuntu installer and install Ubuntu.

When the process completes, you should have GRUB controlling the boot and giving you an option of two Windows installations or Ubuntu. I'm not sure if it will tell you the names/versions of the two Windows installations, though; it might just say "Windows" for each of them.

Many variants of this procedure should work, too, such as installing the second Windows after you install Ubuntu (which will require resetting GRUB as the default boot program). It might be possible to do something similar after installing both copies of Windows by juggling the type codes of the ESPs and Windows partitions and using each Windows version's installation/repair disk to get it to re-install the Windows boot loader on the target ESP.

The key in any of these cases is that you'll have (at least) two ESPs, one for each version of Windows. (Ubuntu doesn't care which ESP it uses.) The dual-ESP setup can cause confusion in the future, though. The Windows 7 installer, for instance, gets confused if it sees two ESPs, so a re-installation will fail. (I don't know if Windows 8 or 10 has the same problem.) Of course, you changed ESP type codes once, so you can do it again if you need to re-install Windows.

Rod Smith
  • 44,284
  • 7
  • 63
  • 105
0

I did sudo update-grub and it solved the problem.

Zanna
  • 70,465
Luca
  • 11
  • 3