Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

A simpler solution than the one provided by soulsource is:

  1. Boot with an emergency disc in EFI mode. The Ubuntu installation disc should work for this.
  2. If necessary, install efibootmgr.
  3. Type sudo efibootmgr -c -d /dev/sda -p 1 -l \\EFI\\ubuntu\\grubx64.efi -L Ubuntu. Change grubx64.efi to shimx64.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's bcfg 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.

share|improve this answer
Looks good to me. Although I don't have access to an UEFI computer until the weekend and therefore cannot try your answer, I think I can accept it. – soulsource Sep 22 '13 at 13:31

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:

sudo -i #to get a root shell
mount /dev/sda4 /mnt           #Root partition
mount /dev/sda2 /mnt/boot      #Boot partition
mount /dev/sda1 /mnt/boot/efi  #efi partition

Then I chrooted to the now mounted HDD:

mount -o bind /dev /mnt/dev    #make system folders available in chroot environment
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
chroot /mnt

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

share|improve this answer
I might file bug report. Only concern is that without log files or some history they may not consider it and think it just is user. Review log files and check grub configuration. see what this says sudo debconf-show grub-pc – oldfred Sep 21 '13 at 15:21
I'm afraid I won't have access to the PC where I encountered the issue until next weekend. I'll have a look at the log files then (if I don't forget...). – soulsource Sep 22 '13 at 13:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.