转载请注明文章出处:树莓派 Cannot open access to console. The root account is lockedhtml
前序文章:code
昨晚把两块硬盘组成可扩容的lvm盘,挂载信息写入到了**/etc/fstab**中。今天发现机器莫名其妙的重启过,更糟糕的是没法进入系统,屏幕上出现以下错误:cdn
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.
<a href="https://tlanyan.me/cannot-open-access-to-console-the-root-account-is-locked/emergency-mode/" rel="attachment wp-att-5905"><img src="https://user-gold-cdn.xitu.io/2019/11/3/16e2f4094fa3cad1?w=1024&h=768&f=jpeg&s=115082" alt="raspberry pi emergency mode" width="665" height="499" class="aligncenter size-large wp-image-5905" /></a>htm
按回车系统试图正常启动,惋惜最终仍是失败。断电重启屡次不能解决这个问题。blog
根据网上信息,大概是fstab信息有问题,致使**/boot**分区和根目录没法正常加载。因而和 重置密码 文中同样操做,init=/bin/sh
进入root环境。rem
先将/boot分区从新挂载:get
mount -o remount,rw /dev/mmcblk0p1 /boot
提示boot分区并未加载。用ls /boot
查看,空空如也。因而先挂载:mount /dev/mmcblk0p1 /boot
,再次用ls
查看,OK问题解决。cmd
接着从新挂载根目录:mount -o remount,rw /dev/mmcblk0p2 /
。根目录可写后,编辑**/etc/fstab**文件,将引发问题的挂载点注释掉。raspberry-pi
而后执行exec /sbin/init
启动系统,此次终于正常进入系统了。it
按惯例,启动后把**/boot/cmdline.txt**文件中的init=/bin/sh
删除,避免下次又进入root环境。