AmazonWSL
AmazonWSL copied to clipboard
AL2 / WSL2 time issue.
I'm finding that i cant' keep my WSL image time synced... ntp and chronyd both fail
bash-4.2# sudo service chronyd start Redirecting to /bin/systemctl start chronyd.service Failed to get D-Bus connection: Operation not permitted
The temp fix, was to update it manually.
bash-4.2# sudo ntpdate pool.ntp.org 5 Sep 10:49:17 ntpdate[5592]: step time server 43.252.70.34 offset 3455.750697 sec
This was affecting my ability to connect to AWS with temporary credentials as the time was sufficently wrong that it would not stay in sync.
It appears that if i shut down my machine, the wsl machine clock actually stops, were as the host machine's clock does'nt, and it restarts from where it started off.
It seems to be an issue of WSL itself.
system date is not same with windows (WSL 2) #4245 - microsoft/WSL
It seems that you need to create a script that uses ntpdate
as in your post,
or end the session and then start it again...
For the time being until it is fixed, it can be handled with the following command.
sudo hwclock -s