How does Fedora 40 sync time?

I have one remote server with dead MB battery and with reboot time is off. When I do timedatectl it shows NTP service: inactive, when I do timedatectl set-ntp yes it will sync time after some time. But I checked and didn’t find ntpdate nor chrony nor systemd-timesyncd.service is not enabled or installed. So how does the system sync time? I’m asking as I want to put it in startup script to run sync time remotely on boot if time is reset.
Thanks

it uses /usr/lib/systemd/system/chronyd.service

systemctl status chronyd

if you need, you can switch to ntpd Configuring NTP Using ntpd :: Fedora Docs or systemd-timesyncd (systemd-timesyncd - ArchWiki and systemd-timesyncd.service)

2 Likes

I don’t have cronyd service, neither crony program, nor /etc/cronyd.conf… also /usr/lib/systemd/system/cronyd.service just crond.service which is crontab AFAIK

From what I know chronyd is installed by default.

whats the output of systemctl status chronyd?

If you don’t need any server functionality, you can use systemd-timesyncd (which is part of systemd). It implements a Simple NTP (SNTP) client.

systemctl status systemd-timesyncd
systemctl start systemd-timesyncd
systemctl enable systemd-timesyncd
1 Like

Yes Sorry you are right, silly me. I kept looking for cron… (skipping h) it is installed.

chronyc tracking
chronyc sources

are useful commands…

See also Configuring NTP Using the chrony Suite :: Fedora Docs

1 Like

All these answers were about syncing time.
In your first post you indicated that you have a dead MB battery.
Those batteries are inexpensive and easy to replace so the simplest fix seems to be replace the battery, reset the time in BIOS, then the problem will go away since the RTC will now keep time instead of dying and needing reset.

2 Likes

Yes Jeff, but the the server is in remote location, so I can’t go there, and I have to work within software, for now, until it is changed.

The remote server is certainly an issue.
Is there no one local to the server who could do the hardware fix for you?

A 10 minute downtime on that server and the problem is eliminated at the source instead of trying to do a software workaround.

1 Like

Sure it’s an easy fix, but no one technical there, besides it can create more problems if they mess up something, and better to do it my self when I go there next time. In the mean time I’ve added routine to script that runs every 5min to put current time in some file, and on reboot, if time less then in file it will update it from the file, until synced remotely. But I couldn’t find the way to sync it remotely manually from the script.

systemd-timed has a file which records the latest known time, and this file is used to set the time on the next boot.

You can run it instead of chrony or ntp.

1 Like