Difference between revisions of "Grub Boot Hole Crash"

From Michael's Information Zone
Jump to navigation Jump to search
(Created page with "<pre> set root=(hd0,gpt2) linuxefi /vmlinuz-4.18.0-193.14.2.el8_2.x86_64 root=/dev/mapper/OS-root initrdefi /initramfs-4.18.0-193.14.2.el8_2.x86_64.img relabled, rebooted, di...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
I was hit with the BootHole patch crash<ref>https://arstechnica.com/gadgets/2020/07/red-hat-and-centos-systems-arent-booting-due-to-boothole-patches/</ref> on my personal server. Before I really knew what to do about it I had destroyed my boot partition trying to recover. The official steps from Red Hat<ref>https://access.redhat.com/solutions/5272311</ref> is to downgrade grub, shim, and moktuil, then exclude them from updates. Though they quickly released a fixed shim file<ref>https://access.redhat.com/errata/RHBA-2020:3262?sc_cid=701600000006NHXAA2</ref> which was really the only problem package. In the following I downgraded the others as well.
 +
<br>
 +
<br>
 +
Before I knew what was going on I got frustrated and deleted the contents of my /boot, figuring I needed to learn how to recover this kind of failure. Then I went through the process.<ref>https://www.centlinux.com/2019/12/how-to-recover-grub-2-bootloader-centos-8.html</ref>
 +
*First I booted off install media and entered into recovery.<ref>https://www.linuxsysadmins.com/grub-rescue-in-centos-and-rhel-7/</ref><ref>https://access.redhat.com/solutions/1521</ref>
 +
*Then I bound the install media to sysimage
 +
<pre>
 +
mkdir /mnt/sysimage/install
 +
mount --bind /mnt/install/repo/BaseOS /mnt/sysimage/install
 +
chroot /mnt/sysimage/install
 +
</pre>
 +
*I then removed all the old kernels, leaving just the latest one installed (4.18.0-193.14.2.el8_2). This was to simplify the process as I didn't need the old kernels anyway.
 +
*After creating a test.repo config file pointing to the /install directory, I then downgraded the packages and re-installed the bootloader
 +
<pre>
 +
dnf --repo install downgrade grub2\* shim\* mokutil
 +
grub2-install /dev/sda
 +
</pre>
 +
*Though I was going to rebuild initramfs and vmlinuz, I realized the scripts for doing this run when installing a kernel. Though I tried to reinstall the kernel nothing would happen. Eventually I realized there is a difference between kernel and kernel-core
 +
<pre>
 +
dnf reinstall kernel-core -y
 +
</pre>
 +
*Great, now I have the basic folder structure and initial boot files. However, if I try to reboot I get the grub command line. At which point I have to manually boot.
 
<pre>
 
<pre>
 
set root=(hd0,gpt2)
 
set root=(hd0,gpt2)
 
linuxefi /vmlinuz-4.18.0-193.14.2.el8_2.x86_64 root=/dev/mapper/OS-root
 
linuxefi /vmlinuz-4.18.0-193.14.2.el8_2.x86_64 root=/dev/mapper/OS-root
 
initrdefi /initramfs-4.18.0-193.14.2.el8_2.x86_64.img
 
initrdefi /initramfs-4.18.0-193.14.2.el8_2.x86_64.img
 
+
boot
relabled, rebooted, did again.
+
</pre>
 +
*Silly me, I didn't run the grub2-mkconfig to output to the correct directory on boot. After adding the following I was able to boot again.
 +
<pre>
 +
grub2-mkconfig -o /boot/grub2/grub.cfg
 +
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cgf
 
</pre>
 
</pre>

Latest revision as of 08:53, 3 August 2020

I was hit with the BootHole patch crash[1] on my personal server. Before I really knew what to do about it I had destroyed my boot partition trying to recover. The official steps from Red Hat[2] is to downgrade grub, shim, and moktuil, then exclude them from updates. Though they quickly released a fixed shim file[3] which was really the only problem package. In the following I downgraded the others as well.

Before I knew what was going on I got frustrated and deleted the contents of my /boot, figuring I needed to learn how to recover this kind of failure. Then I went through the process.[4]

  • First I booted off install media and entered into recovery.[5][6]
  • Then I bound the install media to sysimage
mkdir /mnt/sysimage/install
mount --bind /mnt/install/repo/BaseOS /mnt/sysimage/install
chroot /mnt/sysimage/install
  • I then removed all the old kernels, leaving just the latest one installed (4.18.0-193.14.2.el8_2). This was to simplify the process as I didn't need the old kernels anyway.
  • After creating a test.repo config file pointing to the /install directory, I then downgraded the packages and re-installed the bootloader
dnf --repo install downgrade grub2\* shim\* mokutil
grub2-install /dev/sda
  • Though I was going to rebuild initramfs and vmlinuz, I realized the scripts for doing this run when installing a kernel. Though I tried to reinstall the kernel nothing would happen. Eventually I realized there is a difference between kernel and kernel-core
dnf reinstall kernel-core -y
  • Great, now I have the basic folder structure and initial boot files. However, if I try to reboot I get the grub command line. At which point I have to manually boot.
set root=(hd0,gpt2)
linuxefi /vmlinuz-4.18.0-193.14.2.el8_2.x86_64 root=/dev/mapper/OS-root
initrdefi /initramfs-4.18.0-193.14.2.el8_2.x86_64.img
boot
  • Silly me, I didn't run the grub2-mkconfig to output to the correct directory on boot. After adding the following I was able to boot again.
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cgf