1 , the GRUB start menu interface screen Press "e" key gets into edit mode
2
, set the cursor to the
linux at the beginning of this ⼀ ⾏ press on the keyboard End key ⾏ Jump to ⾏ end, is writing at the end of the following
rd.breakorrd.break console=tty0## If you are operating on the RHEL system or in the RHCSA exam environment, it is recommended to add console=tty0 after rd.breakThe above is only added in the virtual machine or test environment, not required in the physical machine or production environmentAfter entering, press Ctrl+X to run the modified kernel program
3. Re-mount the root directory and give read and write permissions (otherwise the password cannot be reset)
mount -o remount,rw /sysrootParameters: -o remount : remount a file system that has been mounted in a different way.For example, the system that was originally read-only is now re-mounted in read-write mode
4. Switch the root directory location
chroot /sysroot
5. Reset root password
passwd## This will let you enter twice, the first time is the new root password, the second time to confirm the password you just entered
6. If the system has previously enabled selinux , you must execute this command, otherwise it will not be able to restart and reset (this step is very important!)
touch /.autorelabel
7. Exit and restart
exit ## Also Ctrl+Dreboot