Don't over-complicate it. Write a UUID into /tmp/boot on every boot.

Example here, I'm sure there are others:

https://github.com/bsd-source/openbsd-uuid-gen/blob/main/uuid.sh

Run from rc.local.

/tmp is cleared on every boot (before rc.local is run).

Regards
Lloyd

Ricardo F wrote:

> Hello,
> 
> I’m looking for a reliable way to identify a system startup, something
> guaranteed to be unique on every boot.
> 
> kern.boottime reflects the system time at boot and is accurate
> initially,
> but the man page notes: “The boottime variable holds the system boot
> time. It
> is set from time at system boot, and is updated when the system time is
> adjusted with settimeofday(2).”, so it’s not fully immutable.
> 
> Is there a better method to obtain a boot reference that is stable and
> unique
> for each startup? As example, something like FreeBSD kern.boot_id
> sysctl.
> 
> Thanks,
> Ricardo F.

Reply via email to