樹莓派 Cannot open access to console. The root account is locked

轉載請註明文章出處:樹莓派 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環境。

參考

  1. https://samx18.io/blog/2017/11/05/piBootIssue.html
相關文章
相關標籤/搜索