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

mkosi: machine ID in initrd and host are different?? #32908

Closed
yuwata opened this issue May 18, 2024 · 2 comments · Fixed by #32915
Closed

mkosi: machine ID in initrd and host are different?? #32908

yuwata opened this issue May 18, 2024 · 2 comments · Fixed by #32915
Labels
bug 🐛 Programming errors, that need preferential fixing mkosi pid1 tests

Comments

@yuwata
Copy link
Member

yuwata commented May 18, 2024

There are two journal directories.

May 18 04:03:30 journalctl[1421]: Considering root directory '/run/log/journal'.
May 18 04:03:30 journalctl[1421]: Root directory /run/log/journal added.
May 18 04:03:30 journalctl[1421]: Considering directory '/run/log/journal/349ddf49b1a6401384f5251832e4f9b1'.
May 18 04:03:30 journalctl[1421]: Directory /run/log/journal/349ddf49b1a6401384f5251832e4f9b1 added.
May 18 04:03:30 journalctl[1421]: Journal effective settings seal=no keyed_hash=yes compress=ZSTD compress_threshold_bytes=8B
May 18 04:03:30 journalctl[1421]: File /run/log/journal/349ddf49b1a6401384f5251832e4f9b1/system@de81673f8b204dfba911ee124c434239-0000000000000001-000618aaffaf7c1d.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/349ddf49b1a6401384f5251832e4f9b1/system@de81673f8b204dfba911ee124c434239-0000000000000bff-000618aaffbb04a9.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/349ddf49b1a6401384f5251832e4f9b1/system@de81673f8b204dfba911ee124c434239-00000000000021e7-000618aaffc88618.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/349ddf49b1a6401384f5251832e4f9b1/system@de81673f8b204dfba911ee124c434239-00000000000030b8-000618aaffd30e38.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/349ddf49b1a6401384f5251832e4f9b1/system@de81673f8b204dfba911ee124c434239-0000000000003d92-000618aaffdb6594.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/349ddf49b1a6401384f5251832e4f9b1/system.journal added.
May 18 04:03:30 journalctl[1421]: Considering directory '/run/log/journal/608c83a147c141fdbe19a7c4722f1ca7'.
May 18 04:03:30 journalctl[1421]: Directory /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7 added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-000000000000d2b8-000618ab00e8a1f7.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-000000000000de5d-000618ab01075b49.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-000000000000f20c-000618ab0117261e.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-00000000000105b4-000618ab0124115f.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-000000000001172d-000618ab01370fc9.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-0000000000012388-000618ab0145621f.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-0000000000012ed8-000618ab0153fb1f.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-0000000000013c21-000618ab016f4db2.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-00000000000151c1-000618ab017cef28.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-00000000000166ab-000618ab018b1465.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-00000000000173a5-000618ab019b91b4.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-0000000000017f88-000618ab01b3f905.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system@de81673f8b204dfba911ee124c434239-00000000000193c6-000618ab01bf6209.journal added.
May 18 04:03:30 journalctl[1421]: File /run/log/journal/608c83a147c141fdbe19a7c4722f1ca7/system.journal added.

If that's intentional, feel free to close. cc @DaanDeMeyer

@yuwata yuwata added the mkosi label May 18, 2024
@DaanDeMeyer
Copy link
Contributor

We always remove the machine ID from the image, so this seems like it would be a problem in systemd.

@yuwata yuwata added pid1 bug 🐛 Programming errors, that need preferential fixing tests labels May 18, 2024
yuwata added a commit to yuwata/systemd that referenced this issue May 19, 2024
If machine ID is previously stored at /run/machine-id, then let's reuse
it. This is important on switching root and /etc/machine-id was previously
a mount point.

Fixes systemd#32908.
yuwata added a commit to yuwata/systemd that referenced this issue May 19, 2024
If machine ID is previously stored at /run/machine-id, then let's reuse
it. This is important on switching root and /etc/machine-id was previously
a mount point.

Fixes systemd#32908.
yuwata added a commit to yuwata/systemd that referenced this issue May 19, 2024
If machine ID is previously stored at /run/machine-id, then let's reuse
it. This is important on switching root and /etc/machine-id was previously
a mount point.

Fixes systemd#32908.
yuwata added a commit to yuwata/systemd that referenced this issue May 19, 2024
If machine ID is previously stored at /run/machine-id, then let's reuse
it. This is important on switching root and /etc/machine-id was previously
a mount point.

Fixes systemd#32908.
@poettering
Copy link
Member

This is actually the common case in environments where the initrd is generically built: it's not parameterized and hence comes up with a different machine ID each time.

This is a fundamental different I see between switch-root and soft-reboot btw: i think switch-root should expect the machine ID to change, and soft-reboot should expect the machine ID to not change. i.e. the former is about changing from one OS to another. While the latter is about cycling the same OS.

that is a relatively weak rule i believe however, i.e. it should be OK (and maybe even good) to propagate the machine ID from initrd to host (and vice versa) if we can. And for transient systems it should probably even be ok to change the machine ID on soft reboots i guess.

If we wanted to make sure that initrd and host carry the same initrds i think we need to do two things:

  1. via env var or cred propagate initrd machine ID to host. The host should then use this info or not. Typically it would use it if no machine ID is written to /etc/ yet, and otherwise would stick to the data from there.

  2. automatically generate an encrypted credential and place it in the ESP for the machine ID via a kernel-install plugin.

If we have both in place, then this would mean we'd be able to have the same machine IDs persistently in both worlds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing mkosi pid1 tests
Development

Successfully merging a pull request may close this issue.

3 participants