Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/system: use /etc/machine-id as machine identifier #12

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

flokli
Copy link
Contributor

@flokli flokli commented Jul 12, 2024

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.html

That 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.

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.html

That 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.
@flokli flokli requested review from freyacodes and VanuPhantom July 12, 2024 21:04
@flokli flokli merged commit 082b83e into wipbar:main Jul 12, 2024
3 checks passed
@flokli flokli deleted the machine-id branch July 12, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants