Zef
Posts: 2
Joined: Wed Sep 13, 2017 10:33 am

Emergency mode and root account locked (mounting disk with fstab)

Wed Sep 13, 2017 10:44 am

Hi everyone, I think I messed up big time.

I followed the tutorial on how to create a NAS on a Raspberry Pi. Everything was working fine and I was able to connect to the NAS with all my equipment (Windows PC, Linux, iOS, ...).

I rebooted the Pi and I'm now greeted with this :

Image

I noticed that the problem is probably coming from my fstab in which I added a line that automaticaly mounts a USB Stick on the NAS. (See here)

Image

I guess I made a mistake in that line and it is now messing everything up.

Sooo I'm in emergency mode and I have absolutely no access to the console because the "root account is locked" aswell ... any ideas ? :oops:
Thanks for yout time !
Developper of @GraffitiEngine (Twitter) and Raspberry Pi enthusiast.

Zef
Posts: 2
Joined: Wed Sep 13, 2017 10:33 am

Re: Emergency mode and root account locked (mounting disk with fstab)

Thu Sep 14, 2017 10:15 am

I did not found a solution for the problem but considering the fact that I had no data on the NAS I just reinstalled Raspbian on the micro SD card and I restarted the tutorial.

Everything works fine now even after rebooting the Pi so I made a mistake in one of the steps.
Last edited by Zef on Sat Sep 16, 2017 8:34 am, edited 1 time in total.
Developper of @GraffitiEngine (Twitter) and Raspberry Pi enthusiast.

User avatar
DougieLawson
Posts: 36173
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Emergency mode and root account locked (mounting disk with fstab)

Fri Sep 15, 2017 7:42 pm

The normal cause is a missing disk defined in /etc/fstab.

Get the PARTUUID wrong for /boot and you'll drop into the emergency shell.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

peewee44
Posts: 11
Joined: Mon Aug 24, 2015 4:52 am

Re: Emergency mode and root account locked (mounting disk with fstab)

Mon Oct 30, 2017 8:06 am

Hello,

I have the same problem when I do not have both of my Samba connected NAS disks attached to the RPi.

Is there any way that i can have the RPI ignore the missing disk> (I sometimes need to attach a keyboard in its place.)

Thanks for any suggestions

P

User avatar
thagrol
Posts: 1850
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Emergency mode and root account locked (mounting disk with fstab)

Mon Oct 30, 2017 3:14 pm

peewee44 wrote:
Mon Oct 30, 2017 8:06 am
Hello,

I have the same problem when I do not have both of my Samba connected NAS disks attached to the RPi.

Is there any way that i can have the RPI ignore the missing disk> (I sometimes need to attach a keyboard in its place.)

Thanks for any suggestions

P
Try adding "nofail" to your mount options. Be aware, however, that you may still get errors later in the boot process and if your fstab entries use /dev/sd?? to identify discs, these are not guaranteed to stay the same when drives are added or removed.
This space unintentionally left blank.

peewee44
Posts: 11
Joined: Mon Aug 24, 2015 4:52 am

Re: Emergency mode and root account locked (mounting disk with fstab)

Mon Oct 30, 2017 8:53 pm

Thanks for your suggestion

I have minimal understanding of Debian. I survive by following instructions!

Here is my fstab file

Can you suggest where nofail needs to be inserted, please?

Many thanks

Peter

proc /proc proc defaults 0 0
PARTUUID=f6feaf96-01 /boot vfat defaults 0 2
PARTUUID=f6feaf96-02 / ext4 defaults,noatime 0 1
UUID=6AF0EAC0F0EA921D /share/PiHDD1 auto uid=pi,gid=pi,noatime 0 0
UUID=54D8D96AD8D94ABE /share/PiHDD2 auto uid=pi,gid=pi,noatime 0 0

# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that

User avatar
thagrol
Posts: 1850
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Emergency mode and root account locked (mounting disk with fstab)

Tue Oct 31, 2017 12:32 pm

Add ,nofail after .noatime on the entires for the drives mounted in /share
This space unintentionally left blank.


e-raser
Posts: 71
Joined: Sat Apr 04, 2015 1:30 pm

Re: Emergency mode and root account locked (mounting disk with fstab)

Fri Apr 20, 2018 10:29 pm

Same issue for me: Raspbian Stretch sometimes runs into emergency mode. Funny but true: Pressing <ENTER> once continues the boot process and the login prompt is shown. But of course it´s pretty difficult to press <ENTER> on the console if you´re (far) away from the pi :-)

/etc/fstab only contains mountpoints of devices which are connected at boot time. In case they are not, I use the 'nofail' option on all of them except those original entries:

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
There are also a few lines with "#" at the beginning of former mount points.
How to fix this? I also applied this patch to slow down the boot process, but that´s probably not the solution.

My theory: My Pi only runs into emergency mode, when the system isn´t shutdown cleanly (which could be the case indeed, but: I have "FSCKFIX=yes" set in /etc/default/rcS) and therefore a FSCK on probably /dev/mmcblk0p2 is unsuccessful. And /dev/mmcblk0p2 does not contain a nofail option...

Any ideas on that? Running on Raspbian Stretch, everything up2date.
1x Nextcloud & Pi-hole & ... on Raspbian @ Pi (4 4 GB)
1x Kodi media center on LibreELEC @ Pi 3 B+

e-raser
Posts: 71
Joined: Sat Apr 04, 2015 1:30 pm

Re: Emergency mode and root account locked (mounting disk with fstab)

Tue Jun 19, 2018 7:52 pm

No one? No ideas? I´ll try to add "fsck.repair=yes" to the /boot/cmdline.txt to work around the emergency mode. Next level would be to fully disable the emergency mode (as described here: https://forum-raspberrypi.de/forum/thre ... post301489). But all that actions of course don´t avoid the root cause (random unclean shutdowns). Power supply is OK by the way (can´t check it, but it should have enough power for the Pi 3 B+).
1x Nextcloud & Pi-hole & ... on Raspbian @ Pi (4 4 GB)
1x Kodi media center on LibreELEC @ Pi 3 B+

Novak
Posts: 1
Joined: Sat Aug 04, 2018 10:51 am

Re: Emergency mode and root account locked (mounting disk with fstab)

Sat Aug 04, 2018 11:00 am

Hi, I have received the Emergency Mode too, I press enter and it just shows me the same message again, do I have to wipe and re-install?

the message is:

"You are in emergency mode. After logging in, "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to try again to boot into default mode.

Press Enter to continue."

but when I press enter nothing Happens :( any help appreciated, I'm learning and don't know a whole lot about this

Thanks in advance for any assistance

ksh
Posts: 1
Joined: Thu Aug 30, 2018 9:14 am

Re: Emergency mode and root account locked (mounting disk with fstab)

Thu Aug 30, 2018 9:26 am

Novak wrote:
Sat Aug 04, 2018 11:00 am
Hi, I have received the Emergency Mode too, I press enter and it just shows me the same message again, do I have to wipe and re-install?

the message is:

"You are in emergency mode. After logging in, "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to try again to boot into default mode.

Press Enter to continue."

but when I press enter nothing Happens :( any help appreciated, I'm learning and don't know a whole lot about this

Thanks in advance for any assistance
in my case I removed SD card(which is installed Raspbian) from raspberry pi and connected it to new raspberry pi with usb card reader.
After that, just approach the file which is in trouble(In my case, that's /etc/fstab) and solve it.

faliondg
Posts: 1
Joined: Thu Sep 05, 2019 2:26 pm

Re: Emergency mode and root account locked (mounting disk with fstab)

Thu Sep 05, 2019 2:39 pm

I also used the instructions in the "How to Turn a Raspberry Pi into a Low-Power Network Storage Device" article on How-to Geek (https://www.howtogeek.com/139433/how-to ... ge-device/).

After running into the same problem you did, and spending a week repairing the damage, I was able to get both my mounts working. The source of the original problem is in the How-to Geek instructions: in the section where he talks about finalizing the setup using fstab, he says:

Within the nano editor add the following lines:

/dev/sda1 /media/USBHDD1 auto noatime 0 0
/dev/sda2 /media/USBHDD2 auto noatime 0 0 <----- THIS IS INCORRECT - the line should be /dev/sdb1 /media/USBHDD2 auto noatime 0 0

My no-thanks to the author for creating the problem; my thanks to Jeff Clark for this excellent description of how to fix the damaged fstab file: http://clarkle.com/notes/emergecy-mode-bad-fstab/

Return to “Troubleshooting”