Accidental BIOS mode install
I have Intel 64-bit hardware with UEFI setup utility. Ubuntu 14.04.1 LTS was installed as the only operating system on the only drive attached. Accidentally Ubuntu was installed in BIOS/CSM/legacy mode.
Convert to UEFI
While later on learning about UEFI, the goal is to change this existing Ubuntu installation to (quicker) boot via EFI/UEFI. I do still want to have some kind of - 2 seconds displayed - boot menu that allows me to enter the UEFI setup utility. Therefore I think I do need use Grub (can't use an EFI boot stub) and GOP support requires Grub version 1.99 or higher. I have already re-partitioned the drive using a Live CD and inserted a 200 MiB EFI partition in the beginning of the drive and marked that fat16 formatted partition as type id 0xEF.
Before:
# fdisk -l /dev/sda
...
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 108478463 54238208 83 Linux
/dev/sda2 108480510 125044735 8282113 5 Extended
/dev/sda5 108480512 125044735 8282112 82 Linux swap / Solaris
After:
Device Boot Start End Blocks Id System
/dev/sda1 * 411648 108478463 54033408 83 Linux
/dev/sda2 108480510 125044735 8282113 5 Extended
/dev/sda3 2048 411647 204800 ef EFI (FAT-12/16/32)
/dev/sda5 108480512 125044735 8282112 82 Linux swap / Solaris
Partition table entries are not in disk order
No boot-repair please
The Ubuntu community wiki suggests to use boot-repair to Converting Ubuntu into EFI mode. I don't want to use a GUI, or install any extra packages, and I don't want any data being accidentally sent to pastebin.com and because I do want to know what will be changed exactly, I don't want to use Boot-repair.
Under the hood
Trying to figure out what boot-repair actually does, I found this snippet:
Boot-Repair will convert a BIOS install to UEFI by uninstalling grub-pc, and installing grub-efi, if gpt partitioned.
source: http://ubuntuforums.org/showthread.php?t=2147295&p=12657352#post12657352
UEFI mode install comparison
A clean Ubuntu 14.04.1 installation in UEFI mode creates a 512 MiB Fat32 formatted EFI partition. That partition contains one directory /EFI/ubuntu
, containing 4 files: grub.cfg
, grubx64.efi
, MokManager.efi
and shimx64.efi
. The grub.cfg contains:
search.fs_uuid 7d843e47-3917-4114-8725-55dfa1fbe002 root hd0,gpt2
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
Search.fs_uuid points to the UUID of the Linux installation partition, in this comparison UEFI installation Linux is installed partition /dev/sda2 (versus sda1 in BIOS mode installation).
No potential Asrock firmware issues found
Having CSM still disabled in firmware and using the clean UEFI mode Ubuntu installation. Resizing the 512 MiB EFI partition to 200 MiB using a Live CD and gparted
results in that its formatting changes from FAT32 to FAT16. The Asrock firmware P1.50 (incorrectly called BIOS by AMI in boot message "BIOS date") is still able to boot into UEFI mode Ubuntu: UEFI+FAT16 = ok.
Converting the partition table from GPT to MBR (msdos) using the same Live CD terminal command gdisk
and its commands r
g
p
w
also results in a UEFI bootable Ubuntu on an MBR partitioned drive: UEFI+MBR = ok.
Question
Does this mean that the only commands I do need to execute - from the legacy Ubuntu install and in this order - are:
# apt-get install grub-efi
# apt-get remove grub-pc
? Or is more needed to be done?
apt-get install boot-repair
on this Ubuntu server install, results in 245MB of GTK like dependencies boot-repair wants to install. And executingboot-repair
command aftwerwards fails. The update of newer grub-efi naming was really helpful.