57

I have just sat down to install debian 7, which contains something called 'EFI' which is entirely new to me.

I went through the install as I usually do;

  • 256MB /boot partition, bootable, unencrypted
  • Remaining disk size as / partition, encrypted

The installer warned me about 'no EFI partition found' but I ignored it, because I like to live dangerously.

But that installation isn't bootable, grub complains about 'ELF magic' and drops me into rescue mode.

So I'm now running through the installation again, and have found the option for creating an EFI partition. My questions are as follows;

  • What is it?
  • Why do I seem to require one now?
  • Do I still need a separate /boot partition?
  • I have windows 7 installed on the same disk, which always worked fine with grub2 from the mbr, is it possible to rescue that installation as well?

1 Answer 1

62

Your computer has UEFI firmware, a replacement for the old BIOS (although it still has support for BIOS-only operating systems, under the "CSM" name).

  • In BIOS systems, the bootloader (or the "stage1" of a large bootloader) is stored inside the MBR, in the zeroth sector of the disk. (The 512-byte MBR reserves 446 bytes for bootstrap code, the rest is used for partition information.) If the bootloader is too large, its MBR "stage1" code usually tries to find "stage2" files in your /boot partition.

  • In EFI or UEFI systems, the bootstrap code area in MBR is usually empty (most UEFI systems don't even use MBR for partitioning, preferring GPT). Instead, all bootloaders are stored as ordinary .efi programs in an "EFI system partition", which is a regular FAT32 partition with a special "partition type" in the partition table. If you have multiple operating systems, they share the same EFI system partition.

    /boot/efi
    ├── EFI
    │   ├── arch
    │   │   ├── initramfs-linux.img
    │   │   └── vmlinuz-linux.efi
    │   └── gummiboot
    │       └── gummiboot.efi
    ├── loader
    │   ├── entries
    │   │   └── arch.conf
    │   └── loader.conf
    └── SHELLX64.EFI
    

    Some users choose to put the EFI partition at /boot, making configuration a little bit easier for Linux-only systems. But when dualbooting – even if it's two different Linux distros – I suggest having the EFI partition at /boot/efi. A separate /boot is usually unnecessary.)

The EFI partition is required if you want to boot your system in UEFI mode. However, if you want UEFI-bootable Debian, you might need to reinstall Windows as well, since mixing the two boot methods is inconvenient at best.

Both Windows 7 and Debian 7 support both BIOS and UEFI, and they install the apropriate bootloader depending on which mode the installer was booted in. Often, UEFI systems have a "boot mode" switch in their settings screen, having options such as "UEFI only", "UEFI and CSM", "Legacy (BIOS) only", "BIOS, then UEFI", or something similar. (CSM is Compatibility Support Module, the BIOS emulation.)

Your Windows 7 system was probably installed in BIOS mode, but the Debian installer now boots in UEFI mode and offers to install an UEFI-compatible bootloader. (Maybe you flipped the "UEFI/BIOS" switch somewhere. I don't know.)

For now, you can ignore EFI completely and install GRUB2 again into the MBR, possibly using grub-install --target=i386-pc.

2
  • 1
    Great answer! So if I use GPT and EFI, I need just separate "EFI boot partition", "/" (root), "swap", "/home" and that is fine? Jan 28, 2015 at 19:04
  • 3
    @TimurFayzrakhmanov: The minimum required is "/boot (EFI system partition)" and "/ (root)". Jan 9, 2016 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .