In your original answer, you wrote:
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.
This isn't true under EFI. Well, Windows is still pretty rude, and could be said to assume it's the only OS, but it does not replace GRUB. Under EFI, multiple boot loader coexist on the EFI System Partition (ESP), and Windows does not delete or replace GRUB.
That said, the average user might not notice any difference in symptoms between a BIOS-mode and an EFI-mode installation of Windows after Ubuntu, because what Windows does in EFI mode is to set its own boot loader as the default. Thus, the computer ends up booting Windows instead of Ubuntu. This looks like the same problem as under BIOS, but it's not.
Something similar to your solution may work under EFI, but it's overkill, and therefore has the potential to create more problems than it solves. In outline, the simplest way to get GRUB back after installing Windows under EFI is:
- Boot to Windows.
- Download and install EasyUEFI.
- Using EasyUEFI, move the
ubuntu
entry to the top of the boot order list.
- Reboot. Ubuntu should boot, but there will be no Windows option.
- In Ubuntu, type
sudo update-grub
in a Terminal window.
At this point, Windows should show up as an option in the GRUB menu on the next reboot.
An alternative would use the built-in Windows program bcdedit
instead of EasyUEFI, but EasyUEFI is, well, easier, despite being a third-party program that must be downloaded and installed.