树莓派 Cannot open access to console. The root account is locked
2012 年 6 月 2 日
前序文章:
昨晚把两块硬盘组成可扩容的lvm盘,挂载信息写入到了 /etc/fstab 中。今天发现机器莫名其妙的重启过,更糟糕的是无法进入系统,屏幕上出现如下错误:
you are in emergency mode. after logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" or ^d to try again to boot into default mode. cannot open access to console, the root account is locked. see sulogin(8) man page for more details. press enter to continue.
按回车系统试图正常启动,可惜最终还是失败。断电重启多次不能解决这个问题。
根据网上信息,大概是fstab信息有问题,导致 /boot 分区和根目录无法正常加载。于是和重置密码 文中一样操作, init=/bin/sh
进入root环境。
先将/boot分区重新挂载:
mount -o remount,rw /dev/mmcblk0p1 /boot
提示boot分区并未加载。用 ls /boot
查看,空空如也。于是先挂载: mount /dev/mmcblk0p1 /boot
,再次用 ls
查看,OK问题解决。
接着重新挂载根目录: mount -o remount,rw /dev/mmcblk0p2 /
。根目录可写后,编辑 /etc/fstab 文件,将引起问题的挂载点注释掉。
然后执行 exec /sbin/init
启动系统,这次终于正常进入系统了。
按惯例,启动后把 /boot/cmdline.txt 文件中的 init=/bin/sh
删除,避免下次又进入root环境。