Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

booting freebsd on raspberry pi from external USB drive

616 views
Skip to first unread message

Mike Scott

unread,
Jul 12, 2017, 9:21:20 AM7/12/17
to
I'm having problems getting freebsd to run off an external hard drive
instead of the pi's SD card..


I've installed freebsd onto the pi3's SD card. The image used is
FreeBSD-aarch64-12.0-GENERIC-320422M
which seems to work OK.

However, I really want the system to run from a USB hard drive. So I've
copied over (dump -f- | restore -rf- ) the entire installation onto a
spare partition (da0p2) on an external drive (that already contains a
running raspbian: a similar procedure worked happily for that!).

I've edited the fstab on both the SD card and the HD to reflect the new
root system. (Not sure which of the two kernels will be used, but that
doesn't matter so much).

The system starts to boot, but the loader gives expected messages about
umass0 followed by da0, then stops with

"mounting from /dev/da0p2 failed with error 19"

(device does not support operation??) and waits for a manual entry of
the root device.


I simply enter
ufs:/dev/da0p2
and the boot finishes successfully.


I'm totally unclear about the boot process on i386, and all the more so
with u-boot.

Is there something else I should be doing to set the boot device to
something other than the SD card? Manual input isn't so good in the long
term :-{

TIA.


--
Mike Scott (unet2 <at> [deletethis] scottsonline.org.uk)
Harlow Essex
"The only way is Brexit" -- anon.

Mike Scott

unread,
Jul 12, 2017, 4:30:29 PM7/12/17
to
On 12/07/17 14:21, Mike Scott wrote:
> I'm having problems getting freebsd to run off an external hard drive
> instead of the pi's SD card..
...
> The system starts to boot, but the loader gives expected messages about
> umass0 followed by da0, then stops with
>
> "mounting from /dev/da0p2 failed with error 19"
>
> (device does not support operation??) and waits for a manual entry of
> the root device.
...


OK, I'll answer my own query. I finally hit on the right set of
buzz-words for the search engine, and found the answer at
https://forums.freebsd.org/threads/30254/


The usb disk is slow enough to need extra boot delay before / is
mounted. So I've put into loader.conf
kern.cam.boot_delay="10000"

and all is well.

(Footnote: the loader.conf files /must/ be root-owned, or they are
silently ignored during boot. Took ages to find that somehow loader.conf
was owned by my non-root persona. Wierd. But all's well now.)

Don Kuenz

unread,
Jul 12, 2017, 6:42:14 PM7/12/17
to

In comp.sys.raspberry-pi Mike Scott <usen...@scottsonline.org.uk.invalid> wrote:
> On 12/07/17 14:21, Mike Scott wrote:
>> I'm having problems getting freebsd to run off an external hard drive
>> instead of the pi's SD card..
> ...
>> The system starts to boot, but the loader gives expected messages about
>> umass0 followed by da0, then stops with
>>
>> "mounting from /dev/da0p2 failed with error 19"
>>
>> (device does not support operation??) and waits for a manual entry of
>> the root device.
> ...
>
>
> OK, I'll answer my own query. I finally hit on the right set of
> buzz-words for the search engine, and found the answer at
> https://forums.freebsd.org/threads/30254/
>
>
> The usb disk is slow enough to need extra boot delay before / is
> mounted. So I've put into loader.conf
> kern.cam.boot_delay="10000"
>
> and all is well.
>
> (Footnote: the loader.conf files /must/ be root-owned, or they are
> silently ignored during boot. Took ages to find that somehow loader.conf
> was owned by my non-root persona. Wierd. But all's well now.)

This thread piqued my interest enough to search for an answer. As you
imply, it takes too much sleuthing to discern the proper keywords to
obtain meaningful results.

Beings you've already done the heavy lifting, is it possible for you to
share the /etc/fstab syntax to auto mount a usb file system? TIA.

Thank you,

--
Don Kuenz, KB7RPU

The Natural Philosopher

unread,
Jul 13, 2017, 2:59:43 AM7/13/17
to
On 12/07/17 21:30, Mike Scott wrote:
> On 12/07/17 14:21, Mike Scott wrote:
>> I'm having problems getting freebsd to run off an external hard drive
>> instead of the pi's SD card..
> ...
>> The system starts to boot, but the loader gives expected messages
>> about umass0 followed by da0, then stops with
>>
>> "mounting from /dev/da0p2 failed with error 19"
>>
>> (device does not support operation??) and waits for a manual entry of
>> the root device.
> ...
>
>
> OK, I'll answer my own query. I finally hit on the right set of
> buzz-words for the search engine, and found the answer at
> https://forums.freebsd.org/threads/30254/
>
>
> The usb disk is slow enough to need extra boot delay before / is
> mounted. So I've put into loader.conf
> kern.cam.boot_delay="10000"
>
> and all is well.
>
> (Footnote: the loader.conf files /must/ be root-owned, or they are
> silently ignored during boot. Took ages to find that somehow loader.conf
> was owned by my non-root persona. Wierd. But all's well now.)
>
>
>
WEIRD.



--
Gun Control: The law that ensures that only criminals have guns.

Mike Scott

unread,
Jul 13, 2017, 3:38:03 AM7/13/17
to
On 13/07/17 07:59, The Natural Philosopher wrote:
> On 12/07/17 21:30, Mike Scott wrote:
...
>>
>>
> WEIRD.

Thank you. I have a habit of getting that one wrong. Most wierd :-}

Mike Scott

unread,
Jul 13, 2017, 3:43:03 AM7/13/17
to
On 12/07/17 23:38, Don Kuenz wrote:
> ...
>
> Beings you've already done the heavy lifting, is it possible for you to
> share the /etc/fstab syntax to auto mount a usb file system? TIA.

Nothing special; from the PI:

/dev/da0p2 / ufs rw,noatime 1 1

But I think the noatime can go - I believe it's to save additional wear
on an SD card.

The Natural Philosopher

unread,
Jul 13, 2017, 4:16:41 AM7/13/17
to
On 13/07/17 08:38, Mike Scott wrote:
> On 13/07/17 07:59, The Natural Philosopher wrote:
>> On 12/07/17 21:30, Mike Scott wrote:
> ...
>>>
>>>
>> WEIRD.
>
> Thank you. I have a habit of getting that one wrong. Most wierd :-}
>
>
It breaks not only the 'i before e', but also the 'except if it sounds
like the sea'

So does rein.
and reign.

and a few other excamples.

--
"It is an established fact to 97% confidence limits that left wing
conspirators see right wing conspiracies everywhere"

Ahem A Rivet's Shot

unread,
Jul 13, 2017, 5:29:04 AM7/13/17
to
On Thu, 13 Jul 2017 08:43:02 +0100
Mike Scott <usen...@scottsonline.org.uk.invalid> wrote:

> On 12/07/17 23:38, Don Kuenz wrote:
> > ...
> >
> > Beings you've already done the heavy lifting, is it possible for you to
> > share the /etc/fstab syntax to auto mount a usb file system? TIA.
>
> Nothing special; from the PI:
>
> /dev/da0p2 / ufs rw,noatime 1 1
>
> But I think the noatime can go - I believe it's to save additional wear
> on an SD card.

Yes, but performance will be better with it too, unless the drive
is an SSD.

--
Steve O'Hara-Smith | Directable Mirror Arrays
C:>WIN | A better way to focus the sun
The computer obeys and wins. | licences available see
You lose and Bill collects. | http://www.sohara.org/

alister

unread,
Jul 13, 2017, 5:57:08 AM7/13/17
to
On Thu, 13 Jul 2017 09:16:40 +0100, The Natural Philosopher wrote:

> On 13/07/17 08:38, Mike Scott wrote:
>> On 13/07/17 07:59, The Natural Philosopher wrote:
>>> On 12/07/17 21:30, Mike Scott wrote:
>> ...
>>>>
>>>>
>>> WEIRD.
>>
>> Thank you. I have a habit of getting that one wrong. Most wierd :-}
>>
>>
> It breaks not only the 'i before e', but also the 'except if it sounds
> like the sea'
>
> So does rein.
> and reign.
>
> and a few other excamples.

if you were to perform a thorough check of the dictionary you would find
that there are actually more words that break the rule than follow it
this is one of the reasons why it is no longer taught is schools.



--
QOTD:
Y'know how s'm people treat th'r body like a TEMPLE?
Well, I treat mine like 'n AMUSEMENT PARK... S'great...

Charlie Gibbs

unread,
Jul 13, 2017, 2:16:42 PM7/13/17
to
On 2017-07-13, alister <aliste...@ntlworld.com> wrote:

> On Thu, 13 Jul 2017 09:16:40 +0100, The Natural Philosopher wrote:
>
>> On 13/07/17 08:38, Mike Scott wrote:
>>
>>> On 13/07/17 07:59, The Natural Philosopher wrote:
>>>
>>>> On 12/07/17 21:30, Mike Scott wrote:
>>> ...
>>>> WEIRD.
>>>
>>> Thank you. I have a habit of getting that one wrong. Most wierd :-}
>>
>> It breaks not only the 'i before e', but also the 'except if it sounds
>> like the sea'
>>
>> So does rein.
>> and reign.
>>
>> and a few other excamples.
>
> if you were to perform a thorough check of the dictionary you would find
> that there are actually more words that break the rule than follow it
> this is one of the reasons why it is no longer taught is schools.

I before E except after C,
or when it says "A" as in "neighbour" and "weigh".

(Plus a few weird exceptions which may seize your attention.)

--
/~\ cgi...@kltpzyxm.invalid (Charlie Gibbs)
\ / I'm really at ac.dekanfrus if you read it the right way.
X Top-posted messages will probably be ignored. See RFC1855.
/ \ HTML will DEFINITELY be ignored. Join the ASCII ribbon campaign!

bob prohaska

unread,
Jul 13, 2017, 10:01:27 PM7/13/17
to
In comp.unix.bsd.freebsd.misc Mike Scott <usen...@scottsonline.org.uk.invalid> wrote:
>
>
>
> I simply enter
> ufs:/dev/da0p2
> and the boot finishes successfully.
>
>

If I'm not mistaken, that gives you the kernel from the microSD card
but userland from the USB storage device. That may not be a bad thing
depending on what you're doing. If the machine is intended to build its
own world and kernel I think it'll make mischief.

I'd be pleased to learn this is untrue.

I elected to use the microSD for / but put /usr /var swap and /tmp on usb
partitions on the notion that / is seldom written to.

bob prohaska

Mike Scott

unread,
Jul 14, 2017, 3:07:21 AM7/14/17
to
On 14/07/17 03:01, bob prohaska wrote:
> In comp.unix.bsd.freebsd.misc Mike Scott <usen...@scottsonline.org.uk.invalid> wrote:
>>
>>
>>
>> I simply enter
>> ufs:/dev/da0p2
>> and the boot finishes successfully.
>>
>>
>
> If I'm not mistaken, that gives you the kernel from the microSD card
> but userland from the USB storage device. That may not be a bad thing
> depending on what you're doing. If the machine is intended to build its
> own world and kernel I think it'll make mischief.
>
> I'd be pleased to learn this is untrue.

Thanks for the comment.

TBH I don't know. I've always found the info for loader confusing; and
with ubldr it's not exactly got clearer. Possibly just me - but I'm
trying to use the OS, not learn about how it ticks.

My understanding, which is more than likely flawed, is that loader reads
the fstab file, and mounts / accordingly, and I think the kernel is then
loaded from /boot/.... which would mean (in this case) off the external
drive.

But in my case, they're identical anyway, and it makes not one jot of
difference in practice for my application.

But it would be good to know for sure!

(I'm not entirely convinced that running 'make buildworld' or whatever
on the rpi would be a Good Idea in any event. :-} )


As I've noted elsewhere, the problem I had was due to a race condition
for recognising the USB drive and mounting / off it. Suggests to me
something not quite kosher in the design of the boot procedure.

bob prohaska

unread,
Jul 14, 2017, 7:12:22 PM7/14/17
to
In comp.unix.bsd.freebsd.misc Mike Scott <usen...@scottsonline.org.uk.invalid> wrote:
>
> (I'm not entirely convinced that running 'make buildworld' or whatever
> on the rpi would be a Good Idea in any event. :-} )
>
>
This depends on one's definition of "good" 8-) For a minimal power and
hardware setup it works fairly well. A complete build/install cycle can
be finished in a day.

> As I've noted elsewhere, the problem I had was due to a race condition
> for recognising the USB drive and mounting / off it. Suggests to me
> something not quite kosher in the design of the boot procedure.
>
Hopefully somebody will chime in with an accurate answer. I wanted to
do the very same thing a couple of years ago and reluctantly concluded
it was impossible. It would be good to learn that something has changed,
but I've come across nothing to suggest it.

In point of fact, I've spent the last two years trying to wear out
a microSD card and USB flash filesystem and there's no hint (sound of
knuckles rapping forehead) of a problem. If you hook up a serial console
and play around with the u-boot prompts you'll find a "boot usb" command.

By no longer care, but maybe you do. The name certainly holds promise.

bob prohaska

bob prohaska

unread,
Jul 14, 2017, 10:39:06 PM7/14/17
to
In comp.unix.bsd.freebsd.misc Dennis Lee Bieber <wlf...@ix.netcom.com> wrote:
>
> Run multiple variations of the HINT benchmark setting up a swap file on the
> SD card... <G>
>
> That will shorten the SD card life significantly!

I don't doubt that flash can be worn out. I simply wanted to see if it's
a problem in my application. Seemingly not yet.

How it fails may be more significant.

bob prohaska

druck

unread,
Jul 19, 2017, 7:34:29 PM7/19/17
to
On 15/07/2017 00:12, bob prohaska wrote:
> In point of fact, I've spent the last two years trying to wear out
> a microSD card and USB flash filesystem and there's no hint (sound of
> knuckles rapping forehead) of a problem.

We use Pi's to drive serial and USB smartcard multiplexers, it runs a
tiny python server sitting on top of a standard Raspbian wheezy, no
additional writes over and above what the OS does by default. The cards
are now starting to fail after 4 years of 24/7 uptime.

---druck

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

bob prohaska

unread,
Jul 20, 2017, 1:57:37 AM7/20/17
to
In comp.unix.bsd.freebsd.misc druck <ne...@druck.org.uk> wrote:
>
> We use Pi's to drive serial and USB smartcard multiplexers, it runs a
> tiny python server sitting on top of a standard Raspbian wheezy, no
> additional writes over and above what the OS does by default. The cards
> are now starting to fail after 4 years of 24/7 uptime.
>

What failure modes are you observing? Presumably I have another year or
so to get ready 8-) It would be good if I could recognize the symptoms.

bob prohaska

0 new messages