Re: git: a28ccb32bf56 - main - machine-id: generate a compact version of the uuid

From: Mike Karels <mike_at_karels.net>
Date: Sat, 04 Mar 2023 16:21:48 UTC
On 4 Mar 2023, at 0:03, Baptiste Daroussin wrote:

> 3 mars 2023 à 17:12 "Mike Karels" <mike@karels.net> a écrit:
>
>
>>
>> On 3 Mar 2023, at 9:40, Tijl Coosemans wrote:
>>
>>>
>>> On Wed, 1 Mar 2023 18:18:33 GMT Baptiste Daroussin <bapt@FreeBSD.org> wrote:
>>>
>>>>
>>>> The branch main has been updated by bapt:
>>>>
>>>>  URL:
>>>> https://cgit.freebsd.org/src/commit/?id=a28ccb32bf5678fc401f1602865ee9b37ca4c990
>>>>
>>>>  commit a28ccb32bf5678fc401f1602865ee9b37ca4c990
>>>>
>>>>  Author: Baptiste Daroussin <bapt@FreeBSD.org>
>>>>
>>>>  AuthorDate: 2023-02-28 10:31:06 +0000
>>>>
>>>>  Commit: Baptiste Daroussin <bapt@FreeBSD.org>
>>>>
>>>>  CommitDate: 2023-03-01 18:16:25 +0000
>>>>
>>>>  machine-id: generate a compact version of the uuid
>>>>
>>>>  dbus and other actually expect an uuid without hyphens
>>>>
>>>>  Reported by: tijl
>>>>
>>>>  MFC After: 3 days
>>>>
>>>>  ---
>>>>
>>>>  libexec/rc/rc.d/machine_id | 2 +-
>>>>
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>>  diff --git a/libexec/rc/rc.d/machine_id b/libexec/rc/rc.d/machine_id
>>>>
>>>>  index 7cfd7b2d92f8..8bf3e41d0603 100644
>>>>
>>>>  --- a/libexec/rc/rc.d/machine_id
>>>>
>>>>  +++ b/libexec/rc/rc.d/machine_id
>>>>
>>>>  @@ -23,7 +23,7 @@ machine_id_start()
>>>>
>>>>  if [ ! -f ${machine_id_file} ] ; then
>>>>
>>>>  startmsg -n "Creating ${machine_id_file} "
>>>>
>>>>  t=$(mktemp -t machine-id)
>>>>
>>>>  - /bin/uuidgen -r -o $t
>>>>
>>>>  + /bin/uuidgen -r -c -o $t
>>>>
>>>>  install -C -o root -g wheel -m ${machine_id_perms} "$t" "${machine_id_file}"
>>>>
>>>>  rm -f "$t"
>>>>
>>>>  startmsg 'done.'
>>>>
>>>
>>>  I really think this file should be defined to contain the same UUID as
>>>
>>>  /etc/hostid such that there's one and only one UUID per machine. Having
>>>
>>>  two different IDs needlessly complicates things if they end up in logs
>>>
>>>  etc.
>>>
>>>  It also looks like on Linux virtual machines this file contains the
>>>
>>>  SMBIOS UUID just like our /etc/hostid. If /etc/machine-id is supposed
>>>
>>>  to be a portable way to obtain that UUID it should be the same as
>>>
>>>  /etc/hostid.
>>>
>>
>> I agree. I had the same reaction when the machine-id was added, but
>>
>> thought the requirements were different (in particular, the UUID version).
>>
>> If at all possible, the two should be the same except for hyphens.
>>
>>>
>>> Please have another look at . This
>>> https://reviews.freebsd.org/D38811
>>>  file is supposed to remain constant across updates. If we get this
>>>
>>>  wrong in 13.2, applications may have to deal with the complications for
>>>
>>>  a very long time.
>>>
>>
>> This should be resolved for 13.2 if at all possible.
>>
>>  Mike
>>
>
>
> The requirements are différent rfc 422 yes would accept what hostid format uses still all new uuid should follow rfc422.

Does this mean that if hostid already exists, a compact version of hostid
would be acceptable as the machine-id?  This situation will happen as
machines are upgraded to 13.2, and it would certainly be preferable to
creating a different UUID.

		Mike