1

My Pi was working until I followed this tutorial on how to auto-mount a specific drive on RPi boot. I added the following to the fstab file:

UUID="123091823" /media/pi/"Orange Passport" auto defaults,user,nofail 0 2    

I believe I messed up because I put quotes around the UUID (the above is a random string, I forget exactly what the UUID is), when there shouldn't be any. Now I can't even boot to the command line. I constantly get this error:

enter image description here

And in the bottom middle-left of the screen, I see emergency.service I hit ENTER and after a minute or two, the same issue pops up, only now it says plymouth-start.service in the middle-left corner.

I've edited the cmdline.txt to have init=/bin/sh at the end, and tried to boot, following the instructions here. I've also tried removing that and adding systemd.unit=rescue.target, and that doesn't get me to a command prompt either.

How can I get back in to my Pi to fix this?

(Edit: I've unplugged the USB External drive too, just to be sure).

  • 1
    To get a linux life system on your computer and fix it from there might be the easiest way. – jake Mar 28 at 3:52
  • @jake - Yeah, I am struggling now to get windows to use Ext2Fsd, as I keep seeing that recommended. I'm on Windows 10 and can't get the service to start ("Ext2Fsd could NOT be started."), so now I'm troubleshooting that but getting nowhere fast. I did get a read-only viewer (Disk Internals Linux Reader), and can indeed see the fstab file and the line I added, but can't write/fix it... – BruceWayne Mar 28 at 3:58
  • I can't help you with Windows, because I don't use it. What about flashing Ubuntu to an usb stick? From there you can edit everything. – jake Mar 28 at 4:07
  • @jake ah, good idea. Did that, removed the quotes from the file ...still get errors. I will remove that line completely from fstab and see if it fixes things. (There's also an fstab~ file ...should that be there?) – BruceWayne Mar 28 at 5:30
  • @jake I did sudo nano /media/ubuntu/rootfs/fstab, removed the line completely and put the SD card back in my Pi and it works! ...now it's not detecting my USB drive but I suppose that's a different issue. Care to make this into an answer?? Thanks so much! (Plus I learned how to boot to Ubuntu from usb!) – BruceWayne Mar 28 at 5:34
3

If you want to edit files on the root partition, an easy way is to download some Linux distribution (Ubuntu for example) flash it to an USB stick and boot from it. Here is a tutorial how to do it.

When you successfully booted Ubuntu you can edit your fstab with sudoedit /media/ubuntu/rootfs/etc/fstab

If you want to edit it from "Files" hit Ctrl + l and type admin:///media/ubuntu/rootfs/etc and open the file.

  • That's such an awesome tutorial for someone totally new to this (note for others, I had to press "e" and add nouveau.modeset=0 to the end of the Linux line for it to work from my Dell). Any difference in sudoedit and sudo nano? – BruceWayne Mar 28 at 5:45
  • thanks! It's a little over my head but I get the explanation for why to use sudoedit. I'll definitely read more in to that, cheers :D – BruceWayne Mar 28 at 5:50
  • @BruceWayne I'm glad I could help you! – jake Mar 28 at 5:51
1

You can repair most such problems on the Pi by rebooting to a root shell.

  1. Append init=/bin/sh at the end of cmdline.txt and reboot.
  2. After booting you will be at the prompt in a root shell.
  3. Your root file system is mounted as readonly now, so remount it as read/write
    mount -n -o remount,rw /

You can then edit files.

If you don't get a prompt then presumably the filesystem is not mounted, and you won't be able to run any commands.

You can fix on any Linux system - this can be one on the Pi itself by booting from a new SD Card, and mounting the old card in a SD Card reader.

  • I can't do that. I tried adding init=/bin/sh to the end, and kept getting the same error on startup. I also tried init=/bin/bash (saw that somewhere). I didn't get to the prompt in root shell. – BruceWayne Mar 28 at 4:14

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.