4 ms·
can't you simply symlink /etc/machine-id to /dev/random?
by CodeArtisan 8y ago
can't you simply symlink /etc/machine-id to /dev/random?
- mirimir 8y agoIt seems that you can set a random value at boot. But maybe not whenever it's requested.
- wicket 8y agoThat 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 &
- wicket 8y agoA 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.
- jlgaddis 8y agoPerhaps 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