轉載請註明文章出處:樹莓派 Cannot open access to console. The root account is lockedhtml
前序文章:spa
昨晚把兩塊硬盤組成可擴容的lvm盤,掛載信息寫入到了**/etc/fstab**中。今天發現機器莫名其妙的重啓過,更糟糕的是沒法進入系統,屏幕上出現以下錯誤:code
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.
複製代碼
按回車系統試圖正常啓動,惋惜最終仍是失敗。斷電重啓屢次不能解決這個問題。cdn
根據網上信息,大概是fstab信息有問題,致使**/boot**分區和根目錄沒法正常加載。因而和 重置密碼 文中同樣操做,init=/bin/sh
進入root環境。htm
先將/boot分區從新掛載:blog
mount -o remount,rw /dev/mmcblk0p1 /boot
複製代碼
提示boot分區並未加載。用ls /boot
查看,空空如也。因而先掛載:mount /dev/mmcblk0p1 /boot
,再次用ls
查看,OK問題解決。rem
接着從新掛載根目錄:mount -o remount,rw /dev/mmcblk0p2 /
。根目錄可寫後,編輯**/etc/fstab**文件,將引發問題的掛載點註釋掉。get
而後執行exec /sbin/init
啓動系統,此次終於正常進入系統了。cmd
按慣例,啓動後把**/boot/cmdline.txt**文件中的init=/bin/sh
刪除,避免下次又進入root環境。raspberry-pi