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:
- Download the Fedora Server ISO (yes, it's 2.1GB, get over it)
- Install the ISO on a thumbdrive using LiveUSB Creator
- Select the Troubleshooting option, and rescue option, thereby booting into rescue mode
- Congratulate yourself that you go to a command prompt!
- Follow most of the instructions here:
- mount /dev/sda1 /mnt/sysimage/boot
- mount --bind /dev /mnt/sysimage/dev
- mount --bind /proc /mnt/sysimage/proc
- mount --bind /sys /mnt/sysimage/sys
- chroot /mnt/sysimage
- 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
- Turn on system networking: /etc/rc.d/init.d/network start
- Troubleshoot system networking. For me, this included adding my nameserver to /etc/resolv.conf
- Run: yum install grub2-efi-modules
- 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
- Run: grub2-install --target=x86_64-efi --efi-directory=/boot/EFI /dev/sda
- Rejoice that the install appeared to work!
- 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.