System Time Not Synchronizing

Hello.

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

garuda-inxi Output:

System:
Kernel: 6.2.1-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=af3a3762-0a45-49ae-af34-0ad9c013e971 rw rootflags=subvol=@
quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
loglevel=3 ibt=off
Desktop: KDE Plasma v: 5.27.2 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Machine:
Type: Desktop System: ASUS product: N/A v: N/A serial: <superuser required>
Mobo: ASUSTeK model: PRIME B550-PLUS v: Rev X.0x
serial: <superuser required> UEFI: American Megatrends v: 2803
date: 04/27/2022
CPU:
Info: model: AMD Ryzen 7 3700X bits: 64 type: MT MCP arch: Zen 2 gen: 3
level: v3 note: check built: 2020-22 process: TSMC n7 (7nm)
family: 0x17 (23) model-id: 0x71 (113) stepping: 0 microcode: 0x8701021
Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
L3: 32 MiB desc: 2x16 MiB
Speed (MHz): avg: 3689 high: 4313 min/max: 2200/4426 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 3600 2: 3600
3: 3600 4: 3600 5: 3592 6: 4313 7: 3888 8: 3600 9: 4025 10: 3600 11: 3600
12: 3600 13: 3641 14: 3600 15: 3574 16: 3600 bogomips: 114979
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities: <filter>
Graphics:
Device-1: AMD Navi 23 [Radeon RX 6600/6600 XT/6600M] vendor: Sapphire
driver: amdgpu v: kernel arch: RDNA-2 code: Navi-2x process: TSMC n7 (7nm)
built: 2020-22 pcie: gen: 4 speed: 16 GT/s lanes: 16 ports:
active: HDMI-A-1 empty: DP-1,DP-2,DP-3 bus-ID: 09:00.0 chip-ID: 1002:73ff
class-ID: 0300
Display: x11 server: X.Org v: 21.1.7 with: Xwayland v: 22.1.8
compositor: kwin_x11 driver: X: loaded: amdgpu unloaded: modesetting,radeon
alternate: fbdev,vesa dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
s-diag: 582mm (22.93")
Monitor-1: HDMI-A-1 mapped: HDMI-A-0 model: ViewSonic VA2451 SERIES
serial: <filter> built: 2014 res: 1920x1080 hz: 60 dpi: 94 gamma: 1.2
size: 521x293mm (20.51x11.54") diag: 598mm (23.5") ratio: 16:9 modes:
max: 1920x1080 min: 720x400
API: OpenGL v: 4.6 Mesa 22.3.6 renderer: AMD Radeon RX 6600 (navi23 LLVM
15.0.7 DRM 3.49 6.2.1-zen1-1-zen) direct-render: Yes
Audio:
Device-1: AMD Navi 21/23 HDMI/DP Audio driver: snd_hda_intel v: kernel pcie:
gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 09:00.1 chip-ID: 1002:ab28
class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: ASUSTeK
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 0b:00.4 chip-ID: 1022:1487 class-ID: 0403
Sound API: ALSA v: k6.2.1-zen1-1-zen running: yes
Sound Interface: sndio v: N/A running: no
Sound Server-1: PulseAudio v: 16.1 running: no
Sound Server-2: PipeWire v: 0.3.66 running: yes
Network:
Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: ASUSTeK PRIME B450M-A driver: r8169 v: kernel pcie: gen: 1
speed: 2.5 GT/s lanes: 1 port: f000 bus-ID: 06:00.0 chip-ID: 10ec:8168
class-ID: 0200
IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
IF-ID-1: anbox0 state: down mac: <filter>
Drives:
Local Storage: total: 1.36 TiB used: 198.61 GiB (14.2%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital
model: WD Blue SN570 1TB size: 931.51 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: 234100WD temp: 36.9 C scheme: GPT
ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST3500414CS
size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 3.0 Gb/s
type: HDD rpm: 5900 serial: <filter> rev: CA14 scheme: GPT
Partition:
ID-1: / raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 198.61 GiB (21.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 608 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 198.61 GiB (21.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 198.61 GiB (21.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 931.22 GiB size: 931.22 GiB (100.00%)
used: 198.61 GiB (21.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 31.25 GiB used: 512 KiB (0.0%) priority: 100
dev: /dev/zram0
Sensors:
System Temperatures: cpu: 49.4 C mobo: N/A gpu: amdgpu temp: 42.0 C
mem: 44.0 C
Fan Speeds (RPM): N/A gpu: amdgpu fan: 0
Info:
Processes: 424 Uptime: 2m wakeups: 0 Memory: 31.25 GiB
used: 5.11 GiB (16.4%) Init: systemd v: 253 default: graphical
tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7 Packages: pm: pacman
pkgs: 2655 libs: 583 tools: gnome-software,octopi,pamac,paru Shell: fish
v: 3.6.0 default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.25
Garuda (2.6.15-1):
System install date:     2023-02-21
Last full system update: 2023-03-04
Is partially upgraded:   No
Relevant software:       snapper NetworkManager mkinitcpio
Windows dual boot:       No/Undetected
Failed units:            anbox-container-manager.service 
bluetooth-autoconnect.service systemd-networkd-wait-online.service

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.

Thanks.

UPDATE:

I manually updated the time using:

sudo ntpdate pool.ntp.org

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:

FallbackNTPServers=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=0
Frequency=0

I've also tried sudo timedatectl set-ntp true to no avail.

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:

[Time]
NTP=0.asia.pool.ntp.org 1.asia.pool.ntp.org
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org

Then run the rest of the commands in the recommended answer.

I hope that helps, welcome to the community @Helmaar. :slightly_smiling_face:

Hi. Thanks for the reply. This is what my config file looks like:

[Time]
#NTP=
NTP=0.pool.ntp.org 1.asia.pool.ntp.org 3.pk.pool.ntp.org
#FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org 4.pool.ntp.org 5.pool.ntp.org
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
#ConnectionRetrySec=30
#SaveIntervalSec=60

I then ran the commands mentioned in the link:

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:

systemctl status systemd-timesyncd.service

This thread is kind of dated, but suggests restarting systemd-networkd if restarting systemd-timesyncd.service doesn’t work: [SOLVED]systemd-timesyncd is not syncing time / System Administration / Arch Linux Forums

2 Likes

Hi. Thanks for the additional help. I wasn't able to try this fix out yet. Will do in a while and get back to you.

Hi.

Currently, this is my timesyncd.conf file:

[Time]
#NTP=
NTP=0.pool.ntp.org 1.asia.pool.ntp.org 3.pk.pool.ntp.org
#FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org 4.pool.ntp.org 5.>
#RootDistanceMaxSec=5
#PollIntervalMinSec=32
#PollIntervalMaxSec=2048
#ConnectionRetrySec=30
#SaveIntervalSec=60

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

UPDATE:

I just noticed something. I ran journalctl -u systemd-timesyncd.service and this is what came up:

17:16:11 AMD-PC systemd[1]: Starting Network Time Synchronization...
مارچ 05 17:16:11 AMD-PC systemd[1]: Started Network Time Synchronization.
مارچ 06 00:03:27 AMD-PC systemd[1]: Stopping Network Time Synchronization...
مارچ 06 00:03:28 AMD-PC systemd[1]: systemd-timesyncd.service: Deactivated successfully.
مارچ 06 00:03:28 AMD-PC systemd[1]: Stopped Network Time Synchronization.
-- Boot 5d69fbc0d1d147658bdc2901623bf008 --
مارچ 06 21:13:05 AMD-PC systemd[1]: Starting Network Time Synchronization...
مارچ 06 21:13:05 AMD-PC systemd[1]: Started Network Time Synchronization.
مارچ 06 21:36:12 AMD-PC systemd[1]: Stopping Network Time Synchronization...
مارچ 06 21:36:12 AMD-PC systemd[1]: systemd-timesyncd.service: Deactivated successfully.
مارچ 06 21:36:12 AMD-PC systemd[1]: Stopped Network Time Synchronization.
مارچ 06 21:36:12 AMD-PC systemd[1]: Starting Network Time Synchronization...
مارچ 06 21:36:12 AMD-PC systemd[1]: Started Network Time Synchronization.
مارچ 06 22:18:00 AMD-PC systemd[1]: Stopping Network Time Synchronization...
مارچ 06 22:18:00 AMD-PC systemd[1]: systemd-timesyncd.service: Deactivated successfully.
مارچ 06 22:18:00 AMD-PC systemd[1]: Stopped Network Time Synchronization.
-- Boot 1514f89e22c54465a792f9ddf9fd2451 --
مارچ 06 22:18:46 AMD-PC systemd[1]: Starting Network Time Synchronization...
مارچ 06 22:18:46 AMD-PC systemd[1]: Started Network Time Synchronization.

It seems the service is auto deactivating.

Hmm, that is curious. You don't have dhcpcd installed, do you?

This thread suggests that timesyncd gets restarted whenever the DHCP lease is renewed: timesyncd stopping and starting every 5 minutes? - Raspberry Pi Forums

1 Like

No I do not have dchpcd installed. Also, my HDCP lease time is set to 24 hours.

UPDATE

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.