Issues with fstab and Pi going into Emergency Mode

I cannot restart the Pi without it going into Emergency Mode. I’m new to Linux so I may be a bit off here, but the Pi forums suggest that Emergency Mode is due to fstab failure.

Set up: Pi4 (8GB)
Quad Sata Hat
4 x Seagate Barracuda 2TB

It says during boot “A start job is running for /dev/md0”, but at this point the hat is not enabled, so md0 cannot be put together from sda to sdd, as they don’t exist.

How do I go about fixing this issue (to make the hat come on before fstab is processed)? I have never got this Pi to reboot, but if I do not reboot it everything works fine (I installed Nextcloud on it and transferred 600+GB onto it so the hardware does work). That data is held elsewhere and I have no qualms about destroying the array and rebuilding it.
This is the line added to fstab:

/dev/md0 /mnt ext4 defaults 0 0

Edit: although better spaced out than displayed here!

Many thanks in advance.

An error in the fstab will cause a system to fail to boot. It looks to me that /dev/md0 does not exist…what is that supposed to be? I would remove that line from fstab, or comment it out, and reboot, see if it does.

I’d also put a directory under /mnt and mount there. mkdir /mnt/mymountpoint
then test. sudo mount /dev/md0 /mnt/mymountpoint.

As you manipulate the fstab as you can test before booting with mount -a (as root or sudo). That will mount everything and give errors for problems.

/dev/md0 is the raid array created by mdadm:

sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sda /dev/sdb /dev/sdc /dev/sdd

as such, it doesn’t actually exist until after sda to sdd are available (which in turn won’t happen until the hat has been activated). When the fstab was manipulated /dev/md0 was available and everything worked beautifully, but it isn’t available during boot up.

Is there a way of mounting a drive much later in the boot process automatically (after fstab has skipped trying to process /dev/md0)? An equivalent to autoexec.bat from the good old days! There isn’t anything required for boot on the disks (that is all held on the SD card).

I’m more familiar with LVM and don’t have a RAID set up at this time, thus, no md0. If it was working at one time, I would guess you have also created the file system on the array? I so, something seems odd. The array would not be available unless all the drives were there. On boot sudo fdisk -l should show all the drives. If it does not, they were not seen on boot and my wild guess is that this is what is happening maybe. In that case, the array filesystem will not mount and, if there is an entry in fstab, it may hang.

So, once you get the thing to boot, check if all drives are available. If they are, attempt to mount the array, sudo mount /dev/md0 /mnt/whatever. If that works, you should them be able to add the FS to fstab…provided all drives now show on reboot.

I’ve had a number of cases where the 4-port USB bridge connector needs to be re-seated before all drives are seen. Once all are seen, they tend to stay though.

You can have the FS mounted using a script after boot though that should not be necessary. There are a couple options noted here: https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up

One other possibility…you mention mounting /dev/md0 at /mnt…is it possible you have something else trying to mount at something below /mnt? I noted before that I would not use /mnt as a mount point but mount the array FS below that (/mnt/raidfs or some such). Mounting over /mnt would conflict with anything else in there that may try to use /mnt/whatever as a mount point.

there are several threads discussing this issue already. multiple solutions have been used. the drives do not show up until the sata hat service is loaded so fstab mount entries will cause emergency mode. to get past emergency mode use another linux system or a windows program that allows ext4 to be mounted and comment out the mount entries in the fstab file. the system should boot again with no other drives mounted.

you can then use one of the solutions to get things working.

Dave

2 Likes

Change:

/dev/md0 /mnt ext4 defaults 0 0

To:

/dev/md0 /mnt ext4 defaults,nofail 0 0