If after getting this error message, you rebooted your PC and can't boot Ubuntu because of GRUB booting error, you need to reinstall GRUB manually into the EFI system partition (ESP) through chroot. Here's how I did to fix the problem in my case.
Use Live Session
Boot into your LiveUSB (or LiveCD) and select 'Try Ubuntu without installing'. Later, you may need to ensure you can connect to the Internet on your live session.
Chroot
Let's suppose you installed Ubuntu in /dev/sdXY partition, and an already existed ESP is in /dev/sdXZ partition, on the hard drive /dev/sdX.
Open a terminal and execute these commands :
$ sudo mount /dev/sdXY /mnt
$ sudo mount /dev/sdXZ /mnt/efi
$ for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
(Now, if you customized Ubuntu installation by dividing some directories up into different partitions (eg. '/boot', '/opt', etc.), you should mount them too under `/mnt` directory. You may refer to `/mnt/etc/fstab` file to remember what you did on the installed Ubuntu system)
$ sudo chroot /mnt
Reinstall grub2 with the right EFI version
Once you chroot successfully into your installed Ubuntu system, make sure to (re)install the right grub-efi-* package for your PC architecture :
# apt-get install --reinstall grub-efi-x86_64 (the one I used for Intel i5 CPU)
or
# apt-get install --reinstall grub-efi-amd64
or
# apt-get install --reinstall grub-efi-ia32, etc...
You can get the list of available packages with # apt-cache search ^grub-efi
Please note the --target=x86_64-efi can be different depending on your system (eg. i386-pc by default, maybe amd64-efi, etc.). Check # grub-install --help for more info.
$ for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
$ sudo umount /mnt/efi
(Unmount any other customized partitions, if you had any)
$ sudo umount /mnt
$ sudo reboot
Edited and modified original answer, AFTER further 20+ experiments on both of my machines.
To make it short answer, I will remove all incorrect assumptions and conclusions in the old answer.
----------------My computers ARE
1. Fujitsu LIFEBOOK-LH532, which UEFI BIOS in the mainboard was destroy by ubuntu EFI ubiquity version 12.04, in 2012
https://bugs.launchpad.net/ubuntu/+source/efibootmgr/+bug/1082418
Obviously I choose manual BIOS installation on my NoteBook UEFI LH532.
SINCE I DON'T WANT TO open MY NOTEBOOK TO SHORT CIRCUIT JUMPER cl1&cl2 ON THE MAINBOARD again SINCE I "THE BUG" IS STILL THERE.
***I forced manual BIOS mode by not provide EFI partion on any hard disk.
BUT ALL INSTALLATIONS WILL DETECT UEFI MAINBOARD AND WILL TRY TO INSTALL EFI UBUNTU "FIRST".
Old Gigabyte xenon server non UEFI mainboard.
Which has no errors at all.
The errors exactly as the topic is,
resulted in problems with "UEFI"NOTEBOOK ONLY.
NON botable UEFI notebook(LH532). Ubiquity Destroy the existing UBUNTU GRUB.
"OR IF LUCKY" will just use the old Bios grub installed by 16.04 and boot into new 18.04 (in the old 16.04 partitions) with some error at the beginning of the booting time.
I FIXED THE BOOTING BY
Pain?? complex?
Using Boot-Repair (failed to use grubcustomiser) installed into existing ubuntu installation on other partitions
or BOOTED Live usb.
And follow instructions which were different from one time to the others depend on the configuration of hard disks in the systems as well as the flavour of ubuntu 18.04 used.
Easy and Excellent "most of the time".
I used 16.04 of UBUNTU OR LUBUNTU do a new installaion on other partitions of hard disk in that same computer,
that you have installed "18.04" and failed to install grub with this ERROR.
So that 16.04 will make your system boot.
And yes, you can access to Great 18.04 versions from that 16.04 grub.
And YES, I use UBUNTU 18.04 to write this answer, after LUBUNTU 16.04 INSTALLed NEW GRUB FOR my LH532 notebook with the correct option to choose 18.04.
Reasons for the error of this topic is
you don't provide EFI partitions for the manual "something else" installation mode.
So if you purposely, like me, not to have EFI partition. you will have this error.
But 16.04 versions, have a smarter UBIQUITY or ? whatever? than 18.04.
It will found that you install with BIOS installation (no efi partition in the hard disk) and let you chose to "GO BACK" to install ubuntu with BIOS mode.
But the 18.04 will do installation with out any choice in my case and possible yours.
I will call those poorer quality in these circumstances of 18.04 as "BUG".
But it could be the programmers intention to force us to use only proper clean automation only???, which they should have remove "something else" option.
I have correct the issues by completely REFORMAT my SSD.
Install Windows 10 UEFI mode. Which it automatically create EFI partition.
Then install UBUNTU 18.04 with no errors, though it jealously prohibit me to boot into MANJARO LINUX which I installed after Windows 10 with no issues too.
And of course, UBUNTU 18.04 destroy my BIOS F12.
JEALOUSELY PROHIBIT me to install any other OS, and I have to open the notebook case to short circuit jumper CL1 and CL2 to get F12 to choose boot media back.
I did report this to lunchpad as the link I provide above.
Sorry off the topic a bit but let you all knows there are more bugs in ubiquity or installation process more than this issue.
I had this exact same problem, when installing from a USB flash memory stick using the UEFI boot. When that failed, I followed one of the comments here, booting from the non-UEFI generic flash disk to do the install, and that worked. At the time, I knew nothing about UEFI and had no idea why one method worked but not the other.
Since then, I have looked into it a bit, and now understand that UEFI (Unified Extensible Firmware Interface) is a successor to BIOS and has different requirements. In particular, Linux requires a /boot/efi partition if using UEFI, which I had not created (I was creating the partitions manually).
The error messages could certainly be clearer. The UEFI disk partition program should require the efi boot partition before allowing you to proceed. Instead, it performs most of the Linux install before giving the "GRUB installation failed" error.
If after getting this error message, you rebooted your PC and can't boot Ubuntu because of GRUB booting error, you need to reinstall GRUB manually into the EFI system partition (ESP) through chroot. Here's how I did to fix the problem in my case.
Use Live Session
Boot into your LiveUSB (or LiveCD) and select 'Try Ubuntu without installing'. Later, you may need to ensure you can connect to the Internet on your live session.
Chroot
Let's suppose you installed Ubuntu in
/dev/sdXY
partition, and an already existed ESP is in/dev/sdXZ
partition, on the hard drive/dev/sdX
. Open a terminal and execute these commands :Reinstall grub2 with the right EFI version
Once you chroot successfully into your installed Ubuntu system, make sure to (re)install the right
grub-efi-*
package for your PC architecture :# apt-get install --reinstall grub-efi-x86_64
(the one I used for Intel i5 CPU)or
# apt-get install --reinstall grub-efi-amd64
or
# apt-get install --reinstall grub-efi-ia32
, etc... You can get the list of available packages with# apt-cache search ^grub-efi
Finally, to install grub2 into your drive:
Please note the
--target=x86_64-efi
can be different depending on your system (eg.i386-pc
by default, maybeamd64-efi
, etc.). Check# grub-install --help
for more info.Exit chroot, unbind/unmount safely directories & reboot
# exit
Unmount safely and reboot :
Ubuntu should now boot normally.
References:
Edited and modified original answer, AFTER further 20+ experiments on both of my machines. To make it short answer, I will remove all incorrect assumptions and conclusions in the old answer.
----------------My computers ARE 1. Fujitsu LIFEBOOK-LH532, which UEFI BIOS in the mainboard was destroy by ubuntu EFI ubiquity version 12.04, in 2012 https://bugs.launchpad.net/ubuntu/+source/efibootmgr/+bug/1082418 Obviously I choose manual BIOS installation on my NoteBook UEFI LH532. SINCE I DON'T WANT TO open MY NOTEBOOK TO SHORT CIRCUIT JUMPER cl1&cl2 ON THE MAINBOARD again SINCE I "THE BUG" IS STILL THERE. ***I forced manual BIOS mode by not provide EFI partion on any hard disk. BUT ALL INSTALLATIONS WILL DETECT UEFI MAINBOARD AND WILL TRY TO INSTALL EFI UBUNTU "FIRST".
Which has no errors at all.
The errors exactly as the topic is, resulted in problems with "UEFI"NOTEBOOK ONLY.
I FIXED THE BOOTING BY
https://help.ubuntu.com/community/Boot-Repair
So that 16.04 will make your system boot. And yes, you can access to Great 18.04 versions from that 16.04 grub.
And YES, I use UBUNTU 18.04 to write this answer, after LUBUNTU 16.04 INSTALLed NEW GRUB FOR my LH532 notebook with the correct option to choose 18.04.
Reasons for the error of this topic is you don't provide EFI partitions for the manual "something else" installation mode.
So if you purposely, like me, not to have EFI partition. you will have this error.
But 16.04 versions, have a smarter UBIQUITY or ? whatever? than 18.04. It will found that you install with BIOS installation (no efi partition in the hard disk) and let you chose to "GO BACK" to install ubuntu with BIOS mode. But the 18.04 will do installation with out any choice in my case and possible yours.
I will call those poorer quality in these circumstances of 18.04 as "BUG". But it could be the programmers intention to force us to use only proper clean automation only???, which they should have remove "something else" option.
Then install UBUNTU 18.04 with no errors, though it jealously prohibit me to boot into MANJARO LINUX which I installed after Windows 10 with no issues too.
And of course, UBUNTU 18.04 destroy my BIOS F12. JEALOUSELY PROHIBIT me to install any other OS, and I have to open the notebook case to short circuit jumper CL1 and CL2 to get F12 to choose boot media back.
I did report this to lunchpad as the link I provide above.
Sorry off the topic a bit but let you all knows there are more bugs in ubiquity or installation process more than this issue.
I have a similar error when installing ubuntu 18.04 from boot USB. I made a BOOT CD and installation was successful.
I think you have three options:
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/1771651
I hope this helps, regards,
Onno
I had this exact same problem, when installing from a USB flash memory stick using the UEFI boot. When that failed, I followed one of the comments here, booting from the non-UEFI generic flash disk to do the install, and that worked. At the time, I knew nothing about UEFI and had no idea why one method worked but not the other.
Since then, I have looked into it a bit, and now understand that UEFI (Unified Extensible Firmware Interface) is a successor to BIOS and has different requirements. In particular, Linux requires a /boot/efi partition if using UEFI, which I had not created (I was creating the partitions manually).
The error messages could certainly be clearer. The UEFI disk partition program should require the efi boot partition before allowing you to proceed. Instead, it performs most of the Linux install before giving the "GRUB installation failed" error.