①在开机/重启的时候,在下图页面按上下键取消引导,然后按e进入grub模式

image-20210106154905830

②使用方向键找到linux16开头的那一行,修改ro后面为rw rd.break init=/sysroot/bin/sh

image-20210106155304240

img

③在shell里面进行下面的操作之后就可以了

switch_root:/# mount -o remount,rw /sysroot #挂载/sysroot
switch_root:/# chroot /sysroot #切换至系统
sh-4.2# passwd root #更改密码
sh-4.2# touch /.autorelabel #更新系统信息文件(使selinux生效,否则不成功)
sh-4.2# exit
switch_root:/# reboot

image-20210106160226731

最后修改:2021 年 01 月 06 日
如果觉得我的文章对你有用,请随意赞赏