Monday, June 30, 2025

manual time sync on Ubuntu 24.04

Asked ChatGPT, and it gave the long answer below. The short answer is:
sudo systemctl restart systemd-timesyncd

Long answer pasted below:

To manually trigger an NTP (Network Time Protocol) time update on Ubuntu, you can use the following steps depending on whether you're using systemd-timesyncd, chrony, or ntpd.

🔍 Step 1: Check which time sync service is in use
Run:

timedatectl show | grep -i ntp
Also try:

systemctl status systemd-timesyncd
systemctl status chronyd
systemctl status ntp

✅ If you're using systemd-timesyncd (default on newer Ubuntu versions):
Trigger a manual update:
sudo systemctl restart systemd-timesyncd
Optionally, you can force immediate sync using timedatectl:

timedatectl timesync-status
To see the current status or wait a bit and verify with:

timedatectl status

⚠️ Note: systemd-timesyncd does not support manual "force now" updates — it syncs on its own schedule after restarting.

✅ If you're using chrony:
Force an update:
sudo chronyc makestep
This forces an immediate correction if the clock is off.

You can verify with:

chronyc tracking

✅ If you're using ntpd:
Force an update:
sudo ntpd -gq
-g allows a large initial offset

-q exits after setting the time

Then restart the daemon:

sudo systemctl restart ntp

🕒 Verify time sync
timedatectl
Look for: System clock synchronized: yes

No comments:

Post a Comment