1

I edited my fstab file (/etc/fstab) to mount a new /media local network drive.

After this wrong edition, my Raspberry eventually can't boot anymore. I get the error:

Cannot open access to console, the root account is locked.
See sulogin(8) man page for more details.

My aim is to edit the fstab to correct the mistake and get my Pi bootable again.

3

Since I found the solution myself, I am posting it here, very grateful to every author of the raspberry pi forum posts.

1. Part 1 - getting command line in the boot

Error

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

Solution

  • Mount the SDCard on another computer (any type).
  • Tip: if you don't have a SDCard reader on your computer, use your smartphone.
  • In the FAT32 /boot partition (which should be accessible in Windows for instance), there is a file called cmdline.txt. I appended init=/bin/bash to that file.
  • Now, my Raspberry Pi boot with a root access command line.

2. Part 2 - remount with the commmand line

Error

  • I tried to edit directly with nano /etc/fstab
  • But I get an error mount: can't find PARTUUID=f2d3cb4f-02.
  • I tried to mount the partition in rewrite mode with mount -o remount,rw / but I still got the fstab error

Solution

  • Remount partially only one mounting point with sudo mount -o remount,rw /dev/mmcblk0p2 /
  • Edit the fstab file to fix the mistake
  • Use your other computer to remove the init=/bin/bash from the cmdline.txt
  • Reboot your Raspberry Pi
  • Tada!

Sources

Many thanks to:

  • Why do not edit etc/fstab direct on your other computer? – Ingo Nov 8 '18 at 10:23
  • on windows, I cannot access the right partition, so I couldn't edit the file. I could if I had a Linux or (probably) MacOS – JMax Nov 12 '18 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.