I am facing this issue where my system (OS) time is lagging behind. I thought it was the CMOS Battery going bad so I changed it. But now it's become so bad its lagging behind by 40 seconds.
Here's the output of datetimectl:
Local time: هفته 2023-03-04 17:56:24 PKT
Universal time: هفته 2023-03-04 12:56:24 UTC
RTC time: هفته 2023-03-04 12:56:24
Time zone: Asia/Karachi (PKT, +0500)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
It seems that the service responsible to synchronize time is not working properly. One more thing, since I get slow download speeds in my region, I usually use a VPN to update my OS. There's no dual boot. Not sure if it affects anything but thought I'd let it be known. Any sort of help would be greatly appreciated.
I also ran sudo timedatectl set-ntp true and restarted the service using sudo systemctl restart systemd-timesyncd.service. timedatectl is still showing the same output:
Local time: هفته 2023-03-04 18:44:35 PKT
Universal time: هفته 2023-03-04 13:44:35 UTC
RTC time: هفته 2023-03-04 13:44:35
Time zone: Asia/Karachi (PKT, +0500)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
Additionally, timedatectl show-timesync gives the following output:
It looks like you should be able to get this switched to "yes" by adding a value to the NTP= field in /etc/systemd/timesyncd.conf, then reload the daemon and restart NTP. Check out the answer in this thread:
That linked answer didn't quite work for someone else who is also in an Asian timezone like yourself. They added some additional notes in the last comment on the bottom of the page:
For those who followed max's answer, but failed. Go to NTP, choose your specific pool zone, and add at least two pool zones to your /etc/systemd/timesyncd.conf. For instance, for Asia, add:
sudo systemctl daemon-reload
sudo timedatectl set-ntp off
sudo timedatectl set-ntp on
Running timedatectl status is giving:
Local time: اتوار 2023-03-05 03:30:10 PKT
Universal time: هفته 2023-03-04 22:30:10 UTC
RTC time: هفته 2023-03-04 22:29:30
Time zone: Asia/Karachi (PKT, +0500)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
You know what's weird? Now that I look at it, the link doesn't instruct to restart the service, which will be needed after editing /etc/systemd/timesyncd.conf.
sudo systemctl restart systemd-timesyncd.service
If you get an error when restarting the service, paste it into the thread so we can take a look.
If you don't get an error, check the status to see what it's doing:
I edited it and then ran sudo systemctl restart systemd-timesyncd.service. Then I ran systemctl status systemd-timesyncd.service and got the following output:
systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
Active: active (running) since Mon 2023-03-06 21:36:12 PKT; 3min 40s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 306840 (systemd-timesyn)
Status: "Daemon is running"
Tasks: 1 (limit: 38338)
Memory: 1.3M
CPU: 41ms
CGroup: /system.slice/systemd-timesyncd.service
└─306840 /usr/lib/systemd/systemd-timesyncd
مارچ 06 21:36:12 AMD-PC systemd[1]: Starting Network Time Synchronization...
مارچ 06 21:36:12 AMD-PC systemd[1]: Started Network Time Synchronization.
Running timedatectl status still gives the previous result:
Local time: پير 2023-03-06 21:40:21 PKT
Universal time: پير 2023-03-06 16:40:21 UTC
RTC time: پير 2023-03-06 16:40:20
Time zone: Asia/Karachi (PKT, +0500)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
If I manually synchronize using sudo ntpdate pool.ntp.org, the clock is successfully synchronized. Also, I used a Live USB to boot into Garuda Linux. I checked the status of timedatectl and the system clock was synchronized.