Other Mounting external USB disk during boot on raspberrypi

I am running FreeBSD 11 on a Raspberrypi B+. I have added an externally powered USB drive and formatted it with ufs from the Raspberrypi itself. The drive is new: I bought it today and I performed a complete surface check before using it.

So, after formatting it on the rpi I could mount it. I then added it to fstab:

Code:
/dev/da0s1 /media/intenso ufs rw 2 2

I rebooted and FreeBSD hangs just after recognizing the drive. The last lines I see in the console are:
Code:
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
...
da0: quirks=0x2<NO_6_BYTE>
random: unblocking device.

Then nothing: FreeBSD hangs forever in this state. The only thing I can do is reboot with
Code:
CTRL-ALT-DEL

The only way to get the system to work again is to remove the memory card, mount it on another system, and remote the above line from /etc/fstab.

The strange thing is that I can mount the drive after the system has booted successfully but I cannot mount it at boot time.

Does anyone have any hint as to how to solve this problem?
 
Try adding the late keyword to make it mount later on in the boot process.

Code:
/dev/da0s1 /media/intenso ufs rw,late 2 2
 
Thanks for the hint but unfortunately this does not seem to make any difference: the system hangs right after logging to the console that it has recognized the external disk. I have the same behaviour with two different external usb disks.

I have found a solution (here and here) that works, but I do not know if it is a proper one or a workaround. So I edited (created) /boot/loader.conf and added the line:

Code:
kern.cam.boot_delay="10000"

which seems to do the job.
 
Unfortunately, this stopped working after I have moved to FreeBSD 11.2. I use the same delay in /boot/loader.conf, but
as soon as I try to mount a partition from an external USB disk by adding it to fstab, FreeBSD hangs during boot
right after logging that it has recognized the usb disk as device da0.
After several minutes it logs:
Code:
random: unblocking device.
and then nothing. I can only reboot by pressing CTRL-ALT-DEL on the keyboard.
 
Search the web for the string "unblocking device". There seems to be a problem in FreeBSD and various derivatives (FreeNAS, PfSense) with incompatible USB devices not being ready for IO, when the "random" program tries to access them, probably to gather randomness, also known as entropy.

As an act of desperation, you could try the following: Go into /etc/rc.d, and temporarily remove "random" from there (rename it to a different directory). And/or remove the "save-entropy" line from /etc/crontab. This might get your system to boot with this USB disk in place, but it could break a lot of other things (some of them subtle or security related, some secure protocols rely on an unpredictable source of randomness).

And read "man 4 random", and try to understand it. I just tried to re-read it a moment ago, and failed to understand it.
 
My guess is you are experiencing some new behavior by our uboot implementation.
Booting from USB drives is now supported as of recently.
My suggestion is to see how uboot handles multiple devices present on boot up.
That would also explain why it boots when you remove the USB drive.
Boot delay is not really what you need here, you need a tweak to your uboot environment.
uboot acts as the system bios and is trying to boot off the wrong device.

https://forums.freebsd.org/threads/...with-usb-pendrive-inserted.68230/#post-407684
 
Thanks for the information Phishfry. I might have observed that problem as well: uboot was trying to use a partition from the external USB disk as root partition (or trying to load the kernel from it, I am not sure any more). This problem occurred only once but I haven't seen it lately.

I think my problem is somewhat different (but I will double-check to be sure). I would like a partition from the external USB disk to be mounted automatically and therefore I have added it to /etc/fstab. However, the system hangs when trying to mount it. At that poiint, it has already booted from the right partition and mounted the root filesystem. What I can see in the console is that the OS starts mounting partitions (it starts with /) and at the same time the external disk is recognized by the kernel. So I suppose the OS tries to mount the disk too early and afterwards, even if the disk is known, it cannot mount it and hangs.
If I comment out the mount point in fstab, everything works perfectly and I can mount the disk later.

Also, I observed the same problem on another computer of mine (not a raspberry) running 11.2. Booting with attached USB disk and mount point for that disk in fstab caused the system to hang. I never have this problem with attached external USB disks if they do not have mount points in fstab. Also: on my other two rpis running FreeBSD 11.1 I do not have this problem: one of them even mounts two external USB disks during boot without any problems.

Can it be that some other behaviour (apart from uboot) has changed from 11.1 to 11.2?
 
Back
Top