Turn on the centos8 virtual machine, press the up and down keys in the interface of Figure 1 to select the first line
As shown in Figure 1
Press the'e' key to enter the Figure 2 interface, and move the down arrow key to the line starting with "linux16". Then press the right arrow key to move, find "ro" and modify it to "rw init=/sysroot/bin/bash
". (There is a space after rw, \ is added by the system itself), as shown in Figure 3.
as shown in picture 2
As shown in Figure 3
Hold down the Ctrl and x keys at the same time, the system enters the following interface, namely emergency (emergency) mode. As shown in Figures 4 and 5.
As shown in Figure 4, this interface has a long waiting time, so be patient.
As shown in Figure 5
chroot /sysroot/
" to switch back to the original system (centos7), and then you can modify the password. After modifying the password, run the command "touch /.autorelabel
" to make SELinux effective and the password effective. As shown below. (If the following box is garbled (vmware does not support Chinese characters, so the box is displayed), temporarily set the current terminal language to English). As shown in Figure 6./# chroot /sysroot//# LANG=en (change language to English)
/# passwd
/# touch /.autorelabel
As shown in Figure 6
5. Hold down the "Ctrl+d" keys at the same time, enter "reboot", and press the Enter key to restart the system. As shown in Figure 7.
As shown in Figure 7
As shown in Figure 8
As shown in Figure 9
At this point, the root password of the centos8 system has been modified!
Recommended Posts