Hi all. I am new here and new to raspberry pi and linux but doing by best to learn.
I am have a pi 3 for retro pie. I tried to mount an external self powered hard drive so that I could bring large size roms to my sd card. I made an error in the fstab (almost certain) and when I saved and rebooted I go into emergency mode.
I have no other machines running linux and have come up with only one way i can think to fix the fstab: buy another sd card and set it up and boot as a new retro pie machine. Then use WinSCP to copy the new virgin fstab over the corrupted one.
Any thoughts on this are appreciated. Another method? Tips? Thank you!
Re: Emergency Mode due to fstab
Welcome to the forums.
Having an extra SD is never a bad idea.
You could also add "init=/bin/sh" at the end of cmdline.txt, in the boot partition of the SD.
That would start you in a minimum shell environment, as root, where you should be able to "mount -o remount,rw /" (to mount the root partition in read-write mode), then "nano /etc/fstab" and comment out the offending line.
Then run "sync" once or twice, then "exit" (and there the OS will panic, this is OK)
After that, power off the Pi, remove "init=/bin/sh" from cmdline.txt, and reboot.
Hopefully the machine will start this time.
(systemd loves to put the system in emergency mode when a drive is missing --or simply just a bit too slow. Look for threads that mention options like nofail, x-systemd-automount, etc.)
EDIT: Add the mandatory remount action I forgot in the initial post, sorry.
Having an extra SD is never a bad idea.
You could also add "init=/bin/sh" at the end of cmdline.txt, in the boot partition of the SD.
That would start you in a minimum shell environment, as root, where you should be able to "mount -o remount,rw /" (to mount the root partition in read-write mode), then "nano /etc/fstab" and comment out the offending line.
Then run "sync" once or twice, then "exit" (and there the OS will panic, this is OK)
After that, power off the Pi, remove "init=/bin/sh" from cmdline.txt, and reboot.
Hopefully the machine will start this time.
(systemd loves to put the system in emergency mode when a drive is missing --or simply just a bit too slow. Look for threads that mention options like nofail, x-systemd-automount, etc.)
EDIT: Add the mandatory remount action I forgot in the initial post, sorry.
Last edited by epoch1970 on Sat Jan 28, 2017 9:41 am, edited 2 times in total.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel
Re: Emergency Mode due to fstab
Does it go right into "emergency mode" or does it stall out? Have you tried hitting the s key for skip when that happens, if it does?Jbar wrote:I am have a pi 3 for retro pie. I tried to mount an external self powered hard drive so that I could bring large size roms to my sd card. I made an error in the fstab (almost certain) and when I saved and rebooted I go into emergency mode.
You should be able to mount the boot partition under windows and then, as the other poster said, look at that which would then allow you to change how it is booting so you could then change out the fstab issue. But you might want to just find any old sdcard that fits in the pi and write tiny core linux, picore, to that. This will let you boot quickly to memory and remove the boot sdcard and replace with the one you are having trouble with. It will even let you chroot and do things that aren't interfering with, I think it is, systemd. Before you put stuff into the fstab, it's a good idea to make sure a version at the command line works correctly. They are formed differently but they should both work and recovery from the command line would be easier.I have no other machines running linux and have come up with only one way i can think to fix the fstab: buy another sd card
Re: Emergency Mode due to fstab
Thank you Epoc1970 for the suggestion. Doing so I am allow to edit fstab but then when I exit I get an error "Error writing /etc/fstab: read-only file system" I did use sudo.
Re: Emergency Mode due to fstab
It should be possible to remount the root filesystem read/write and then edit the file. Something likeJbar wrote:"Error writing /etc/fstab: read-only file system" I did use sudo.
Code: Select all
# mount -o remount,rw /partition/identifier /mount/point
For the cost of burning a DVD blank, you could live-boot the x86 version of Pixel on your Windows computer, mount the sdcard and fix it. After you are done, remove the DVD and reboot your PC back into Windows.Jbar wrote:one way i can think to fix the fstab: buy another sd card and set it up and boot as a new retro pie machine. Then use WinSCP to copy the new virgin fstab over the corrupted one.
Any thoughts on this are appreciated. Another method? Tips? Thank you!
Last edited by ejolson on Sat Jan 28, 2017 5:12 pm, edited 1 time in total.
Re: Emergency Mode due to fstab
Sorry for that, I edited my previous post. In this specific case the command you're looking for is simpler than the generic command offered by ejolson:
"mount -o remount,rw /" (no sudo needed, you're root already)
Good luck.
(I like the suggestion of Pixel live-cd as a rescue workstation.)
"mount -o remount,rw /" (no sudo needed, you're root already)
Good luck.
(I like the suggestion of Pixel live-cd as a rescue workstation.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel
Re: Emergency Mode due to fstab
Thank you Epoc19170 . It worked like a charm.
Tried the pixel boot on windows and found etc/fstab was essentially empty and furthermore I did not have write access (probably my own ignorance).

Tried the pixel boot on windows and found etc/fstab was essentially empty and furthermore I did not have write access (probably my own ignorance).
Re: Emergency Mode due to fstab
I just typed
(I have a Pi model B running 2017-01-11-raspbian-jessie).
- vi /etc/fstab
- reboot -r now
(I have a Pi model B running 2017-01-11-raspbian-jessie).
Re: Emergency Mode due to fstab
Code: Select all
"mount -o remount,rw /"
Code: Select all
umount /
mount -o remount,rw /dev/mmcblk0p2 /
-
- Posts: 26
- Joined: Sat Feb 25, 2017 7:15 pm
Re: Emergency Mode due to fstab
Worked like a charm. Thanks epoch1970.
I had edited fstab and nofail was not in the line I added. I presume this was the reason for the read only boot up
I was trying to add a new user and give them full access to any usb devices without adding them to the root or pi groups. This was just the last in a long line of failures

I had edited fstab and nofail was not in the line I added. I presume this was the reason for the read only boot up
I was trying to add a new user and give them full access to any usb devices without adding them to the root or pi groups. This was just the last in a long line of failures
You should always keep the prime objective in mind.
However, when you’re up to your ass in alligators, it’s hard to remember that you came to drain the swamp.
However, when you’re up to your ass in alligators, it’s hard to remember that you came to drain the swamp.

Re: Emergency Mode due to fstab
Had this happen twice, in my case the pi booted from SD but pointed at external disk /dev/sda1
My solution was to boot from a different SD card only and make sure the HDD was not mounted...
Then
Also watch out for things in your startup (/etc/rc.local) that you may have added that aren't running correctly
My solution was to boot from a different SD card only and make sure the HDD was not mounted...
Then
- fsck /dev/sda1
e2fsck /dev/sda1
Also watch out for things in your startup (/etc/rc.local) that you may have added that aren't running correctly
Re: Emergency Mode due to fstab
hi i got this message a couple of times and ignored it for a couple times but then when I was reading what was wrong I followed the instructions the pi gave me and I followed these steps : then this to reboot it and then type and I rebooted twice and it works just fine.
Code: Select all
journalctl -xb
Code: Select all
systemctl reboot
Code: Select all
systemctl default or ^d
Re: Emergency Mode due to fstab
This is exactly what I needed. I too broke my fstab!! After adding init=/bin/sh to the cmdline.txt, this was the only advice that worked for me.serkanb wrote: ↑Sat Jan 13, 2018 12:18 amcommand didn't work for me. It couldn't find Partition ID so that I tried below commands and it worked.Code: Select all
"mount -o remount,rw /"
Code: Select all
umount / mount -o remount,rw /dev/mmcblk0p2 /