Reboot problem

I did something wrong trying to install an usb-drive. I know how to undo the changes I made, but the problem is the system (Raspberry 2) won’t reboot properly: during boot it detects something is wrong and it enters emergency mode. It says I should enter the root password or type in CTRL-D. When I type in the root password it says: ‘Segmentation fault’ and repeats the emergency mode Welcome-message. If I enter CTRL-D nothing happens. The only thing I can do (I think) is press CTRL-ALT-DEL, after which the system tries to reboot again.
If I hold down SHIFT during reboot, I get a message ‘A start-job is running for dev-sdb1-device’ (which is the usb-drive) which lasts 1 min 30 sec. After that the system reports all kind of problems on the screen and enters emergency mode again.
What can I do to get out of this mess?

TIA,
Jos

Hi @all
Hi @joslan

I got the same Problem like joslan

after i successfully managed to mount my external ntfs harddisk and shared it to the network i get this behaviour when i want to reboot after updating using the updater within the osmc menu …

i think it has something to do with the fstab or with the updates … i did not doublecheck this specific :smile:

Post a copy of your fstab file so we can have a look.

I’m having exactly the same problem as this. I can’t post a copy of fstab here because I can’t get to it to read it; if I could, then I would just edit out the part I added. So how do I get to it, or anything other than emergency mode welcome message followed by a segmentation fault?

Either mount the sd card on a Linux system if available or make a Linux Live USB to boot your PC from, see pendrivelinux.com

Another option is a Linux VM

Thanks for the quick answer, Dilligaf - if I’ve understood that right, I have to take the SD card out and mount it on another Linux machine to get back into fstab? (Actually I might just change OSMC to something else instead - if it’s this easy to make it unbootable, I probably need to start somewhere more straightforward.)

It doesn’t help you right now, but in the next monthly update (due at the end of the month) we will be changing the emergency mode so that it goes directly to a command prompt rather than prompting for the root password.

Prompting for a root password for emergency mode is standard behaviour in Desktop Linux but as we don’t set any root password by default in OSMC it prevents you from logging in, effectively making the emergency mode useless.

We previously had a feature where you could hold down shift at the beginning of boot to go directly to a command prompt where you could do things like edit your fstab file to fix a mistake, unfortunately a recent kernel update broke the detection of holding shift at boot and we have yet to find a way to get that working again.

I wouldn’t give up quite so easily, fstab is a critical system file that controls the mounting of drives, so yes, making a mistake there can easily render the system unbootable.

When the shift for recovery console feature was still working, fixing this problem would have been an easy couple of minutes jobs. After the next update with the change to the emergency console it would have taken you directly to a command prompt where you could edit fstab and reboot.

So it sounds like I’ve stumbled into a gap in development where there’s no way to recover this without another machine, but this might be fixed in the future? Okay, that’s fair enough, these things happen - but I’m trying to get something to work right now, so, well, I need to be able to make the changes I need to make (adding external USB storage is pretty basic, I thought?) without rendering the thing unusable the first time I make a mistake. And if I’m going to have to download a bunch of software on another machine to fix this anyway, I make as well make that a different and more beginner-proof OS :slight_smile:

(ETA: I should perhaps explain that I didn’t pick OSMC, I got the Pi from someone else with OSMC already on it, and was seeing if I could do what I wanted from there. Apparently not, but no hard feelings :slight_smile: )

You shouldn’t normally need to edit fstab to add an external USB drive - it should automatically mount and appear under /media - is that not working for you ?

There is a way to fix your current problem, but it is a little fiddly.

Put the SD card in a PC or Mac and edit the file called cmdline.txt on the FAT partition. It will have one long line. At the end of the same line add a space then:

init=/bin/bash

Save the file, then boot from the SD card on the Pi with a keyboard attached. This will take you directly to a root command prompt where you can edit your /etc/fstab file to undo the changes that caused it to fail to boot.

When you are finished, remove init=/bin/bash to go back to a normal bootup - since you are logged in already you may as well do that via nano directly on the device:

nano /boot/cmdline.txt

(you’re already root so no sudo is needed)

When you’ve done that, type reboot. You should now be booting up normally again. By the way, although you shouldn’t need to add a USB drive to fstab (it should mount automatically as described in my previous post) if you are adding drives in fstab, it’s recommended to make sure you always add the nofail option as one of the mount options. This tells the system that this is not considered to be an “essential” drive, thus it will still boot up (but with an error) if the drive can’t be found.

Without the nofail option failure to mount a drive (even if it was just one that had movies on it) is considered to be a critical failure that results in going into emergency mode.

I’m trying this and have got as far as editing /etc/fstab, but apparently there’s an error writing to it because it’s a read-only file system? Thanks for this, though - I’m learning a lot about how all the bits go together!

Sorry forgot it would be read only. Before editing fstab do this to make the file system read write:

mount -o remount,rw /