Open dirkdev98 opened 2 years ago
Possibly alpine-lima is missing an NTP server ? I thought that lima was adding a RTC in qemu ?
For Ubuntu (systemd) I think it is being handled by systemd-timesyncd
, checking with /dev/rtc0
Possibly alpine-lima is missing an NTP server ? I thought that lima was adding a RTC in qemu ?
It does indeed (in #490). For some reason I remembered that it would sync time with the host instead. So it looks like the RTC gets out of sync as well.
Here is how Docker Desktop handles this: Addressing Time Drift in Docker Desktop for Mac.
I'm seeing something similar in a different configuration (details at #939).
The issue still seems to exist. Any timeframe regarding a solution because recently I ran into that issue upon validating a JWT token (not before / expires etc.). the time difference was actually only about 0.4 seconds but that can be enough for its timestamps to not match anymore and validation to fail. It also seems to exist upon using macOS HyperKit (new virtualization framework).
using busybox as ntp (as mentioned in the article referenced in the comment https://github.com/lima-vm/lima/issues/850#issuecomment-1121980785) seems to work best. there still is a bit of drift but it seems to be the lowest one for now.
Created 2 VMs yesterday, woke up to way more drammatic shift in time
Wed Oct 19 04:16:54 UTC 2118
and
Wed Dec 15 06:03:40 UTC 2213
The worst thing, for some reason I cannot even set the date manually
hwclock --hctosys
hwclock: settimeofday() failed: Invalid argument
date -s '2023-09-01 01:00:00'
date: cannot set date: Invalid argument
Fri Sep 1 01:00:00 UTC 2023
To fix this issue. I have rebooted both VMs, that sync the dates, and I did after
timedatectl set-ntp no
apt install ntp
Hope that is going to fix this issue for now.
I am on lima 0.17.2, and using ubuntu 23.04/release-20230810/ubuntu-23.04-server-cloudimg-arm64.img
Running with vz on macOS Sonoma.
Working around (on Colima):
colima ssh -- sudo date -s @$(TZ=UTC date "+%s")
It's only accurate to the second, that's enough for my use case.
Description
Running Lima via Colima (https://github.com/abiosoft/colima/), I have occasional clock drift issues. I am unable to find a cause for this or even a way to reproduce it. It seems to be after I lock my laptop and get back the next morning, but only once in a while (every 10 days or so) and not consistently every day.
Versions:
docker run -it --rm --cap-add SYS_TIME --privileged -e ALLOW_CIDR=0.0.0.0/0 -p 123:123/udp geoffh1977/chrony
References https://github.com/abiosoft/colima/issues/274, https://github.com/lima-vm/lima/pull/490