-
Notifications
You must be signed in to change notification settings - Fork 172
overlay.d: Update ignition.firstboot services for soft-reboots #3536
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
Conversation
b92652c
to
f13b100
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (but I suggested this so I won't officially approve)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume ConditionFirstBoot=true
units do not run again in a soft reboot on the first boot since /etc/machine-id
is now present. Correct?
overlay.d/05core/usr/lib/systemd/system/coreos-ignition-firstboot-complete.service
Outdated
Show resolved
Hide resolved
31079c6
to
787b3dc
Compare
/etc/machine-id is there:
However, I don't see anything in the code or service that mentions /etc/machine-id... Not sure if you mean that it should not run because /etc/machine-id means that is not longer the first boot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, but looks fine overall. That said, one could imagine other systemd units that use ignition.firstboot
out there instead of ConditionFirstBoot
that will also hit this.
For this specific unit, I think the current conditionals here are more appropriate than ConditionFirstBoot=
, but everything else should probably use that.
OK and we have one actually in this very repo:
fedora-coreos-config/overlay.d/15fcos/usr/lib/systemd/system/coreos-check-ssh-keys.service
Line 14 in 112a785
ConditionKernelCommandLine=ignition.firstboot |
overlay.d/05core/usr/lib/systemd/system/coreos-ignition-firstboot-complete.service
Show resolved
Hide resolved
89f8cfb
to
caa29cb
Compare
# This condition is required for cases where a soft-reboot is issued on the | ||
# firstboot. Soft reboot do not change the kernel or its command-line arguments, | ||
# which would cause this service to fail after the soft-reboot completes. | ||
ConditionPathExists=/boot/ignition.firstboot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite. What I mean is that this unit should use ConditionFirstBoot=true
instead of ConditionKernelCommandLine=
+ ConditionPathExists=
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum. Looking there are some other uses of ConditionFirstBoot=true
but not many
$ podman run --rm -ti quay.io/fedora/fedora-coreos:stable grep -r ConditionFirstBoot /usr/lib/systemd/system
/usr/lib/systemd/system/systemd-homed-firstboot.service:ConditionFirstBoot=yes
/usr/lib/systemd/system/coreos-update-ca-trust.service:ConditionFirstBoot=true
/usr/lib/systemd/system/coreos-update-ca-trust.service:# All services which use ConditionFirstBoot=yes should use
/usr/lib/systemd/system/ignition-delete-config.service:ConditionFirstBoot=true
/usr/lib/systemd/system/first-boot-complete.target:ConditionFirstBoot=yes
/usr/lib/systemd/system/zincati.service:# created so that we don't cause ConditionFirstBoot=true units to run twice
/usr/lib/systemd/system/systemd-firstboot.service:ConditionFirstBoot=yes
/usr/lib/systemd/system/afterburn-firstboot-checkin.service:ConditionFirstBoot=yes
$
I think I agree with you it'd be better to do so, however a general issue with ConditionFirstBoot
is it doesn't handle the case where the system is interrupted (poweroff/crash) during first boot. Those services will then later fail to reconcile.
Dunno that it matters though in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of background on that topic. See discussions in e.g. systemd/systemd#4511. This is why we do this here for example:
fedora-coreos-config/overlay.d/05core/usr/lib/systemd/system/coreos-update-ca-trust.service
Lines 9 to 16 in bfe3327
# All services which use ConditionFirstBoot=yes should use | |
# Before=first-boot-complete.target, which is a target that | |
# was introduced in https://github.com/systemd/systemd/issues/4511 | |
# and hasn't propagated everywhere yet. Once the target propagates | |
# everywhere, we can drop the systemd-machine-id-commit.service | |
# from the Before= line. | |
Before=first-boot-complete.target systemd-machine-id-commit.service | |
Wants=first-boot-complete.target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which, presumably we should also do for coreos-check-ssh-keys.service
, but yeah I'm not too worried about it.
coreos/coreos-assembler#4119 surfaced that this services using ConditionKernelCommandLine=ignition.firstboot would fail on soft-reboots, it's non fatal but would make the Kola tests fail. Co-authored-by: Jonathan Lebon <[email protected]> Co-authored-by: Colin Walters <[email protected]>
caa29cb
to
bc3c368
Compare
coreos/coreos-assembler#4119 surfaced that this service would fail on soft-reboots, it's non fatal but would make the Kola tests fail. It looks like originally this was set to fail instead of risking not running it:
fedora-coreos-config/overlay.d/05core/usr/libexec/coreos-ignition-firstboot-complete
Line 14 in 20feb17