Debugging

Cannot open access to console, the root account is locked.

LEEHANDS 2022. 9. 27. 10:31
반응형

Raspberry Pi

 

If your Rasberry Pi (RPI) won’t boot and is showing “Cannot open access to console, the root account is locked.”  on the boot screen.

Don’t sweat. It can be fixed with a little work.

You were probably editing /etc/fstab and have put in an unsupported entry. What’s happened is now on next boot it’s tried to load this entry, which doesn’t work, and it’s locked the Pi from starting up.

To fix this get your SD card out of the RP and plug it into your computer. Ignore the requests to format the card (don’t format it or you’ve lost everything). One of the drives will have data on it and you will see a file called cmdline.txt open this text file in Notepad or similar and add the following text to the end of the first line init=/bin/sh

Save the file and put the SD card back into the RPI and power it up. You will need a keyboard plugged into the RPI for the next step and be viewing the output via HDMI.

Part way through startup the pi will now switch into bash (the console). This will enable you to go and fix the /etc/fstab file. If you were messing with that in the first place then you should already know how to use the command line, so I wont cover that here. Essentially what you need to do is:

  • sudo nano /etc/fstab
  • remove the faulty line (ctrl+k to remove line)
  • Save the file
  • Take the SD card back out and remove the init=/bin/sh from the
    cmdline.txt
  • Reboot the Pi and it should now work fine

However, sometimes you wont be able to write to the file and may need to remount your partitions. You can do this by running

  • mount -o remount,rw / –target /

before the steps above.

 

 

반응형