Skip to main content
Topic: machine-id file in /etc (Read 1355 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

machine-id file in /etc

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?
Andromedan

Re: machine-id file in /etc

Reply #1
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

Re: machine-id file in /etc

Reply #2
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.
We should try to be kind to everyone.....we are all fighting some sort of battle.


Re: machine-id file in /etc

Reply #4
/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
so I put the command in /etc/local.d/file.start instead and made it executable which worked, with the local service enabled.

Re: machine-id file in /etc

Reply #5
/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
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.
We should try to be kind to everyone.....we are all fighting some sort of battle.

Re: machine-id file in /etc

Reply #6
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.

Re: machine-id file in /etc

Reply #7
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.


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 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?