-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
OS X, podman machine time stops sometime #11541
Comments
I think KVM does this ( Might have to run an ntpd in the VM, before it is supported by the virtualization EDIT: I think I got RTC and NTP confused in my head there.
|
There is a long blog post about this on the Docker blog. Docker Desktop runs an embedded NTP server on the host. It takes his source on the system time. A NTP client in the VM keeps it in sync. |
JFYI: Maybe my case is connected with that, but in my case it wasn't a slowdown because time completely stoped. But it looks like NTP hack could workaround this particular issue too |
@dustymabe Is this something we should turn on in Fedora CoreOS? |
@ashley-cui PTAL |
hmm.. NTP should be utilized on Fedora CoreOS by default What's the output of the following commands run on the Fedora CoreOS host?
|
My "podman machine" CoreOS seems synced to 2.fedora.pool.ntp.org |
I think podman machine should be self-contained and not require an Internet access. What if you code in the plane? The time should not drift. |
This situation can also happen after suspend/resume of the system. See a solution here: https://github.com/linuxkit/linuxkit/tree/master/pkg/host-timesync-daemon |
A friendly reminder that this issue had no activity for 30 days. |
@dm3ch @baude @ashley-cui Is this still a bug? |
I think so |
Should we grab the code from linuxkit/linuxkit@d24d0bd and add it to podman system service. So that if this device exists we could grab the latest time and set it when podman service starts up. |
@guillaumerose @dustymabe WDYT? |
@guillaumerose @dustymabe friendly ping |
I'm no expert here. So mac/windows don't have a good way to keep VM clocks in sync with the host clock but the code in linuxkit/linuxkit@d24d0bd knows how to extract that information from the hypervisor and apply it to the VM? If there is a way to extract the host time from the guest I'm surprised linux (or some builtin userspace daemon) doesn't already know how to get that information. Is there any open issues against some builtin linux components that discuss this issue? |
This is still an issue, an example from a podman machine started early yesterday:
Funnily enough even the 'RTC' is lagging but not as much as the system time. systemd's ntp thing is clearly not working, I'm not sure why (it is supposed to have sane defaults, and running ntpdate inside container works, but cannot set time due to permissions I guess). NOTE: The local time roughly correlates to not having moved when machine was suspended; RTC time lag I have no idea, I guess it just doesn't get updated from the host. After
|
Run it privileged, and it should work. |
I just ran into this and strongly suspect it's related to system sleep events, which should be easier to trigger at wake in the VM, since the clock hardware on the host has very low drift and I saw a ~3.5 hour lag in the last 6 wall-clock hours. One factor which is almost certainly exacerbating this: I'm on a network which firewalls arbitrary NTP and podman does not pass through the host's NTP |
How? At least with podman machine, it does not apparently help.
|
It does require a rootfull containers. Rootless users are not allowed to adjust machine time. |
Is there anyway to easily configure the VM? [core@localhost ~]$ sudo sed -i 's/#NTP=.*/NTP=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org/g' /etc/systemd/timesyncd.conf
[core@localhost ~]$ grep -v '^#' /etc/systemd/timesyncd.conf
[Time]
NTP=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org
[core@localhost ~]$ sudo systemctl restart systemd-timesyncd.service This of course won't help if there's firewalls blocking stuff, as in #11541 (comment) |
A friendly reminder that this issue had no activity for 30 days. |
Got this issue with Minio container (after Mac sleep/awaik).
|
I'm not certain these are the same issues - though they could be, given other variables. I did not have time drift in my postgres containers using Docker. Using rootless podman, it is a very serious problem related to power saving and sleep, as far as I can tell. |
Here's another method I came across to reset the clock manually. I wasn't able to use one of the other methods, so I did this. I stopped the ntp service (which didn't seem to be working anyway) and then set the time manually:
|
I ran into this and used this as a workaround:
|
I got hit with this recently when trying to push a container to an internal registry and SSL failed because the clock in the podman VM on MacOS was a couple weeks behind. Rebooting it fixed the issue but we should try and get the VM to stay in sync timewise |
I installed sleepwatcher via #!/bin/bash
# Fix Podman Machine's time drift on wake
if [[ $(/usr/local/bin/podman machine info) ]]; then
the_date=$(date +'%Y-%m-%dT%H:%M:%S')
/usr/local/bin/podman machine ssh sudo date --set $the_date
echo "Updated Podman Machine date: $the_date" >> ~/podman_debug.log
fi So far, so good (until a long term fix becomes available). |
I edited |
To update the default Podman-Machine:
|
Makestep does indeed seem like the right solution. It looks like
|
This is still an issue. I ran into it as I was using Keycloak as a Quarkus devservices container and the tokens issued were using the VM time and therefore already expired upon issuance. |
Same issue here, noticed today after my mac hibernated over the weekend. Nothing helped except restarting the machine. |
I asked Fedora CoreOS if it would make sense to use |
it could easily be added to the ignition file that is used to configure the coreos instance. |
Ok, I wondered if Podman might already had its own Ignition configuration. I found it and did just that in #17661. |
Thanks for the PR. I have been experiencing this issue numerous times and this seems like a good fix! Hoping it goes thru soon. |
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 containers#11541 Signed-off-by: Jordan Christiansen <[email protected]>
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 containers#11541 Signed-off-by: Jordan Christiansen <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Date output is wrong for both containers and podman machine itself on OS X.
Steps to reproduce the issue:
I'm not sure 100% in my reproduction guide
Describe the results you received:
OS X date:
Podman container and
podman machine ssh
date:I have ran same command again and time was completely the same.
After stoping and starting machine again time started to go.
Describe the results you expected:
Date inside podman machine should be right
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
OS X info:
The text was updated successfully, but these errors were encountered: