From 9ac0d4f1a69e74f25ef41c88a1c1378fa333c19e Mon Sep 17 00:00:00 2001 From: Jordan Christiansen Date: Tue, 28 Feb 2023 12:09:12 -0600 Subject: [PATCH] podman machine: Adjust Chrony makestep config This allows Chrony to update the system time when it has drifted far from NTP time. By default Chrony only makes slight adjustments, but in the case where a user's laptop lid has been shut for a while and then the machine is resumed, the VM system time could be hours or days behind real time, and it may never catch up if Chrony only makes slight changes. [NO NEW TESTS NEEDED] Fixes #11541 Signed-off-by: Jordan Christiansen --- pkg/machine/ignition.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pkg/machine/ignition.go b/pkg/machine/ignition.go index 6a6495bf76..9212183e67 100644 --- a/pkg/machine/ignition.go +++ b/pkg/machine/ignition.go @@ -513,6 +513,34 @@ Delegate=memory pids cpu io } } + files = append(files, File{ + Node: Node{ + User: getNodeUsr("root"), + Group: getNodeGrp("root"), + Path: "/etc/chrony.conf", + }, + FileEmbedded1: FileEmbedded1{ + Append: []Resource{{ + Source: encodeDataURLPtr("\nconfdir /etc/chrony.d\n"), + }}, + }, + }) + + // Issue #11541: allow Chrony to update the system time when it has drifted + // far from NTP time. + files = append(files, File{ + Node: Node{ + User: getNodeUsr("root"), + Group: getNodeGrp("root"), + Path: "/etc/chrony.d/50-podman-makestep.conf", + }, + FileEmbedded1: FileEmbedded1{ + Contents: Resource{ + Source: encodeDataURLPtr("makestep 1 -1\n"), + }, + }, + }) + return files }