Linux – switch to Legacy Boot from EFI on Debian Linux

bootlinuxuefi

My motherboard died for an AMD Phenom processor, so I ordered a cheap replacement on ebay. It works, but it's old.

I connected my hard drive (it shows a /boot/efi partition in /etc/fstab) to the new motherboard and the bios didn't see the boot. I connected an old hard drive (it does not show a /boot/efi partition in /etc/fstab) to the motherboard, and the bios did see that boot.

There is no option for UEFI in the bios. It's an MSI board with something called 2.2 Tb Infinity on the boot menu, which supposedly is something like UEFI (according to Google), but then again, it's not.

I can now boot both hard drives, because I updated grub from the old hard drive and it found my EFI boot (not sure how that works). But it's a Frankenstein system, and the old hard drive is showing signs of failure.

Is there any way for me to switch my EFI boot to a legacy boot so I don't have to go through another disk to boot? I have all my data saved and could reinstall, but there's a lot of configuration of my system that I don't want to lose or have to redo.

I apologize if I've misdescribed the problem. I'm not a newbie, but I'm not a programmer either. Some things are just a black box to me. Thanks beforehand.

Best Answer

This is for Installation without encrytion. You have to know how you can chroot! The most must be done as root or with sudo.

  1. Download a Live-Linux with the same arch (32-bit or 64-bit)like your
  2. Debian-installation. You can also use your older harddrive and boot from

    USB with it, if you have a chase or adapter for it. The arch mußt be the same too.
    You has later to chroot in your Debian, because we have to install same packages.

  3. comment the entry for /boot/efi in /etc/fstab out.

  4. mount this efi-partition temporary and cp the content from /boot/ folder to the /boot folder in the /-Partiton.

  5. Now we have to create a special partition. Umount every partition from

    your debian-harddrive. Easiest way start gparted. Search for your /boot/efi partition and erase it, create a new one (min. size 4MB)

    • Mount point: none
    • Type: no filesystem
    • Flag: bios_grub

It will be used as raw-device. better english and more information

  1. Control after leaving gparted with parted -l That your new partition have the same output

Number Start End Size File system Name Flags
4 17.4kB 1049kB 1031kB BIOS boot partition bios_grub

Besides Nr. and size. Name and flag is important.

  1. Now you have to chroot in your debian. you need acess to internet too in chroot.

  2. apt update && apt-get install --reinstall linux-image-$(uname -r) linux-headers-$(uname -r) this is for security.

  3. apt install grub-pc This will deinstall the most grub-efi packages.

  4. grub-install /dev/sdx x is a placeholder for the debian-harddrive. you can repeat the configuration from grub-pc with dpkg-reconfigure grub-pc if something went wrong.

  5. check with fdisk -l 2>/dev/null | egrep "Disk /|/dev/" | sed "s#^/dev/#Part /dev/#" | awk '{print $2}' | sed 's/://' | xargs -n1 -IX sudo sh -c "hexdump -v -s 0x80 -n 2 -e '2/1 \"%x\" \"\\n\"' X | xargs -n1 -IY sh -c \"case \"Y\" in '48b4') echo X: GRUB 2 v1.96 ;; 'aa75' | '5272') echo X: GRUB Legacy ;; '7c3c') echo X: GRUB 2 v1.97 oder v1.98 ;; '020') echo X: GRUB 2 v1.99 ;; *) echo X: Kein GRUB Y ;; esac\"" Grub is in the MBR from your debian-hard-drive.

  6. grub-mkconfig and update-grub

  7. Last check compare the output from blkid with entries in /etc/fstab

No errors? Then start debian.

B.t.w. what is a Frankenstein system?

Forgotten one cmd . update-initramfs -u -k all

Related Question