引导进入grub菜单
重启系统,引导到GRUB菜单中。
如果Ubuntu 18.04是唯一安装的操作系统,则需要连续按下Shift
以显示Grub菜单。
编辑grub菜单
选择用于引导系统的菜单并按“e”键。
现在可以编辑菜单项。
找到下面这行
ro quiet splash $vt_handoff
将它改为:
rw init=/bin/bash
然后按“F10”或者“CTRL + X”引导进入单用户模式。
重设密码
确认系统分区已安装为读/写(rw):
# mount | grep -w /
重置root密码:
# passwd
或者,我们可以重置用户密码。
# passwd onitroad
重启系统
使用下面命令重启:
# exec /sbin/init
故障排除
问题
Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error passwd: password unchanged
原因是:root分区以只读方式挂载。
需要改成读写方式:
# mount -o remount,rw /
问题
[ end Kernel panic - not syncing: Attempted to kill init! exit code=0x0007f00
确保在编辑GRUB的菜单项时删除了“Splash”启动选项。
问题
使用“reboot”命令重新启动时:
Failed to connect to bus: No such file or directory Failed to talk to init daemon.
忽略,应该使用下面命令重启:
# exec /sbin/init
日期:2020-07-07 20:55:36 来源:oir作者:oir