src/system: use /etc/machine-id as machine identifier #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At least on my raspberrypi 3, with a mainline kernel, /proc/cpuinfo does not contain a
Serial:
line.It neither does on my other system, so it was impossible to run the application in release mode.
This now instead reads from
/etc/machine-id
, as per https://www.freedesktop.org/software/systemd/man/latest/machine-id.htmlThat one is guaranteed to be stable across reboots, as long as we don't loose the root filesystem, and works on pretty much any Linux system out there.
It's also possible to influence its generation, as described in https://www.freedesktop.org/software/systemd/man/latest/machine-id.html#Initialization
This would allow passing some unique identifier determined in u-boot to be passed to the kernel cmdline, for example, or a early-boot systemd unit file that interacts with
https://www.freedesktop.org/software/systemd/man/latest/systemd-machine-id-setup.html#
Point being we don't need to make this too hardware-specific.
I kept the
id
thing in the config around for now, so when testing on MacOS, it can be provided in the config to get a stable identifier there.