I restarted my Raspberry Pi today and wondered why after 5 minutes I still could not connect to my Pi via SSH. I’ve plugged a monitor and had the following error message:
I had a hard drive connected to my Raspberry Pi and mounted it. Then i’ve set up an automount via fstab. The problem was that I had a typo in it. I had entered txt4 instead of ext4 and that caused a total failure. Here is a screenshot:
First, we have to get to our system. We do that through the so-called minimum shell environment.
For this purpose, we turn off our Raspberry Pi, put the memory card in another computer and open the boot partition of the memory card. There we find the file cmdline.txt We attach following to this file:
We do not create a new line, just add the above command to the same line! In the end, the structure should look like this: ... elevator=deadline rootwait init=/bin/sh
After we have done that, we save the file and put the memory card in our Raspberry Pi. It is booted into the minimum shell environment.
Currently we are in “read only mode“. We get the write permission by mounting the root partition in read-write mode. This is done with the following command:
mount -o remount,rw /
Here you will maybe notice that the keyboard layout does not correspond to your keyboard layout. Here is a picture of the layout you will need:
Now we are in read-write mode. This means we can edit fstab with the following command:
In fstab we now have to make the desired changes. I would recommend that you just delete the broken line and continue working in the right system via SSH.
When we have finished the file, we end the editor with Ctrl+X and confirm our changes.
Then we enter the following command twice:
After that we finish our work with:
You will receive many panic messages but do not be scared of it.
Now we can unplug our Raspberry Pi, put our memory card back into another computer, open the cmdline.txt in the boot partition and take out the previously added command (init=/bin/sh), save it and put the card back in our Raspberry Pi. Finished!