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

Autorun fixes #101

Merged
merged 7 commits into from
Jan 21, 2025
Merged

Autorun fixes #101

merged 7 commits into from
Jan 21, 2025

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Jan 17, 2025

  • Stop messing with symbolic links and use systemd preset instead.
    Since Fedora 37, systemctl preset-all is run on the first boot (which
    is every boot unless run_qemu.sh --rw is specified).

https://fedoraproject.org/wiki/Changes/Preset_All_Systemd_Units_on_First_Boot

This destroys and reconfigures all symbolic links based on .preset
files. So, switch to .preset files.

Other recent distributions have most likely adopted the same method, see
man systemd-firstboot etc.

Even for the distributions that have not, mkosi v15 commit 84ec58cca8e3c
also runs systemctl preset-all at build time anyway - whichever the
distribution is.

  • Also drop "AllowIsolate" which is discouraged probably never made
    sense.

  • Simplify and fix the target dependency graph

It was not obvious what gets logged where and when, document that.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This will be re-used by systemd fixes

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Stop hacking symbolic links and use .preset files to make sure ssh,
systemd-networkd and systemd-resolved are enabled by default.

Use .preset files according to `man systemd.preset` and other official
systemd documentation. Generally speaking, symbolic links are created
and deleted by systemctl commands based on configuration files. So it's
not clear whether the previous symbolic link creation really worked and
when (most services were likely already enabled anyway in most
configurations).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb marc-hb force-pushed the autorun-fixes branch 2 times, most recently from 2ca0424 to 2d3aa2c Compare January 17, 2025 03:29
- Stop messing with symbolic links and use systemd preset instead.
Since Fedora 37, `systemctl preset-all` is run on the first boot (which
is every boot unless run_qemu.sh --rw is specified).

https://fedoraproject.org/wiki/Changes/Preset_All_Systemd_Units_on_First_Boot

This destroys and reconfigures all symbolic links based on .preset
files. So, switch to .preset files.

Other recent distributions have most likely adopted the same method, see
`man systemd-firstboot` etc.

Even for the distributions that have not, mkosi v15 commit 84ec58cca8e3c
also runs `systemctl preset-all` at build time anyway - whichever the
distribution is.

- Also drop "AllowIsolate" which is discouraged probably never made
  sense.

- Simplify and fix the target dependency graph

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Fail fast and print an error message instead.

There's probably a dependency missing between --options but that's a
different question.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
We already power off in trap EXIT, no need to repeat it.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
According to Dave Jiang, cxl_test skips over the hardware registers.

Maybe it did not in 2021 when these lines were added to git?

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb marc-hb marked this pull request as ready for review January 17, 2025 07:39
@marc-hb
Copy link
Collaborator Author

marc-hb commented Jan 17, 2025

Successfully tested --cxl-test-run and --autorun on Fedora and Arch Linux with various mkosi versions

@marc-hb
Copy link
Collaborator Author

marc-hb commented Jan 17, 2025

Unrelated "tune2fs" error #47 on Ubuntu 22.04 in https://github.com/pmem/run_qemu/actions/runs/12824790402/job/35761549704?pr=101. Re-running.

@@ -45,4 +45,3 @@ dumpfile /root/ndctl/build/meson-logs/testlog.txt
echo "======= meson-test.log ========" > /dev/kmsg
dumpfile "$logfile"
echo "======= Done $0 ========" > /dev/kmsg
systemctl poweroff
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was needed to actually shutdown the guest fully and exit the qemu process (when I last ran/tested this) - without it, even after a successful completion of all the tests, we'd end up waiting for the timeout to kill it and exit. Does that not happen anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not happen because there is (more recently?) a trap EXIT, check the commit message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see - makes sense, the rest of it looks good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(more recently?)

Impossible to tell from the git log because both poweroff commands came in the same, very first commit.

Anyway I tested this multiple times and a single poweroff command is enough.

I found that because sometimes you want to LOCALLY comment it out for temporary testing and doing this twice was not convenient :-)

@stellarhopper stellarhopper merged commit 561fa8b into pmem:main Jan 21, 2025
2 checks passed
@marc-hb marc-hb deleted the autorun-fixes branch January 21, 2025 23:28
marc-hb added a commit to marc-hb/run_qemu that referenced this pull request Jan 23, 2025
QEMU devices are not required to run cxl tests, so let the user decide
what they want.

Autorun has very recently been fixed (commit 17d0473 and others in
PR pmem#101) and had been broken for likely 1 or 2 years which means no one
was using it which means it's a great time to alter the behavior.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
stellarhopper pushed a commit that referenced this pull request Jan 24, 2025
QEMU devices are not required to run cxl tests, so let the user decide
what they want.

Autorun has very recently been fixed (commit 17d0473 and others in
PR #101) and had been broken for likely 1 or 2 years which means no one
was using it which means it's a great time to alter the behavior.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
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