Which commands to convert a Ubuntu BIOS install to EFI/UEFI without boot-repair on single boot hardware?
Start a Ubuntu Linux (14.04) Live CD in UEFI mode. In case of a USB boot device, disable "Fast Boot" in UEFI.
Open a terminal window (Ctrl+Alt+T)
To verify that you are actually running in UEFI mode, use this bash command:
$ [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
The resulting output should be:
UEFI
In case it says BIOS
, reboot into your firmware and correct the boot device preference.
To do the BIOS to EFI/UEFI conversion enter these commands:
$ sudo mount /dev/sda1 /mnt
$ sudo mkdir -p /mnt/boot/efi
$ sudo mount /dev/sda3 /mnt/boot/efi
$ sudo mount --bind /dev /mnt/dev
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /sys /mnt/sys
$ sudo mount --bind /run /mnt/run
$ modprobe efivars
$ sudo chroot /mnt
# apt-get install grub-efi-amd64
Apt-get networking failure?
# rm /etc/resolv.conf
# ln -s ../run/systemd/resolve/stub-resolv.conf resolv.conf
# apt-get install grub-efi-amd64
No apt-get failure
The following extra packages will be installed:
efibootmgr grub-efi-amd64-bin
The following packages will be removed:
grub-gfxpayload-lists grub-pc
...
After this operation, 2,399 kB of additional disk space will be used.
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck --no-floppy --debug
Despite ending in error message:
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
the next reboot already shows "ubuntu" in the firmware its boot options menu, and boots to the console as before, except for now booting in efi mode:
$ dmesg | grep EFI
efi: EFI v2.31 by American Megatrends
fb0: EFI VGA frame buffer device
EFI Variables Facility v0.08 2004-May-17
fb: switching to inteldrmfb from EFI VGA
In case something goes wrong, https://superuser.com/questions/376470/how-to-reinstall-grub2-efi might help.