Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

After successfully updating my bios, something went wrong and I ended up with a blinking cursor on the top left corner of a black screen. No errors, no nothing. The bios now only listed a SATA: <disc name> boot option in place of the usual UEFI ubuntu one. I'm using a GPT partitioning scheme.

I eventually found that the working solution was to properly reinstall grub-efi-amd64. So, how do I do this ?

PS: Actually, i succeeded to reinstall GRUB2 EFI on my own and will post my answer here as I was unable to find any complete how-to on this.

share|improve this question
add comment

4 Answers

up vote 26 down vote accepted
  • Boot your computer with a live-usb/CD in UEFI mode. I had two boot options <flash_drive> and UEFI: <flash_drive>, the second is needed to expose the efi variables in /sys/firmware/efi/ so that efibootmgr don't fail later on. Booting with the first option gives me the following error:

    Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
    Try 'modprobe efivars' as root.

    modprobe efivars did'nt work for me.

  • chroot into the broken system (similar to the ubuntu grub2 help but with efi specificities):

    sudo mount /dev/sda2 /mnt #sda2 is my root partition
    sudo mount /dev/sda1 /mnt/boot/efi #sda1 is my efi partition
    for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
    sudo cp /etc/resolv.conf /mnt/etc/ #makes the network available after chrooting
    modprobe efivars # make sure this is loaded
    sudo chroot /mnt
  • Depending on your linux distribution, you now do different things.

    • For Ubuntu/Debian:

      apt-get install --reinstall grub-efi-amd64
      or alternatively: 
      apt-get install --reinstall grub-efi
      should the above give you a grub, but not a bootable one
    • For Fedora (up to 16, may work for others):

      yum reinstall grub-efi

      In the following command, you have to replace sdX with the device which has the EFI partition you want to boot from. In --part Y you have to replace the Y with the number of the EFI partition (as in /dev/sdXY).

      efibootmgr -c --disk /dev/sdX --part Y
      efibootmgr -v # verify a new record called Linux is there
  • Now type Ctrl+D to exit chroot, unmount everything and reboot:

    for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
    sudo umount /mnt/boot/efi #please do this. corrupted efi partitions are not nice
    sudo umount /mnt
    sudo reboot

You may need to adapt this to your needs (different partition table, separate /boot partition, etc.) and it may not be the only option but this worked just fine for me.

A suitable live-system for fixing things is grml. There is also an extensive guide on how to setup a bootable USB device, of which the Mac section is the most useful actually (just create FAT32 partition, copy the files, reboot, done).

share|improve this answer
Dude! Thanks so very much! This just saved me after my Lenovo X220 didn't want to boot anymore after a reset, which activated the latest package updates and at the same time saw me doing a BIOS reset because that supposedly fixes connection problems with the 3G card. After that booting became impossible, for whatever reason. Until I used your guide. BTW, the part were you copy resolv.conf didn't work for me, because it is a symlink into /run/resolvconf... (in Ubuntu 12.04), instead I just used mount --bind /run /mnt/run to mount the whole /run directory in the chroot environment. –  nem75 Oct 9 '12 at 20:35
I extended the answer with my experiences for Fedora 16 and a reference to grml. If you could review and accept the edit, I'd be happy. –  Jonas Wielicki Dec 9 '12 at 11:26
Also, many thanks, you rescued my system after bios upgrade :) –  Jonas Wielicki Dec 9 '12 at 11:29
You probably don't need to reinstall the grub-efi (or grub-efi-amd64) package in most cases. That just replaces the files in /usr that update-grub or grub-install reads from, and those most likely haven't changed. They're not affected by motherboard firmware updates. –  Wyzard Dec 9 '12 at 15:24
Saved my media player yesterday. 300 internet points to you. –  Stefano Borini Sep 12 '13 at 17:21
show 5 more comments

I would up-vote this, but apparently I don't have enough rep on SuperUser. I'm glad I finally found an answer to this after days of fighting clones that worked but wouldn't boot. I think it all relates to UEFI and some kind of "secure booting" mechanism or something.

I'm working off-line, so apt-get wasn't an option. What I did was put Ubuntu Desktop on a USB stick, add the grub-efi and grub-efi-amd64 packages to the root of the USB stick (grub-efi_1.99~rc1-13ubuntu3_amd64.deb and grub-efi-amd64_1.99~rc1-13ubuntu3_amd64.deb for Ubuntu 11.04 - change as appropriate for distro and architecture), and put the following in a script on the USB stick as well:

#! /bin/bash
sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
dir=`dirname $0`
sudo cp $dir/grub-efi*.deb /mnt/tmp
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt /bin/sh -c "dpkg -i /tmp/grub-efi*.deb"
sudo shutdown -r now

Boot up the Live USB stick, open a terminal, run the command, and the job is a good 'un! The only occasional problem is that UEFI sometimes got moved down the boot priority order below the HDD, at which point you need to go into the BIOS and change the boot order to stop it trying (and failing) on SATA: drive.

You can also use dpkg-reconfigure instead of dpkg -i, but that asks a couple of boot loader questions.

[edit] I also don't have enough rep to comment, so what I thought was a comment on a reply turns out to be a reply.

share|improve this answer
Welcome on board! Actually you need 15 points to vote, 50 to comment (see superuser.com/privileges), just look around for easy questions you can answer and you're good to go, that's the stackexchange way to say thanks :) Beware your script doesn't unmount anything before shutting down. Glad it helped. –  Maxime R. Mar 2 '12 at 8:38
Confusion was more because I've got accts on other related sites. Forgot I was new to this side. Linux normally unmounts on shutdown, and chroot with a command returns after it finishes, so I don't think it should cause a problem. I did find that it won't abort if you didn't UEFI boot the live distro, but it wasn't a priority to test whether sudo chroot /mnt /bin/sh -c "dpkg -i /tmp/grub-efi*.deb" && sudo shutdown -r now gave the right behaviour. –  IBBoard Mar 2 '12 at 19:24
add comment

As a potential simplification of the first method, it is possible to directly boot into the system on the hard disk, only using grub of the live CD. Tested on xubuntu 13.10 with the xubuntu 13.10 live CD.

Make sure that Secure Boot is disabled in your BIOS. Insert the live CD and boot it via UEFI. The CD's GRUB menu will show. the Press "c" to get to the command line.

configfile (hd0,gpt1)/EFI/ubuntu/grub.cfg

Adapt the grub command above if you have a different EFI system partition.

After your system has booted from the hard disk, it should be enough to re-install grub on the EFI system partition and to register it with the firmware via grub-install.

sudo grub-install
share|improve this answer
add comment

As with Maxine, I found my UEFI settings in BIOS to get damaged and my machine wouldn't boot.

In my case, it's a Lenovo ThinkServer RD430 with Linux Mint Debian and it seemed anything I'd do about update-grub or changing any hard drives in the server would cause it to not boot. OS in my case is linuxmint-201403-mate-dvd-64bit installed via USB. (see below for a complete description of the events that would cause UEFI to not work)

Going through exactly the same steps on a ThinkServer TS140 did not result in UEFI losing its mind even once. Looked at RD430 driver page and my bios is two versions old. I have never had to update bios on a motherboard before, so I'm not one to automatically update when there are new versions available. After updating the bios, Maxine's answer above worked, only with a twist...

# efibootmgr -c --disk /dev/sdX --part Y
# efibootmgr -v
BootCurrent: 0004
Timeout: 1 seconds
BootOrder: 0002,0000,0003,0001,0004
Boot0000* linuxmint HD(1,800,1f4000,829f6cc9-5b17-479c-b3ea-61e43faecbf7)File(\EFI\linuxmint\grubx64.efi)
Boot0001* LMDE Linux Mint Debian    HD(1,800,15d505800,934c598c-fe3c-fd43-84a1-fa38e4f72552)File(\EFI\linuxmint\grubx64.efi)
Boot0002* Linux HD(1,800,1f4000,829f6cc9-5b17-479c-b3ea-61e43faecbf7)File(\elilo.efi)
Boot0003* UEFI: Built-in EFI Shell  Vendor(5023b95c-db26-429b-a648-bd47664c8012,)AMBO
Boot0004* UEFI: VerbatimSTORE N GO 1.00 ACPI(a0341d0,0)PCI(1a,0)USB(1,0)USB(4,0)HD(1,80,1d70780,00000000)AMBO
mint / # 

The efibootmgr -c command added two entries 0000 and 0002!
The Boot0002* Linux HD entry first in boot order is not correct.
The 0000 entry is correct.

To test this, I tried booting without any interruption, which is the 0002 entry. As expected, it didn't work. So I restarted the server, hit F12, and chose linuxmint. As hoped for, it did boot to my LMDE installation.

The way to remove unwanted entries via efibootmgr is:

# efibootmgr -b 2 -B

I used this command to remove entries 0001 and 0002. Option 0001 was from the last of my many attempts to recover the OS.

UEFI notes

If you're reading this and as frustrated with UEFI as I am/was, here are some notes and resources:
» Booting to UEFI Shell is akin to using a DOS shell.
» Intel made a PDF reference manual for efi shell commands.
» Lenovo's UEFI_on_TS430 document is the only resource I have seen explaining usage of efi shell.
» Another uefi shell reference from nPartition Administrator's Guide.
» You can try booting to a partition from the efi shell by navigating to the loader and executing it.
» UEFI wants the disk to have a GPT partition table, not msdos part table.
» UEFI wants the first partition on your disk to be formatted fat32 or vfat.
» For a "generic" boot there must be a /EFI/boot directory at the root with bootx64.efi in it.
» Some people copy their grubx64.efi from where it was installed to /EFI/boot/bootx64.efi and this cheat worked for them.
» Anytime you make grub changes, use efibootmgr -v before and after to ensure your reboot is ok.

My RD430 experience

I have resinstalled the OS 10+ times in the past week trying to sort this out and set up the server. My configuration is a SSD on this RAID controller in the PCIe 2.0 slot with LMDE installed on it. AOC-S3008L-L8i RAID controller (reflashed to IT mode) in the 2nd PCIe 3.0 slot with 6x 3TB drives. RAM: 12GB ECC (3x 4GB).

Here are changes I would make that caused my system to not boot:
» Change S3008L-L8i pci slots (leaving the SSD+card alone).
» Disable the LSi software raid bios prompt for onboard controller.
» Add my old HighPoint RocketRaid card to an open PCIe slot.
» Make a change to /etc/default/grub and then run update-grub.
(maybe grub-install needs to be run as well?)

share|improve this answer
add comment

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.