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

Lima VM clock appears to drift #1307

Open
spacedub opened this issue Jan 18, 2023 · 7 comments
Open

Lima VM clock appears to drift #1307

spacedub opened this issue Jan 18, 2023 · 7 comments
Labels

Comments

@spacedub
Copy link

Description

I have a Debian VM that has been up for 6 days.

Reported date is:
Wed Jan 18 21:30:48 UTC 2023

macos reported date is:
Wed Jan 18 13:48:26 PST 2023

So, 18 minutes apart.

limactl version 0.11.3-27-g7a74ca9

I am using https://github.com/lima-vm/lima/blob/master/examples/debian.yaml slightly modified for my VM.

I assume installing ntp would solve this, but then (assuming this is right), should this not be by default?

@spacedub
Copy link
Author

FWIW, sudo hwclock --hctosys is not helping.

Let me know if you need more info about my current rig.

@spacedub
Copy link
Author

spacedub commented Jan 18, 2023

Also (obviously) confirming that installing ntp does help...

Installing ntp does not help...

dmp@lima-runner:~$ sudo apt-get install ntp
# Wrong date
dmp@lima-runner:~$ date
Wed Jan 18 21:39:57 UTC 2023
# Correct date, seems to be ntp date
dmp@lima-runner:~$ date
Wed Jan 18 21:57:36 UTC 2023
dmp@lima-runner:~$ date
Wed Jan 18 21:57:37 UTC 2023
# Reverting to the previous time after a minute...
dmp@lima-runner:~$ date
Wed Jan 18 21:40:53 UTC 2023

@afbjorklund
Copy link
Member

You can check the source of the hwclock, from inside the VM (with lima):

cat /sys/devices/system/clocksource/clocksource0/current_clocksource

anders@lima-default:/home/anders$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
kvm-clock

@jandubois
Copy link
Member

This is kind of a duplicate of #850 (note that I put a link to a blogpost about how Docker Desktop deals with this into a comment over there).

Also maybe related #939.

You didn't mention your host OS; are you on macOS or Linux?

@spacedub
Copy link
Author

spacedub commented Jan 19, 2023

@jandubois macOS Ventura (M1 max)

@afbjorklund

dmp@lima-runner:~$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
arch_sys_counter

@spacedub
Copy link
Author

@jandubois @afbjorklund I am completely out of my depth on this topic.
Is there a short-term workaround (even something really hack-ish) that I can use?

@afbjorklund
Copy link
Member

I was surprised to hear that NTP wouldn't work (although coarsely), but it probably needs a local server (like DHCP uses)

Would be nice to have a HVF version of the KVM clocks - but it would probably require some modules on the Linux side...

So yeah, it sounds like the same issue as:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants