Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Apr 2026 08:34:48 -0700
From:      Rick Macklem <rick.macklem@gmail.com>
To:        =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= <des@freebsd.org>
Cc:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   Re: Getting boottime early in booting
Message-ID:  <CAM5tNy6ewm69xtkfr=nvMSZA3-cb57mpkqJ644y442Tx2XQSmg@mail.gmail.com>
In-Reply-To: <86mrzjumyg.fsf@ltc.des.dev>
References:  <CAM5tNy4mPmG=OmQtiGrMQ8NnPZrN=dw_Xw1h9=s4iyOLiZCWng@mail.gmail.com> <86mrzjumyg.fsf@ltc.des.dev>

index | next in thread | previous in thread | raw e-mail

On Sat, Apr 4, 2026 at 1:52 AM Dag-Erling Smørgrav <des@freebsd.org> wrote:
>
> Rick Macklem <rick.macklem@gmail.com> writes:
> > 1 - I need a value that will be different each time the machine boots.
> >      I would normally use getboottime(), but for the NFS root fs mount,
> >      it just returns 0.
> >      Any ideas w.r.t. something I can acquire early in booting that will
> >      change each time the system is booted?
>
> Just use arc4random(9).
Yes, that does seem to work now. (It didn't seem to be working when I
tried before posting? For the very old i386 system I am testing on,
arc4random() works for me, if I wait until I really need the value, which
is when the RPC is being done to the NFS server. Before testing, I was
trying arc4random() much earlier in the boot.)

For a UEFI laptop, it looks like arc4random() works quite early in the
boot. (It has the entropy_efi_seed=YES in it's boot variables.)

Anyhow, thanks everyone, for the useful hints, rick

>
> DES
> --
> Dag-Erling Smørgrav - des@FreeBSD.org


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM5tNy6ewm69xtkfr=nvMSZA3-cb57mpkqJ644y442Tx2XQSmg>