方法一:
1、啓動時任意鍵暫停啓動
2、按e鍵進入編輯模式
3、將光標移動linux16開始的行,添加內核參數rd.break
4、按ctrl-x啓動
5、mount –o remount,rw /sysroot
6、chroot /sysroot
7、passwd root
8、touch /.autorelabel (打標籤,selinux禁用不用操作這一步)
9、exit
10、reboot
方法二:
啓動時任意鍵暫停啓動
按e鍵進入編輯模式
將光標移動linux16開始的行,改爲rw init=/sysroot/bin/sh
按ctrl-x啓動
chroot /sysroot
passwd root
touch /.autorelabel
exit
reboot