[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Converting a BIOS (CSM) Debian installation into UEFI



With the threads on "Stupid question" and "Throw an hard drive"
in d-u at the moment, this seems timely:

I have a drive which contains two Debian installations, one of which
(B) was installed for BIOS booting, and the other (E) was installed
with EFI booting. I would like to convert B into a EFI system too. ¹

Each system has its own Grub installation, and os-prober has inserted
entries for both systems into both systems. Consequently this means
that I can boot in EFI-mode and run B, and I can boot in BIOS-mode
and run E.

As far as I can tell, the process for B to EFI should just involve:
. boot B in EFI mode
. mkdir /boot/efi/
. add it to /etc/fstab
. mount the ESP onto it
. remove grub-pc, grub-pc-bin
. install (with Recommends) grub-efi-amd64, grub-efi-amd64-bin, grub-efi-amd64-signed,
  shim-signed, shim-signed-common, shim-helpers-amd64-signed, shim-unsigned
. run update-grub
. run grub-install (which should now modify /boot/efi, not the MBR).

Is anything else required for B to become a "native EFI" installation?

This conversion process will, I think, make the system boot into
the EFI-ed B by default. If I want to make E boot by default again,
should I boot E and run update-grub and grub-install?³
Or should I do this by running efibootmgr?

--

¹
More details: B was installed for dual-booting with EFI Windows,
by switching into the BIOS (CMS) for booting B. Since then,
Windows and almost all its entrails (various recovery, data and
reserved partitions) ² have been overwritten with Debian
installation E.

The disk has all the necessary components: GPT partitioning, with
a protective MBR and BIOS boot partition for B's use, and the
original ESP for E's (and B's future) use, plus shared /home
(encrypted), and a random encrypted swap.

²
The ESP still has a "fossil" EFI/Microsoft/Boot/bootmgfw.efi file
which merely causes grub-efi (through os-prober) to write a
useless (but benign) entry in grub.cfg.

³
With totally BIOS systems, if I wanted a system "A" to be the
default system when booted, I could boot A and run update-grub
and grub-install. This would preen A's grub.cfg, and make the
protective MBR boot to it.

Cheers,
David.


Reply to: