Guide on how to fix “Cannot open access to console, the root account is locked.” error.
- Retrieve your SD card from the Pi. Using a PC, insert the SD card using build in port or SD card reader.
- Within File explorer,
/boot
partition of the SD card should be visible. - Within that partition, locate the file cmdline.txt and add the following at the end of the line
init=/bin/sh
. Do not create a new line, just add the above to end of the current line. - Load the SD card back to your pi and boot up.
- You should now get the a root shell prompt.
- Run mount -a command to mount second partition. This will allow to save the
fstab
file - From here undo the changes to
/etc/fstab
by runningsudo nano /etc/fstab
or whatever else that initially broke the system. - Before returning SD card to the pi, remove suffix from step 3.
Source
https://samx18.io/blog/2017/11/05/piBootIssue.html