Red Hat Enterprise Linux Diagnostics and Troubleshooting
Fix a GRUB2 boot issue on a BIOS-based machine.
Outcomes
You should be able to restore the GRUB2 boot menu on a BIOS-based system with the grubby command.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
[student@workstation ~]$ lab start boot-biosgrub
Instructions
The servera machine was updated to boot with an incorrect kernel. The incorrect boot entry has a label of server.
Change the default GRUB2 boot menu entry to use the kernel entry that does not have the server label.
Open the
serveramachine console. View the error message, which shows that the kernel is absent.error: ../../grub-core/loader/i386/pc/linux.c:170:invalid magic number. error: ../../grub-core/loader/i386/pc/linux.c:421:you need to load the kernel first. Press any key to continue...
Boot the
serveramachine with the kernel entry without the server label. You should see the login screen of theserveramachine....output omitted... servera login:Log in to
serveraas thestudentuser. Switch torootand run thegrubbycommand to query the boot entries.servera login:
studentPassword:student[student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#grubby --info=ALLindex=0 kernel="/boot/vmlinuz-server" args="ro no_timer_check net.ifnames=0 crashkernel=auto" root="/dev/vda3" initrd="/boot/initramfs-server.img" title="Red Hat Enterprise Linux (server) 8.4 (Ootpa)" id="81a31fe4555b4603a2e19b6ec313f8b9-server.0~custom" index=1 kernel="/boot/vmlinuz-server" args="ro no_timer_check net.ifnames=0 crashkernel=auto" root="/dev/vda3" initrd="/boot/initramfs-server.img" title="Red Hat Enterprise Linux (server) 8.4 (Ootpa)" id="81a31fe4555b4603a2e19b6ec313f8b9-server" index=2 kernel="/boot/vmlinuz-4.18.0-305.el8.x86_64" args="ro no_timer_check net.ifnames=0 crashkernel=auto $tuned_params" root="/dev/vda3" initrd="/boot/initramfs-4.18.0-305.el8.x86_64.img $tuned_initrd" title="Red Hat Enterprise Linux (4.18.0-305.el8.x86_64) 8.4 (Ootpa)" id="ffffffffffffffffffffffffffffffff-4.18.0-305.el8.x86_64"Query the default GRUB2 boot entry with the
grubbycommand.[root@servera ~]#
grubby --default-kernel/boot/vmlinuz-serverChange the default GRUB2 menu entry to use the kernel that does not have the server label.
[root@servera ~]#
grubby --set-default=/boot/The default is /boot/loader/entries/ffffffffffffffffffffffffffffffff-4.18.0-305.el8.x86_64.conf with index 2 and kernel /boot/vmlinuz-4.18.0-305.el8.x86_64vmlinuz-4.18.0-305.el8.x86_64Verify that the default kernel is set correctly.
[root@servera ~]#
grubby --default-kernel/boot/vmlinuz-4.18.0-305.el8.x86_64Reboot the system and verify that the default GRUB2 menu entry boots correctly and displays the login prompt.
[root@servera ~]#
reboot...output omitted... servera login: