For those interested, here is a way to install Debian and boot it with UEFI if you have an UEFI motherboard. Using UEFI with Debian requires expert knowledge so if you do not feel up to it, keep your BIOS system.
1 Background
UEFI is a specification for motherboard's firmwares which is replacing the old BIOS. For now, UEFI motherboards still include a BIOS compatibility layer.
The UEFI boot process is quite different from the BIOS one. It involves one specific piece of the motherboard's firmware, the UEFI Boot Manager, which is able to load boot loaders from FAT file systems on specially-typed partitions. It can offer a boot menu (boot: Debian from HDD, Windows from HDD, USB stick, DVD?), which can be configured from a running operating system.
So, basically, to boot a system with UEFI, you need two things:
- to install an UEFI boot loader on a FAT-formated EFI System Partition;
- to tell the UEFI Boot Manager to create an entry for that boot loader.
2 Installation or preparation
If you are installing a new Debian system, read the first part. If you already have a BIOS-bootable Debian system installed, read the second one.
In both cases you will have to use Debian testing, because stable's GRUB has problems with UEFI. You can also use Debian stable while taking only GRUB from testing though.
2.1 Installation of a new Debian system
There is no installer image for UEFI, so you can either:
- make your own, by installing an UEFI boot loader to an USB stick, which will load a regular installer kernel and initrd;
- use a regular BIOS installer image, using the compatibility mode of your motherboard.
The installer does not provide a convenient way to install an UEFI boot loader, so you are going to install a regular BIOS boot loader at first, and switch to UEFI later.
Use the expert mode and format your hard drive with a GUID Partition Table (GPT). Create a small partition (1 MiB would be far enough), type it as a BIOS Boot Partition (this is the untitled flag above the “bootable” one in Partman), do not format it and do not mount it: this will be needed for BIOS booting. Create another small partition (same kind of size), type it as an EFI System Partition (this is the“bootable” flag), format it as FAT and mount it on /boot/efi: this will be needed for UEFI booting.
Finish the installation as usual, installing GRUB for BIOS, and boot your new system.
2.2 Preparation of an existing Debian system for UEFI
You need to use a GUID Partition Table on your hard drive. If you used an MBR, you lost; you may try to convert it to GPT using a tool such as gdisk, but that means operating without a net, loosing your current boot loader in the process.
If there is no space left on your hard drive, use Debian Live to make some. Create a small partition (1 MiB would be far enough), type it as an EFI System Partition, format it as FAT and mount it (permanently, using the fstab) on /boot/efi (that directory will not exist, so create it first).
3 Switch to GRUB UEFI
Install the package grub-efi-amd64. Prepare it by running the command (assuming your hard drive is /dev/sda):
# grub-install /dev/sda
That will do three things:
- generate a GRUB image;
- install it to the EFI partition at efi/debian/grubx64.efi (relatively to this filesystem's root, which means /boot/efi/efi/debian/grubx64.efi in absolute);
- try to configure the UEFI Boot Manager (the motherboard's boot menu) to load it on start-up
That last step will fail. This is expected, because the UEFI Boot Manager can only be configured from an operating system that was started from UEFI. So if you stop here, you get an unbootable system.
Now, copy (a symlink would be relevant here, but that cannot be done on a FAT file system!) the GRUB image to that other path on the EFI System Partition: efi/boot/bootx64.efi (again, relatively to the ESP filesystem's root, which means /boot/efi/efi/boot/bootx64.efi in absolute). This is where the UEFI firmware looks for a boot loader when it has not been configured for a specific path, typically on removable media. Reboot to check that…
If that trick worked, you are now on UEFI-booted system. Run
grub-install
again, which should now succeed to configure the UEFI
Boot Manager. Reboot to check that you get a “debian” entry on the motherboard's
boot menu, and remove efi/boot/bootx64.efi which is
no longer needed.
34 comments
wednesday 25 april 2012 à 20:54 Simon said : #1
wednesday 25 april 2012 à 21:54 Tanguy said : #2
wednesday 25 april 2012 à 22:21 pingouin said : #3
wednesday 25 april 2012 à 22:38 Tanguy said : #4
thursday 26 april 2012 à 13:44 anonymouse said : #5
thursday 26 april 2012 à 14:08 Tanguy said : #6
thursday 26 april 2012 à 16:01 Ben Hutchings said : #7
thursday 26 april 2012 à 16:15 Tanguy said : #8
thursday 26 april 2012 à 17:50 Roderick Smith said : #9
friday 27 april 2012 à 07:26 Coudy said : #10
friday 27 april 2012 à 08:45 Tanguy said : #11
wednesday 22 august 2012 à 16:44 Steve McIntyre said : #12
tuesday 04 september 2012 à 19:48 alexey said : #13
saturday 13 october 2012 à 16:54 scottnyc said : #14
thursday 22 november 2012 à 16:34 r.ductor said : #15
thursday 22 november 2012 à 17:01 Tanguy said : #16
thursday 22 november 2012 à 17:11 r.ductor said : #17
thursday 22 november 2012 à 17:32 Tanguy said : #18
tuesday 27 november 2012 à 03:33 ebeck said : #19
wednesday 06 february 2013 à 12:13 Florent said : #20
wednesday 06 february 2013 à 12:50 Florent said : #21
thursday 28 march 2013 à 19:19 Endy said : #22
saturday 20 april 2013 à 08:24 Giovanni said : #23
monday 22 april 2013 à 09:49 Tanguy said : #24
tuesday 14 january 2014 à 10:17 Olivier Mehani said : #25
thursday 19 june 2014 à 11:49 Milton said : #26
wednesday 10 september 2014 à 22:10 Chavoux said : #27
wednesday 10 september 2014 à 22:33 Tanguy said : #28
thursday 11 september 2014 à 12:21 Chavoux said : #29
thursday 11 september 2014 à 14:45 Tanguy said : #30
sunday 14 september 2014 à 20:36 Chavoux said : #31
monday 15 september 2014 à 09:14 Tanguy said : #32
monday 16 march 2015 à 12:27 3ronco said : #33
monday 30 may 2016 à 03:53 phoenix6142 said : #34