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

Obtain machine-id from SMBIOS, DT, or TPM (on bare metal) #30707

Open
septatrix opened this issue Jan 3, 2024 · 3 comments · May be fixed by #32086
Open

Obtain machine-id from SMBIOS, DT, or TPM (on bare metal) #30707

septatrix opened this issue Jan 3, 2024 · 3 comments · May be fixed by #32086
Labels
pid1 RFE 🎁 Request for Enhancement, i.e. a feature request

Comments

@septatrix
Copy link
Contributor

Component

systemd

Is your feature request related to a problem? Please describe

On stateless systems there is currently no way to persist the machine-id even though this may often be desirable. Sometimes systems are only stateless for robustness reasons and would benefit from persistent identification.

An example of this would be the planned support of slow update rollouts with sysupdate. This mechanism would likely be based on some function which uses the machine-id, version, and threshold percentage as an input and checks if the machine-id crosses the threshold¹. If these devices reboot frequently they would get multiple tries to pass the threshold raising their chance to install the update and skewing the rollout percentage.

¹ Something like: (sd_id128_get_machine_app_specific(<version>) & 0xFF) / 0xFF < threshold (I have never calculated with 128 bit numbers but the ratio should be correct. Also UUIDv4 has fixed bits but as we hash it we can disregard that.)

Describe the solution you'd like

Similar to KVM and QEMU, the machine-id should also be tried to be gathered from SMBIOS or the DT on bare metal. Another suggestion was looking up an ID from the TPM.

Describe alternatives you've considered

An addition source for this could have been MAC addresses though these are sometimes also only randomly generated, have a lower bit size, and the drivers/devices may not be available at early boot.

The systemd version you checked that didn't have the feature you are asking for

255

@septatrix septatrix added the RFE 🎁 Request for Enhancement, i.e. a feature request label Jan 3, 2024
@github-actions github-actions bot added the pid1 label Jan 3, 2024
@poettering
Copy link
Member

poettering commented Jan 3, 2024

¹ Something like: (sd_id128_get_machine_app_specific(<version>) & 0xFF) / 0xFF < threshold (I have never calculated with 128 bit numbers but the ratio should be correct. Also UUIDv4 has fixed bits but as we hash it we can disregard that.)

128bit arithmetic sucks in C. It's fine to just cut off the first 64bit however, or something like that and then do simple modulo on it

@poettering
Copy link
Member

So yeah, I am on board with this idea. Key is that for the SMBIOS/DT thing the behaviour is opt-in, as you only want this in specific setups.

@septatrix
Copy link
Contributor Author

So yeah, I am on board with this idea. Key is that for the SMBIOS/DT thing the behaviour is opt-in, as you only want this in specific setups.

I would be fine with having this as a special value for sd.machine_id (or a new kernel cmdline arg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pid1 RFE 🎁 Request for Enhancement, i.e. a feature request
Development

Successfully merging a pull request may close this issue.

2 participants