Re: git: 62a149bf6219 - main - Add new rc: machine_id to generate /etc/machine-id

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Thu, 12 Jan 2023 08:23:59 UTC
On Wed, Jan 11, 2023 at 07:08:39PM -0800, Rick Macklem wrote:
> On Mon, Jan 9, 2023 at 6:40 AM Matteo Riondato <matteo@freebsd.org> wrote:
> >
> > On 2022-12-24 at 03:39 EST, Tobias C. Berner <tcberner@freebsd.org> wrote:
> >
> > >Moin moin
> > >
> > >I think it tries to solve the same problem of giving the machine a unique id.
> > >
> > >From the linux man page [1]
> > >
> > >       The machine ID does not change based on local or network
> > >       configuration or when hardware is replaced. Due to this and its
> > >       greater length, it is a more useful replacement for the
> > >       gethostid(3) call that POSIX specifies.
> > >
> >
> > Does this make or should it make hostid obsolete?
> I hope not, since the NFSv4 client uses /etc/hostid.
> 
> > If yes, then changes are needed to deorbit hostid. If not, why not?
> If this is somehow a better algorithm than the one used by uuidgen(1)
> then I would prefer seeing that utility improved instead of a new one
> being added.

This is exactly what has been done. Here we are speaking a rc script to generate
the file expected by userland software (from the ports tree).

https://cgit.freebsd.org/src/commit/bin/uuidgen/uuidgen.c?id=f176fe8e7f638e585afcd2f4dd52a522c4648f63

> 
> If software needs to acquire the host uuid, the code can simply
> get the sysctl kern.hostuuid.

> 
> Unless there is a really good reason to have this one in the
> system as well as uuidgen(1), I'd suggest you revert this commit.
> 
> rick

I don't see why it should be reverted. more and more of the package ecosystem
requires this feature (and it what is provided by dbus is not sufficient
anymore), this is what those changes (addition to uuidgen(1) and rc script to
generate the machine-id file) is addressing.

Now can we reuse part of the changes to improve/replace hostid, this is a
complerly unrelated study that could (should?) be done by whom is willing to
have a look and knowledgeable enough in this area.

Best regards,
Bapt