Ubuntu 20.04如何重置root密码

重新启动进入 GRUB 菜单。

如果 Ubuntu 20.04 是唯一安装的操作系统,您需要一直按“SHIFT”才能显示 GRUB 菜单。
接下来,当您的“Ubuntu”启动菜单突出显示时,按“e”编辑 Grub 菜单项。

使用上下箭头键,找到 ro quiet splash $vt_handoff这行。
并把 ro quiet splash $vt_handoff改为rw init=/bin/bash

按“F10”启动系统。

我们将进入root shell,无需输入root密码。

执行mount | grep -w /命令,确认root分区以rw挂载。

执行“passwd”命令重置root密码。

执行 exec /sbin/init重启。
使用新密码登录。

故障排除

问题

Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged

使用rw权限挂载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:53 来源:oir作者:oir