Bookmark this page

Guided Exercise: Resolving Boot Loader Issues on BIOS Systems

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.

  1. Open the servera machine 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...
  2. Boot the servera machine with the kernel entry without the server label. You should see the login screen of the servera machine.

    ...output omitted...
    servera login:
  3. Log in to servera as the student user. Switch to root and run the grubby command to query the boot entries.

    servera login: student
    Password: student
    [student@servera ~]$ sudo -i
    [sudo] password for student: student
    [root@servera ~]# grubby --info=ALL
    index=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"
  4. Query the default GRUB2 boot entry with the grubby command.

    [root@servera ~]# grubby --default-kernel
    /boot/vmlinuz-server
  5. Change the default GRUB2 menu entry to use the kernel that does not have the server label.

    [root@servera ~]# grubby --set-default=/boot/vmlinuz-4.18.0-305.el8.x86_64
    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_64
  6. Verify that the default kernel is set correctly.

    [root@servera ~]# grubby --default-kernel
    /boot/vmlinuz-4.18.0-305.el8.x86_64
  7. Reboot the system and verify that the default GRUB2 menu entry boots correctly and displays the login prompt.

    [root@servera ~]# reboot
    ...output omitted...
    servera login:

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish boot-biosgrub

 

Revision: rh342-8.4-6dd89bd