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

Improve wtmp record mangling. #4501

Merged
merged 1 commit into from
Dec 4, 2023
Merged

Improve wtmp record mangling. #4501

merged 1 commit into from
Dec 4, 2023

Conversation

citrus-it
Copy link
Contributor

This fixes two problems with the current wtmp/utmp record mangling. First it is not idempotent, the system's notion of boot time is set to the current time of day whenever sled agent confirms that time is synchronised. Secondly, this is only approximate even for the first sled agent start, but it's plain wrong if sled agent restarts later.

In conjunction with changes to stlouis, the tmpx utility is now able to process all zones itself, and uses the true system boot time for each zone when updating records.

Fixes: #3514

@citrus-it citrus-it force-pushed the andy/ntp branch 3 times, most recently from f92095f to 72054fe Compare November 17, 2023 11:39
@citrus-it citrus-it force-pushed the andy/ntp branch 2 times, most recently from 1658b3a to 6851663 Compare November 29, 2023 11:15
This fixes two problems with the current wtmp/utmp record mangling.
First it is not idempotent, the system's notion of boot time is
set to the current time of day whenever sled agent confirms that
time is synchronised. Secondly, this is only approximate even for the
first sled agent start, but it's plain wrong if sled agent restarts
later.

In conjunction with changes to stlouis, the `tmpx` utility is now
able to process all zones itself, and uses the true system boot
time for each zone when updating records.

Fixes: #3514
Copy link
Contributor

@jgallagher jgallagher left a comment

Choose a reason for hiding this comment

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

I don't know anything about tmpx, but the local sled-agent changes LGTM

let mut command = std::process::Command::new(PFEXEC);
let cmd = command.args(&["/usr/platform/oxide/bin/tmpx", "-Z"]);
if let Err(e) = execute(cmd) {
warn!(self.inner.log, "Updating [wu]tmpx databases failed: {}", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

We lost the info! log if this succeeds (although maybe it's less interesting to log "we successfully told tmpx to do its thing" than "we told tmpx to modify a specific file"?). I have no strong feeling either way but just wanted to confirm this is intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I had the same thought. The new tmpx is fire and forget, it will traverse all zones and idempotently fix up boot times, producing an error if anything goes wrong. I didn't think it was valuable to keep the success line (but I also have no strong feeling)

@citrus-it citrus-it merged commit 6f2d1c5 into main Dec 4, 2023
20 checks passed
@citrus-it citrus-it deleted the andy/ntp branch December 4, 2023 16:55
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.

wtmp record mangling could use some tuning
2 participants