How to reinstall grub after Windows 8.1 upgrade on a HP Pavilion

Recently I made the daft decision to actually update my son’s HP Pavilion laptop …

As expected – Ubuntu was as smooth as silk, no issues and everything was up-to-date in a few minutes.

Then I rebooted into Windows 8. One hour went by – 79 updates later and everything looked ok. I made the fatal mistake – lets install Windows 8.1 – it was a free upgrade – what could go wrong?

Well it hosed the dual boot.  In Microsoft’s infinite wisdom, “I’m the only operating system – lets reset everything the way I want it to be”.

Previously I used boot-repair :

boot repair

On firing up boot-repair, it recogised the laptop had an efi bios.  I hit the advanced options and ticked the “hard coded error” option – this is where it renames your various efi files where a manufacturer such as HP similiarly doesnt recognise / doesnt follow the EFI standards and hard-codes the EFI boot file to be the Microsoft version.

Unfortunately, this time around, this didnt work for me.

Remembering the trials and tribulations last time, no problem I thought … so what follows is how I solved this.

  1. Power on the laptop and immediately hit F9 – yes I mean immediately – if you wait a split second, you’ll miss the chance and Windows 8/Windows 8.1 will boot
  2. Up pops the OS Manager – just select Ubuntu from the list of choices.
  3. Then you’ll see the familiar Grub – let it boot into Ubuntu

Now comes the tricky terminal stuff…

  1. Launch a terminal
  2. Now install the following package
    sudo apt-get install efibootmgr
  3. Now run
    sudo efibootmgr -v
  4. You’ll see in the output a string path corresponding to the Windows OS – it is prefixed with a bunch of garbage and suffixed similarly – but you should see something like
    EFI/Microsoft/Boot/bootmgfw.efi
  5. That is the magic Microsoft EFI boot file we need to replace … so navigate to the folder
    cd /boot/efi/EFI/Microsoft/Boot/
  6. Copy the file bootmgfw.efi to somewhere safe – I put mine in the root folder –
    sudo cp bootmgfw.efi /
  7. Now I copied Ubuntu’s version of this file and overwrite the Microsoft version:
    sudo cp /boot/efi/EFI/ubuntu/grubx64.efi bootmgfw.efi
  8. Reboot – and magic – Grub reappears.  Ubuntu is the first option and Windows 8.1 appears as the option immediately after the Ubuntu recovery

See – never be defeated by Microsoft and manufacturers such as HP that idiotically follow Microsofts line…

Advertisements

2 thoughts on “How to reinstall grub after Windows 8.1 upgrade on a HP Pavilion

  1. Thank you!! I spent several hours and tried many things suggested in the ubuntuforums.org and askubuntu.org before I found your excellent and simple solution. And it works like a charm! For me, there is no problem to boot Windows neither, using the “Windows UEFI boot loader” from GRUB. The file bootx64.efi that a copy remains under /EFI/boot is identical to the file deleted (HP’s “Boot Manager” whose job it is to not allow booting other things than Microsoft). I assume it is this that is used by the Windows GRUB option. I had no idea this dual boot sabotage was a “feature” of HP, which is why I could not understand why all the other solutions did not work for me. I will surely never buy a HP laptop again…

  2. Thanks man! This works, but leaves you unable to boot Windows. To be able to boot both systems, you can do this instead:

    1. Back up the entire contents of /boot/efi (your EFI System Partition, or ESP).
    2. Type sudo mv /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft.
    3. Type cp /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi.
    4. Create a new /etc/grub.d/40_custom file entry that refers to EFI/Microsoft/bootmgfw.efi. Model it after the existing entry in /boot/grub/grub.cfg that refers to EFI/Microsoft/Boot/bootmgfw.efi; just remove Boot from the boot path and give it a new name.
    5. Type sudo update-grub to install the new GRUB entry.

    This is a solution posted by Rod Smith here: http://askubuntu.com/questions/235567/windows-8-removes-grub-as-default-boot-manager

    Cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s