Skip to content
New issue

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

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

Already on GitHub? # to your account

run_qemu.sh: drop mkosi --autologin, use systemd credentials instead #113

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Feb 12, 2025

Until mkosi v24 commit c236c9f7b9c82d3, mkosi --autologin used to be applied to four devices: console, tty1, ttyS0 and one architecture-dependent device.

mkosi has some QEMU features of its own to boot the image. run_qemu.sh never used any of that. We should probably try (some of) it in the future but I digress. In that mkosi commit, mkosi/qemu.py (which we don't use) stopped using ttyS0 and replaced it with the faster /dev/hvc0 instead. The image building code (which we DO use!) was updated correspondingly without caring about backwards compatibility and dropped ttyS0 on the floor. Someone noted this in
systemd/mkosi#2834 and the recommendation was to switch to systemd credentials: exactly what this commit does. The mkosi maintainer also expressed the possible removal of --autologin in the future.

Pros:

  • Completely removes the autologin dependency on the changing mkosi behavior. Compatible with any mkosi version.
  • Applies to all terminals, zero hardcoded name.
  • Simpler, clearer and more direct implementation: zero configuration file!
  • More dynamic: changes and tests do not require rebuilding anything.

Cons:

  • Requires systemd v251 or above (May 2022)
  • Applies to all terminals but could be more selective when using "per-instance" systemd credentials added in v257 (December 2024)

Until mkosi v24 commit c236c9f7b9c82d3, `mkosi --autologin` used to be
applied to four devices: console, tty1, ttyS0 and one
architecture-dependent device.

mkosi has some QEMU features of its own to boot the image. run_qemu.sh
never used any of that. We should probably try (some of) it in the
future but I digress. In that mkosi commit, `mkosi/qemu.py` (which we
don't use) stopped using `ttyS0` and replaced it with the faster
`/dev/hvc0` instead. The image building code (which we DO use!) was
updated correspondingly without caring about backwards compatibility and
dropped ttyS0 on the floor. Someone noted this in
systemd/mkosi#2834 and the recommendation was to
switch to systemd credentials: exactly what this commit does. The mkosi
maintainer also expressed the possible removal of `--autologin` in the
future.

Pros:
- Completely removes the autologin dependency on the changing mkosi
  behavior. Compatible with any mkosi version.
- Applies to all terminals, zero hardcoded name.
- Simpler, clearer and more direct implementation: zero configuration file!
- More dynamic: changes and tests do not require rebuilding anything.

Cons:
- Requires systemd v251 or above (May 2022)
- Applies to all terminals but could be more selective when using
  "per-instance" systemd credentials added in v257 (December 2024)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 12, 2025

@davejiang please confirm this works for you before this get merged.

@marc-hb marc-hb marked this pull request as ready for review February 12, 2025 02:47
@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 12, 2025

Cons:

Requires systemd v251 or above (May 2022)

To clarify: people building with systemd < v251 (e.g. building Ubuntu 22.04 images) will lose autologin but nothing else.

@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 12, 2025

@davejiang please confirm this works for you before this get merged.

I just got a confirmed Tested-by: @davejiang

Now this just needs a Reviewed-by: :-)

@stellarhopper stellarhopper merged commit 0ba61b4 into pmem:main Feb 12, 2025
2 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants