Artix Linux Forum

Artix Linux => System => Topic started by: artik on 25 June 2020, 10:37:13

Title: machine-id file in /etc
Post by: artik on 25 June 2020, 10:37:13
I noticed today, there is a file named machine-id under` /etc`. What it is for? Does it serve as an unique identifier for repositories? Could someone explain and educate?
Title: Re: machine-id file in /etc
Post by: nous on 25 June 2020, 14:50:55
It's used/created by dbus. It's a unique identifier of your box and there's another in /var/lib/dbus/. In our community ISOs, there's a script that changes it at every boot.

If you are concerned, you can change it as well at boot or with cron:
Code: [Select]
dbus-uuidgen  >| /var/lib/dbus/machine-id
dbus-uuidgen  >| /etc/machine-id
Title: Re: machine-id file in /etc
Post by: conky60 on 25 June 2020, 16:42:09
Thank you @nous for the information. Where can I find the script to change machine-id at boot and how to apply it?
I am running Artix Plasma, but it is a self-constructed version and therefore does not have this script.

Best regards.
Title: Re: machine-id file in /etc
Post by: nous on 28 June 2020, 00:04:45
Just put those dbus-uuidgen commands in your /etc/rc.local!
Title: Re: machine-id file in /etc
Post by: ####### on 28 June 2020, 01:55:17
/var/lib/dbus and thus /var/lib/dbus/machine-id doesn't exist at all on my system, while /etc/machine-id does. Hasn't seemed to cause problems.
I didn't have an /etc/rc.local, although I could have made one like this:
https://wiki.artixlinux.org/Main/OpenRC#rc.local (https://wiki.artixlinux.org/Main/OpenRC#rc.local)
so I put the command in /etc/local.d/file.start instead and made it executable which worked, with the local service enabled.
Title: Re: machine-id file in /etc
Post by: conky60 on 28 June 2020, 12:39:18
/var/lib/dbus and thus /var/lib/dbus/machine-id doesn't exist at all on my system, while /etc/machine-id does. Hasn't seemed to cause problems.
I didn't have an /etc/rc.local, although I could have made one like this:
https://wiki.artixlinux.org/Main/OpenRC#rc.local (https://wiki.artixlinux.org/Main/OpenRC#rc.local)
so I put the command in /etc/local.d/file.start instead and made it executable which worked, with the local service enabled.
I followed your method as well...works as expected. :)

Best regards.
Title: Re: machine-id file in /etc
Post by: artoo on 28 June 2020, 14:43:25
It's used/created by dbus. It's a unique identifier of your box and there's another in /var/lib/dbus/. In our community ISOs, there's a script that changes it at every boot.

If you are concerned, you can change it as well at boot or with cron:
Code: [Select]
dbus-uuidgen  >| /var/lib/dbus/machine-id
dbus-uuidgen  >| /etc/machine-id


I'd advise against two uuids, just symlink /var/lib/dbus/machine-id to /etc.
Title: Re: machine-id file in /etc
Post by: dreieck on 29 July 2023, 23:15:26
For anyone who comes here by some search on the topic, and a follow-up:

If you are concerned, you can change it as well at boot[...]:
Code: [Select]
dbus-uuidgen  >| /var/lib/dbus/machine-id
dbus-uuidgen  >| /etc/machine-id

There is now a package in the AUR which does this: random_machine_id-openrc (https://aur.archlinux.org/packages/random_machine_id-openrc).


Is changing the machine ID during runtime of dbus supported and does not lead to strange behaviour?

By the way, /var/lib/dbus/machine-id does no longer exist (I don't have a /var/lib/dbus/ at all). random_machine_id-openrc (https://aur.archlinux.org/packages/random_machine_id-openrc) caters for that since it tests the existence of /var/lib/dbus/.

Maybe someone with Wiki edit rights can also put the information into the corresponding wiki page (https://wiki.artixlinux.org/Main/Troubleshooting#I.27m_having_dbus-related_problems_and_I_keep_seeing_messages_about_.2Fetc.2Fmachine-id)?