Friday, November 21, 2014

UEFI booting on Linux

All the new laptops and pc's support UEFI. So good bye BIOS, now you have UEFI with more graphics, whistles and bells to manage your computer. The way you boot the OS is changed too.

Before installing the Linux with UEFI booting


To configure your system to support UEFI booting you should check following UEFI settings. Power up your pc and usually you should press F2 or DEL to enter UEFI. If you already have Windows on PC then you can also enter this way to UEFI: http://www.thewindowsclub.com/access-uefi-firmware-settings-windows-8-1

So now you should be in UEFI, please check these settings:
  • Fast boot—This feature can speed up the boot process by taking shortcuts in hardware initialization. Sometimes this is fine, but sometimes it can leave USB hardware uninitialized, which can make it impossible to boot from a USB flash drive or similar device. Thus, disabling fast boot may be helpful, or even required; but you can safely leave it active and deactivate it only if you have trouble getting the Linux installer to boot.
  • Secure Boot—Debian, Fedora, OpenSUSE, Ubuntu, and some other distributions officially support Secure Boot; but if you have problems getting a boot loader or kernel to start, you might want to disable this feature. I personally always do that. To describe how to do so is impossible because the settings vary from one computer to another.
  • CSM/legacy options—If you want to install in EFI mode, set such options off. Some guides recommend enabling these options, and in some cases they may be required—for instance, they may be needed to enable the BIOS-mode firmware in some add-on video cards. In most cases, though, enabling CSM/legacy support simply increases the risk of inadvertently booting your Linux installer in BIOS mode, which you do not want to do. Note that Secure Boot and CSM/legacy options are sometimes intertwined, so be sure to check each one after changing the other.

 

Hard disk and EFI partition


If your disk already contains an EFI partition (eg if your computer had Windows8 pre-installed), it can be used for Debian too. Do not format it. It is strongly recommended to have only 1 EFI partition per disk.

If you don't have an EFI partition that can be created via GParted.
Size: Should be about 250MiB
Type: FAT32
Other: needs a "boot" flag.

On my system the first partition is the EFI partition.
Without that boot partition you system won't boot after installation. Now your pc should be ready for Linux installation.

rEFInd can be used to fix post-installation issues


rEFInd USB

Go to the author's web page http://www.rodsbooks.com/refind/getting.html. Therein you will find updated direct links to all sorts of packaging. To boot from a rescue media, select either the CD iso or the image for USB stick, most firmware offers the choice nowadays.

Unetbootin can be used to write that image to the USB stick.

Boot you pc with rEFInd USB media

Refind will parse your hard drive for installed kernels, and provide you a graphic menu to boot them. Choose your Linux Kernel and boot it.


Reinstall grub-efi on your hard drive

Check that your EFI system partition (most probably /dev/sda1) is mounted on /boot/efi
mount /dev/sda1 /boot/efi

Check that the computer booted in computer in EFI mode:
[ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
should return "EFI boot on HDD".

Reinstall the grub-efi package
apt-get install --reinstall grub-efi

Put the debian bootloader in /boot/efi and create an appropriate entry in the computer NVRAM
grub-install /dev/sda

You can check afterwards that the the bootloader is existing in /boot/efi/EFI/debian/grubx64.efi and that the nvram entry was properly created.
file /boot/efi/EFI/debian/grubx64.efi

/boot/efi/EFI/debian/grubx64.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows

efibootmgr --verbose

You can now reboot, and Grub should greet you.That's all!

Some sources and additional info:
https://wiki.debian.org/GrubEFIReinstall
http://www.rodsbooks.com/linux-uefi/

0 kommenttia:

Post a Comment