22 Comments

      • “you will see a file called cmdline.txt open this text file in Notepad or similar and add the following text to the START of the first line init=/bin/sh”

        Sloppy writing from V5.

        Thank you for taking the time to look up the other tutorial and writing the solution here.

  1. This error is not always an fstab problem. It can also be an unrecovered disk error that prevents root from being mounted RW. Of course if this is the case, fstab can be run since the disk is in RO mode.

    • Yep. It could also be a mucked up /boot/config.txt, which is what I probably did. I’m also wondering if maybe disabling the root password has something to do with it.

      • You should not need to remove the SD card, once you have your raspberry pi booting again. You can just go vi /boot/cmdline.txt , right? 😉

  2. I was editing fstab today, trying to get a network drive to mount automatically and started getting an error [FAILED] Failed to mount /boot. At the end of the error string it tells me I am in emergency mode, then says Cannot open access to the console, the root account is locked.

    I tried your fix, but when I insert init=/bin/sh into the cmdline.txt file it causes kernel panic and the system still doesn’t boot.

    I tried it on the boot partition and the rootfs partition. Is there anything else I can try?

  3. had this problem when I overwritten the /boot folder from the berryboot pack, and still my second OS option did not boot successfully, however I’m getting this account locked error sometimes when booting up, what I do is I hard shutdown my Pi with an argon m.2 case, and then boot it up again and it boots successfully.

    would like to have this fixed permanently though, to avoid anymore further issues

  4. The easiest solution is to connect the SD card to another linux computer, by inserting the SD card in a SD to USB convertor. (= small USB device where you can insert an SD card)
    To find the device : sudo fdisk -l
    Mount the device : sudo mount -t auto /dev/sda2 /mnt (change sda2 to your device)
    Now you can edit the file : sudo nano /mnt/etc/fstab
    Delete the line that contains the bad command : CTRL-K
    Unmount the device : sudo umount -t auto /dev/sda2
    If you have changed the file cmdline.txt: do not forget to leave out ” init=/bin/sh”
    Insert the SD card again in your RPI: everything will work again!

  5. I solved the problem on a Windows by using a VMware or VirtualBox Linux Ubuntu-Image (you can easily find in the internet) in combination with an external USB-card reader (2€ China hardware :-)) . Within the image the Raspberry’s SD card was mounted as “boot” and “roots” (in my case /dev/sdb1 and dev/sdb2 – which may differ on your system). I unmounted first “boot” with “sudo unmount /dev/sdb1” and performed “sudo -c -v /dev/sdb1” (instead of “-v” you can try “-p”). After this I remount the card reader because you need at least one partition of the SD-card mounted, otherwise the complete SD card will be disconnected from the VM and remounted to the host PC. Then I did the same with “rootfs” (in my case “sdb2”) as described before for “boot”. Additionally I also edited the etc/fstab file an removed the mount entries for my both SSD drives where seems to be also a problem solved with “fsck” in the same way.

  6. After all these steps, I got the error message: “Error writing /etc/fstab: Read-only file system”
    What helped me: I directly edited the /etc/fstab file (instead of cmdline.txt) when SD card was out of the RPi and plugged it into my computer (Linux PC). You need to find it out in directory structure (by the way, I have 2 partitions on my SD card).

  7. Another solution for Read-only file system when trying to write fstab, is adding “rw” before “rootwait” in cmdline.txt

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.