Unix & Linux
debian boot uefi
Updated Fri, 20 May 2022 06:52:00 GMT

I messed up my EFI boot, what do I do?


I have Debian Wheezy installed on my computer using EFI boot. It used Grub2 as the bootloader. I then decided to install Arch Linux, using EFI as well, on another partition and chose Grub bootloader over Gummiboot.

When I rebooted my computer, the first Grub menu to display was the one that came with Arch Linux. I tried booting off of it but there was an error and Arch wouldn't boot. It was about an unaligned pointer 0x22 and it advised me to press a key to exit. I did that. Then the Grub menu for Debian came up and I was able to boot into it.

I didn't like having 2 grub menus so I searched for a way to remove the arch grub as it wouldn't boot anyway. That's when I found this post. It basically says that Grub is not necessary for booting and it can be handled by efi stub. I'm using the backported 3.11 kernel so I (thought) didn't need to recompile the kernel.

So I reformatted my EFI system partition and followed the instructions posted by Marco and rebooted. I now only get a blinking cursor.

I've removed the Arch partition and I want to boot back into Debian Wheezy. What do I do?




Solution

I got it up and running now. Originally, I wanted to use the EFI Stub way to boot it but I felt it wasted too much of my time. So I went ahead and re-installed Grub2 EFI in chroot using Mint 16 live USB (UEFI mode).

/dev/sda4 is where my Debian installation resides and /dev/sda1 is my EFS partition.

(mint)$ sudo mount /dev/sda4 /mnt
(mint)$ sudo mount /dev/sda1 /mnt/boot/efi
(mint)$ for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
(mint)$ sudo chroot /mnt
(chroot)# apt-get install --reinstall grub2-efi-amd64
(chroot)# exit
(mint)$ for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
(mint)$ sudo umount /mnt/boot/efi
(mint)$ sudo umount /mnt
(mint)$ sudo reboot

I am planning to install another distro into another partition soon so I'm hoping to not mess up the EFI boot again with 2 Grub2 menus, but I'll just ask again once I cross that bridge.





Comments (4)

  • +0 – You're advised to read the excellent Rod Smith's intro into EFI bootloaders and most probably remove the extra boot entry with efibootmgr; while at that, I maintain ALT Linux Rescue which would also work with SecureBoot left enabled. EFI stub way is either supported by distro or a major PITA to automate locally. — Dec 10, 2013 at 13:37  
  • +0 – @MichaelShigorin I was reading Rod Smith's resource on EFI bootloaders while I was looking for a way to get my computer to boot again. But I needed to get my PC back up quickly, as I had important things to do, and Rod's posts were a bit long so I just decided to revert back to using GRUB2. I will take a look at ALT Linux Rescue soon so I can hopefully achieve my desired boot setup. — Dec 10, 2013 at 15:56  
  • +0 – @riclags when you install your second distro, why not share /boot and thus the grub config between them. One grub install can boot every OS on your machine. It seems silly to chainload from one grub to another. — Dec 10, 2013 at 18:17  
  • +0 – @casey That's what I was expecting. When I installed Arch following the beginners guide, I did mount my EFI partition to /boot/efi. I just followed the guide till the end and one part involved installing a boot loader, either grub or gummiboot. I just realized that I could've just update-grub from Debian so Arch would be added to that grub menu. — Dec 10, 2013 at 23:06