systemd: order update-engine after network-online.target - #58
systemd: order update-engine after network-online.target#58Prachi194agrawal wants to merge 1 commit into
Conversation
update-engine.service currently starts and can mark a newly-updated partition as successful (~1 minute post-reboot) with no dependency on network availability. If a regression leaves the instance without network access, recovery today requires manual intervention via the serial console instead of an automatic rollback. Add After=/Wants=network-online.target so update-engine only starts once network-online.target has been reached. Uses Wants= rather than the Requires= suggested in the issue: systemd.special(7) specifically warns against Requires= on network-online.target, since it would stop update-engine outright if that target were ever deactivated, rather than simply deferring startup. Wants=+After= gives the same ordering without that failure mode. Fixes flatcar/Flatcar#521 Signed-off-by: Prachi Agrawal <prachi194agrawal@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adjusts the update-engine.service systemd unit ordering so the update engine is started only after network-online.target is reached, reducing the chance of prematurely marking an update “successful” before networking is available (which can otherwise block automatic recovery/rollback in network-regression scenarios).
Changes:
- Add
After=network-online.targetto deferupdate-engine.servicestart untilnetwork-online.targetis reached. - Add
Wants=network-online.targetto ensurenetwork-online.targetis pulled in whenupdate-engine.servicestarts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Following up with something I found on closer inspection: this delays the good-partition mark, but doesn't block it indefinitely in a sustained outage. Still a real improvement (more time for a transient outage to resolve, or for someone to notice before the mark is permanent), and I'd expect |
update-engine.service currently starts, and can mark a newly-updated
partition as successful (~1 minute post-reboot), with no dependency on
network availability. If a regression leaves the instance without
network access, recovery today requires manual intervention via the
serial console instead of an automatic rollback.
This adds
After=/Wants=network-online.targetso update-engine onlystarts once network-online.target has been reached.
Wants= vs the Requires= suggested in the issue
I used
Wants=instead ofRequires=.systemd.special(7)warnsagainst
Requires=onnetwork-online.target, since it would stopupdate-engine outright if that target were ever deactivated, rather
than simply deferring startup.
Wants=+After=gives the sameordering without that failure mode. Happy to switch back if there's a
reason
Requires=is actually wanted here.Verification
Verified with
systemd-analyze verify(no syntax errors, nodependency cycles). I was not able to boot-test this on a real Flatcar
image (no QEMU/KVM available in my current setup) - would appreciate a
maintainer or CI confirming actual boot/rollback behavior before merge.
Not included
The issue also asks for documentation of an opt-out drop-in unit for
operators who rely on the current behavior. Leaving that out of this
PR to keep it small/reviewable; happy to follow up with a
flatcar-website docs PR if that's wanted.
Fixes flatcar/Flatcar#521