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

systemd: enable bootc-status-updated.target on startup #1041

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

jeckersb
Copy link
Contributor

@jeckersb jeckersb commented Jan 17, 2025

Any services that react to status changes should be idempotent, and
should run on boot. It is likely (but not guaranteed) that during
boot we are in the process of switching from a previous deployment to
a new one, and thus what was previously "staged" is now "booted" and
what was previously "booted" is now "rollback", so anything that cares
about status is going to want to handle that.

Signed-off-by: John Eckersberg [email protected]

@jeckersb
Copy link
Contributor Author

Actually it's not even firstboot, for example after doing a bootc update and reboot this is required so what was staged becomes booted.

@cgwalters
Copy link
Collaborator

In the general case, don't we actually want to trigger bootc-status-updated.target as part of multi-user.target by default?

@jeckersb
Copy link
Contributor Author

In the general case, don't we actually want to trigger bootc-status-updated.target as part of multi-user.target by default?

Hmm yeah probably. In a perfect world we don't want to trigger it if nothing has changed (you rebooted the system without any sort of update/switch/rollback queued), but I think that's better than it not triggering when the status did change.

@cgwalters
Copy link
Collaborator

This heavily relates to a discussion elsewhere for a metadata flag of "is this the first boot of a deployment"? If we had that, then we could key off it in our systemd generator and only enqueue the change notification if we found that.

ref ostreedev/ostree#3032

But for now I think it's actually OK to run on boot by default - most tools that want to hook into this should be idempotent anyways, i.e. they need to handle the case where nothing changed. Not that anything will run by default except for the subman case today anyways.

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Marking requested-changes per #1041 (comment)

@cgwalters cgwalters added the area/client Related to the client/CLI label Jan 17, 2025
@jeckersb jeckersb changed the title systemd: publish rhsm facts on startup systemd: enable bootc-status-updated.target on startup Jan 17, 2025
@jeckersb
Copy link
Contributor Author

Marking requested-changes per #1041 (comment)

Updated to static enable the .target alongside the .path so both will be enabled and activated at boot. Then the centos-stream MR for rhsm should just work, since the target will trigger the service once it's enabled by the preset. Unfortunately this means we'll need another bootc release to land in c10s/c9s before this all works (unless I hack around it temporarily in the base image build, which I would rather not do).

@@ -2,3 +2,6 @@
Description=Target for bootc status changes
Documentation=man:bootc-status-updated.target(8)
StopWhenUnneeded=true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we're now enabling this default; I think we should probably also add here ConditionPathExists=/run/ostree-booted? In practice it's probably effectively the same, but the difference is that everyone who isn't using bootc will I think see "skipped as condition not met" vs "reached target bootc-status-updated" and I think the former makes more sense.

Alternatively: We could just dynamically enable this from our generator in that condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 good catch, updated

Any services that react to status changes should be idempotent, and
should run on boot.  It is likely (but not guaranteed) that during
boot we are in the process of switching from a previous deployment to
a new one, and thus what was previously "staged" is now "booted" and
what was previously "booted" is now "rollback", so anything that cares
about status is going to want to handle that.

Signed-off-by: John Eckersberg <[email protected]>
@cgwalters cgwalters enabled auto-merge January 17, 2025 21:13
@cgwalters cgwalters merged commit e8bb9f7 into containers:main Jan 17, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/client Related to the client/CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants