I’ve been battling for a long time with this so I better share the fix with the world and with myself a few months from now when I’ve forgotten everything.
Since a year ago, Windows Update started to fail consistently. It would reboot, go to 99% and then write “We couldn’t complete the updates. Undoing changes”. Followed by two or three slow reboots to undo everything.
After trying many things, this is the exact sequence that worked for me:
Create a Linux boot repair USB (and maybe also a Windows install media USB just in case).
Boot into Linux (not the boot repair, your normal Linux partition).
Run:
sudo efibootmgr
It will show something like:
BootCurrent: 000D
Timeout: 1 seconds
BootOrder: 000D,000C
Boot000C* Windows Boot Manager
Boot000D* ubuntu
Note the code next to ubuntu (or your Linux distro). In my case it would be
000D
.
- Run:
sudo efibootmgr -B -b 000D
Changing 000D
for the code in the step above.
- Mount the EFI partition:
sudo mkdir /media/efi
sudo mount /dev/whatever /media/efi
Change the whatever
for the actual device of your EFI partition (if you are
unsure you can use gparted to explore your disks and partitions).
- Go to
/media/efi
and nuke the ubuntu directory AND the Microsoft recovery directory:
cd /media/efi
sudo rm -rf EFI/ubuntu # could have another name with other distros
sudo rm -rf EFI/Microsoft/Recovery
Reboot to Windows. Do a Windows Update but wait for it to download before rebooting (for some reason my system prompted my to reboot even before it was fully downloaded).
Reboot and update, hopefully it will work this time.
Boot the Linux rescue USB and restore grub.
And that’s it.