I got a computer running Ubuntu 12.04 64bit with UEFI. Today (2013-09-21) I installed all updates that were available without carefully reading through the list (shame on me), since noone touched the computer for some weeks and the list was more than 100 items long...
I remember from another machine, that one of the updates changes the boot system on UEFI machines in order to always use shim, even if restricted boot is disabled.
Well, problem diagnosis is rather straightforward: Something went wrong with the bootloader update, although no error was given, and the Ubuntu entry went missing from the UEFI boot menu, making the computer try to boot in BIOS mode, of course failing. If I run efibootmgr
from a bootable USB it only shows the BIOS boot mode for the HDD...
How do I restore the Ubuntu entry in the UEFI menu to make the machine bootable again?
A simpler solution than the one provided by soulsource is:
efibootmgr
.sudo efibootmgr -c -d /dev/sda -p 1 -l \\EFI\\ubuntu\\grubx64.efi -L Ubuntu
. Changegrubx64.efi
toshimx64.efi
if you're booting with Secure Boot enabled. Change-d /dev/sda
to your boot disk if it's not/dev/sda
, and change-p 1
to the number of your EFI System Partition (ESP). (The command I provided assumes the ESP is on/dev/sda1
, which seems to be the case based on the information you've provided.)The Boot Repair tool can also fix the problem, but it will try to do more than simply restore the original GRUB entry. This opens the possibility for it to cause damage by accident, so if you're comfortable with issuing shell commands, I recommend running
efibootmgr
manually for this task.It's also possible to do the same thing using the Windows
bcdedit
command or the EFI shell'sbcfg
command. The Installing rEFInd Manually section of my rEFInd documentation describes how to use these commands to register rEFInd with the firmware. You should be able to easily adapt these commands for GRUB.While formulating the question I found a solution myself, although I'm not convinced this is the suggested way to deal with the issue.
First I booted off a Ubuntu 12.04 64bit USB flash drive in UEFI mode. Then I mounted the file systems from the HDD in the correct order (in the following, replace the device nodes with the correct ones for your system of course:
Then I chrooted to the now mounted HDD:
Now, there are guides online that tell to run grub-install with a lot of fancy arguments. Those mady my computer crash... Finally it was as simple as to run
without any arguments. Now, if I run
efibootmgr
I got a new entry named Ubuntu and put on top of the boot option list (and having number 0000).After a reboot, the system worked again. I'm just afraid that the next update of the kernel, grub, or anything else that has to do with booting might break the system again...