Tuesday, August 25, 2015

Getting back to booting: Adventures in Fedora 22 Grub Hell

Yesterday, I picked up my Linux laptop from a local repair shop. They were helping me debug a touchpad issue that keeps coming up. They were kind enough to pop out the Linux drive and drop in a Windows one to do some testing; thereby seeing if the issue is hardware or software related. The results are still inconclusive. However, when they returned the laptop to me, the system would no longer boot into Linux.

A quick Google search turned up results like like this one, that implied recovery was going to be a no-brainer. If that wasn't easy enough, there was always SuperGrubDisk, which promised an even easier fix.

Alas, it was not meant to be. After hours of mucking around, I finally gave up. The links I kept finding were either too dated, or just didn't apply to my system. So I did what any smart programmer does when they hit a wall: I went to bed.

This morning, I figured out a recipe for getting back to booting. Here goes:

  1. Download the Fedora Server ISO (yes, it's 2.1GB, get over it)
  2. Install the ISO on a thumbdrive using LiveUSB Creator
  3. Select the Troubleshooting option, and rescue option, thereby booting into rescue mode
  4. Congratulate yourself that you go to a command prompt!
  5. Follow most of the instructions here:
    1. mount /dev/sda1 /mnt/sysimage/boot
    2. mount --bind /dev /mnt/sysimage/dev
    3. mount --bind /proc /mnt/sysimage/proc
    4. mount --bind /sys /mnt/sysimage/sys
    5. chroot /mnt/sysimage
  6. Try running the grub2-install command: grub2-install /dev/sda, but don't panic when it fails with the message missing /usr/lib/grub/x86_64-efi
  7. Turn on system networking: /etc/rc.d/init.d/network start
  8. Troubleshoot system networking. For me, this included adding my nameserver to /etc/resolv.conf
  9. Run: yum install grub2-efi-modules
  10. Try running the grub2-install command: grub2-install /dev/sda, but don't panic when it fails with the message about a missing /boot/efi directory
  11. Run: grub2-install --target=x86_64-efi --efi-directory=/boot/EFI /dev/sda
  12. Rejoice that the install appeared to work!
  13. Yank the thumb drive; reboot; blog about it

I'm sure there's a number of very cool things Grub2 will let me do, and I'm sure I don't care about any of them. I'm just glad to have my system back to booting.

No comments:

Post a Comment