Booting a Pi 4 without an external USB drive when it is configured to automount that drive...

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I have added a line

/dev/sda1 /home/pi/ext ntfs defaults,umask00%0,x-systemd.device-timeout30% 0  
0

to /etc/fstab to auto-mount a USB drive that is on /dev/sda1

This works fine.

But if I accidentally forget to plug in the USB drive, booting halts with a  
message

https://postimg.cc/4nbX0gkZ

about being in emergency mode

Interestingly, if I then plug the drive in (while the Pi is turned on) and  
press enter again, it boots normally.

So despite the x-systemd.device-timeout30% it is stopping dead if the drive  
is not present.


Originally I had the line

/dev/sda1 /home/pi/ext ntfs defaults 0 0


but  
https://www.raspberrypi.org/documentation/configuration/external-storage.md
alerted me to the umask parameter to allow access to all files/folders, and  
the shortened timeout x-systemd.device-timeout30% instead of 90 seconds.


The only difference from the web page is that I am referring to the drive by  
/dev/sda1 rather than by its UUID. Is that significant? Is there another  
parameter that I should be using on the /etc/fstab line?  


Re: Booting a Pi 4 without an external USB drive when it is configured to automount that drive
Quoted text here. Click to load it


Solved it! I should have used the keyword nofail to prevent boot stalling if  
the drive isn't present:

/dev/sda1 /home/pi/ext ntfs  
defaults,nofail,umask00%0,x-systemd.device-timeout30% 0 0

https://raspberrypi.stackexchange.com/questions/75765/how-to-boot-without-mounting-a-drive-present-during-booting
gave me that information.



The consequences of the drive not being present are fairly catastrophic  
because the Pi is used as a TV recorder which expects to write its  
recordings to the USB drive, but its better that the Pi at least boots than  
that it just stops dead in its tracks and throws its toys out of the pram.

The chances of me failing to plug the drive in are fairly remote: it only  
happened because I moved the Pi from the TV back to my PC to investigate why  
I'm not getting any sound, either analogue through the 3.5 mm jack or HDMI  
to the TV, and forgot to bring the external drive with me.  


Re: Booting a Pi 4 without an external USB drive when it is configured to automount that drive
Quoted text here. Click to load it

i had the exact same problem but didn't took the time to investigate.
thank you very much for the info, you save me the effort :)

Quoted text here. Click to load it

yes, i have somehow the same problem.  my chances to forget to plug my
usb drive are low, but it happened already!

-f6k

--  
~{,_,"> indignus LabRat - ftp://shl.huld.re

Re: Booting a Pi 4 without an external USB drive when it is configured to automount that drive
Quoted text here. Click to load it

No problem. Glad to be able to help. When I first got a dark grey screen  
(just discernibly lighter than with the HDMI plug unplugged) I thought the  
Pi (or more likely the SD card image) was buggered. I'd shut the Pi down  
cleanly, brought it into the other room, connected it to the PC monitor,  
plugged in the power supply - what could have gone wrong in those stages?  
After a couple of times, I brought up a text-boot screen (probably the one  
that is hidden if you choose Splash Screen in the /boot/config.txt) which  
reported retries on /dev/sda1. Bugger it! That's the external HDD. Plugging  
it in allowed the Pi to boot. Phew!

It then took a bit of research to find out what parameters to add to the  
/etc/fstab entry to make it *always* mount /dev/sda1 if it was present but  
to skip mounting it without protest if /dev/sda1 was not present.

It was interesting to read the forum where someone had asked the question.

First of all someone says "don't auto-mount, let the user do it". Then  
someone else says "don't use fstab, use udev rules and usbmount". I could  
hear Harry Enfield's voice "you don't want to do it like *that*" ;-) Various  
"solutions" that didn't answer the precise question or requirement and  
over-complicated things. Eventually someone stepped in and said "just add  
nofail to the fstab entry" - the voice of sanity: the simplest solution is  
the best one.

Reducing the timeout was a supplementary, to make sure that the Pi doesn't  
hang around for so long if the drive isn't present. I could probably reduce  
it even more.  


Site Timeline