Problems with timesyncd / ntp on WSL2 / 22.04 #11548
Unanswered
bimmerdriver
asked this question in
Q&A
Replies: 1 comment
-
Am I the only person having this problem? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I posted about this in Ask Ubuntu a few days ago, but there hasn't been any reply, so I thought I would try here.
I'm running Ubuntu 22.04 LTS on Windows 10 / WSL2. I'm using bash, not the desktop.
I'm using the computer to run an ADS-B receiver to upload aircraft positions to flightradar24 and flightaware. The flightradar24 software is having a conflict with timesyncd to maintain the system time.
Here is the log from flightradar24:
At the time I copied the log, the offset was relatively small, but it varies and at times it can be 30-40 seconds. I'm also seeing the effects of this in the flightaware software, because it's reporting that the time is unstable. The flightradar24 software is known to have a broken implementation of ntp, possibly because it's trying to set the time centrally, rather than locally.
I've tried to fix this using timesyncd, but I haven't been successful, so I tried to install ntpd. That wasn't successful either.
Originally, timesyncd would not sync to ntp. I had to override the default configuration due to running Ubuntu on wsl2. (I found this override on the internet.)
The above override enabled timesyncd to start properly and sync to ntp.
Here is the rest of the configuration for timesyncd:
I'm using pool.ntp.org temporarily for testing. I reduced PollIntervalMinSec to 16 so the time would be synchronized more frequently. The flightradar24 software recognizes the time difference and "corrects it" again.
Here is the status of timedatectl:
According to the output, it's syncing with ntp. (You can also see the RTC is running faster. It runs much faster.) If I repeat this command, I can see the time jumping backward and forward, apparently due to flightradar24 incorrectly setting the time and timesyncd correcting the time.
Here is the status of systemd-timesyncd:
Again, this seems to confirm that it's syncing with pool.ntp.org.
Here is the output of ntpdate -q:
If I understand correctly, the offset of the computer from pool.ntp.org is only ~0.27 seconds.
Here is timedatectl timesync-status:
It's reporting an offset of ~8.4 seconds. This is taken moments after restarting systemd-timesyncd and also after executing ntpdate pool.ntp.org.
Either I'm confused about something or timesyncd is reporting an inconsistent offset from ntpdate. I don't understand how this can be, since they are both using pool.ntp.org.
In order to try and get around this, I attempted to install ntp on the computer. I shut down the flightradar24 and flightaware services so they would not interfere with ntpd syncing the clock. As I said above, the RTC runs much faster than it should (no idea why), so before I started ntpd, I set the time using ntpdate pool.ntp.org and I set the RTC using hwclock -w. Then I immediately started ntpd. It ran for a while, then failed with a message ntpd frequency error -18564 PPM exceeds tolerance 500 PPM. Does this mean the RTC is not accurate enough for ntpd to work properly?
I understand there can be issues synchronizing the system time in virtual environments, but I'm hoping someone that knows about timesyncd and ntpd can help me sort this out.
Beta Was this translation helpful? Give feedback.
All reactions