Fixing Windows update problems on a UEFI system with dual boot (grub)

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:

  1. Create a Linux boot repair USB (and maybe also a Windows install media USB just in case).

  2. Boot into Linux (not the boot repair, your normal Linux partition).

  3. 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.

  1. Run:

sudo efibootmgr -B -b 000D

Changing 000D for the code in the step above.

  1. 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).

  1. 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
  1. 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).

  2. Reboot and update, hopefully it will work this time.

  3. Boot the Linux rescue USB and restore grub.

And that’s it.

Contents