Re:Devuan considers machine IDs
by CodeArtisan on Saturday March 30, 2019 @11:08AM
(#19529775)
can't you simply symlink /etc/machine-id to /dev/random?
[ Parent
| on HN ]
That won't work because /etc/machine-id is supposed to return a 32 character hex string, but I like the idea. You could do something like this:
# rm -f /etc/machine-id
# mkfifo /etc/machine-id
# while true; do head -c 16 /dev/urandom | od -A n -x | tr -d ' ' > /etc/machine-id; done &A word of warning. If you try this, make sure the last command is started on boot and runs before D-Bus! I completely forgot I had done this, and I just spent a few hours trying to figure out why my system was hanging on boot. It turns out that D-Bus reads /etc/machine-id on start-up, and naturally by design, it will wait until it receives data from the named pipe before proceeding with execution.
Perhaps a better idea (once you strip out the dashes) would be to use a random ID that is automatically (re-)generated on boot:
/proc/sys/kernel/random/boot_id