0

I want to install Debian (actually Open Media Server, a derivative) by using a Mac laptop (EFI) on a disk (connected via USB), to then transfer it to an headless machine already installed and configured, but the target machine doesn't support EFI, so I want to stick to MBR.

Is it possible to achieve this with the current Debian 11 installer? During the installation process, there was no prompt for it, and EFI was selected, even when I manually created an MBR partition on the disk.

I saw this old question, but it doesn't really answer

Z0OM
  • 1
  • 4
  • 24
  • 56
Nicola
  • 101
  • 3
  • There is no MBR partition. The MBR is stored within the very first 512bytes of your block device, always! You probably mean the GRUBBIOS partition. Just install your Debian with default settings. Boot your Debian from your Mac, login as root, `apt install grub-pc`, `grub-install /dev/sdX`, where `sdX` is your boot device, `dpkg-reconfigure grub-pc`, `grub-mkconfig`, `update-grub` and `update-initramfs -u -k all` and `shutdown now`. Remove the disk from your Mac and connect it to your headless machine. – paladin May 31 '23 at 12:05
  • What I meant by "MBR partition" is a partition within the MBR disk. If the disk is created with the GPT scheme, the BIOS of my old machine won't recognize it: correct? – Nicola May 31 '23 at 18:00
  • No, that's not correct. A GPT partition table will also create a MBR, a so called protective MBR. – paladin Jun 01 '23 at 13:17

1 Answers1

0

In Linux, the choice between MBR vs. GPT partitioning is completely independent of the choice between BIOS vs. UEFI boot method. With Linux, you can have a MBR-partitioned disk booted in UEFI style, or a GPT-partitioned disk booted in BIOS style - but since Windows does not like those configurations, dual-booting Windows in a system configured like that might be impossible or at least would require visiting the BIOS settings to toggle UEFI/BIOS boot modes every time switching between the OSs. The same might be true with other OSs whose boot configurations are not as flexible as Linux's.

You could always tell the installer to skip installing a bootloader, then after the installation is complete (but obviously not rebooted yet), switch to a virtual console that gives you a root prompt. Then chroot into the new installation, and manually install the BIOS version of the bootloader (i.e. apt install grub-pc). It will conflict with grub-efi-amd64 if it's installed, so you'd want to remove that first if necessary.

You'll then want to create a /boot/grub/device.map file that says the USB-connected disk will be (hd0) for GRUB at boot time, and then run grub-install --target=i386-pc /dev/<USB-connected disk>.

While doing the installation on a UEFI system, the grub-mkconfig (called by update-grub) might add an UEFI-specific boot entry for booting into UEFI firmware settings, and that might cause an error if selected on a BIOS-based system. To get rid of it, just run update-grub once the installation is running on the actual target system.

telcoM
  • 87,318
  • 3
  • 112
  • 232
  • What is currently happening is that my disk is converted to GPT, which I believe the BIOS is not recognizing. It's not a matter of Linux (yet) or its boot loader: the BIOS cannot boot anything from that disk: am I wrong? – Nicola May 31 '23 at 17:56
  • A normal BIOS should not even care about partitioning when booting: if the last two bytes of the MBR block have the boot signature (0x55 0xaa), then the BIOS should just load the MBR into memory and attempt to execute its boot code area. Of course, BIOS programmers may have added extra checks in an attempt to provide more user-friendliness to the 1980's firmware design that is the BIOS. – telcoM May 31 '23 at 18:08
  • That assumes a MBR block, right? Anyway, thanks for all the hints: I will be trying this later today – Nicola May 31 '23 at 18:36
  • The MBR block is just block #0 of the disk, and those two bytes are the only thing the BIOS is expected to check before attempting to execute the contents of the block. A GPT-partitioned disk includes a "protective MBR" whose original purpose is to just mark the disk as "in use" for systems that don't support GPT partitioning scheme. But it is possible to install a BIOS-style bootloader to it, in an effort to make a hybrid disk that would be usable - and bootable - on both BIOS-only & UEFI-only systems. – telcoM May 31 '23 at 19:38