Red Hat Enterprise Linux Diagnostics and Troubleshooting
Reset a root password and repair a boot issue.
Outcomes
You should be able to successfully reset a root password and repair a boot issue.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command modifies the root password and boot parameters.
[student@workstation ~]$ lab start compreview-review2
Important
This lab is intended to practice the technique to use on a physical system that might not be network-accessible. You are asked to assume that you do not have ssh access to serverb, and that the student account on serverb does not have full sudo access. Access a direct virtual console to serverb by using the appropriate method for your classroom environment.
Specifications
Users report that the
serverbsystem displays an error and hangs during the boot process. While troubleshooting, your colleague accidentally modified therootpassword of theserverbsystem to an unknown value.Reset the
rootpassword toredhat.Repair the boot parameters so that the system boots without manual intervention.
Reset the
rootpassword. Ignore the malfunctioning default boot entry for now.If the
grub2boot menu is not visible, then reboot the system.Highlight the
Red Hat Enterprise Linux 8.4 (Ootpa)boot entry, and press e to edit it.Scroll down to the line that starts with
linux, press Ctrl+e to jump to the end of the line, remove allconsole=settings (if any), and appendrd.break.Press Ctrl+x to boot with these modified settings.
Remount the file system on
/sysrootwith read-write capabilities.switch_root:/#
mount -o remount,rw /sysrootChange the root directory to
/sysroot.switch_root:/#
chroot /sysrootSet the
rootpassword toredhat.sh-4.2#
echo "root:redhat" | chpasswdForce SELinux to relabel all files during the next boot.
sh-4.2#
touch /.autorelabelReboot your system by typing
exittwice. On rebooting, select theRed Hat Enterprise Linux 8.4 (Ootpa)boot entry.sh-4.2#
exitexit switch_root:/#exitexitLog in to the console as the
rootuser with the passwordredhat.serverb login:
rootPassword:redhat[root@serverb ~]#
Repair the boot issue.
Query the current boot entries.
[root@serverb ~]#
grubby --info=ALLindex=0 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" index=1 kernel="/boot/vmlinuz-newboot" args="ro no_timer_check net.ifnames=0 crashkernel=auto" root="/dev/vda3" initrd="/boot/initramfs-newboot.img" title="NewBootHopeThisWorks" id="b39b2a9094e24603888d9d5b9ddc2740-newboot"Determine the default
grub2boot entry.[root@serverb ~]#
grubby --default-kernel/boot/vmlinuz-newbootChange the default
grub2menu entry to use the kernel that does not have the newboot label. The version of the kernel will vary.[root@serverb ~]#
grubby --set-default=/boot/The default is /boot/loader/entries/ffffffffffffffffffffffffffffffff-4.18.0-305.el8.x86_64.conf with index 0 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@serverb ~]#
grubby --default-kernel/boot/vmlinuz-4.18.0-305.el8.x86_64Reboot the system and verify that the default
grub2menu entry boots correctly and displays the login prompt.[root@serverb ~]#
reboot...output omitted... serverb login:Return to
workstationas thestudentuser, with the appropriate technique for your classroom environment.