I am looking for an equivalent of 'ntpdate IPaddress' command in the chrony suite to force chronyd to synchronize time right now.
3 Answers
Try
sudo chronyc -a makestep
This will update your system clock quickly (might break some running applications), using the time sources defined in /etc/chronyd.conf
.
-a is needed to avoid
501 Not authorised error
-
2I am getting
501 Not authorised
error returned and clock stays the same Jul 5, 2018 at 9:58 -
Are really you running as root (sudo)? You are talking to chronyd, because it sends you away with a rejection. This is covered in the chrony FAQ Jul 6, 2018 at 22:31
-
-
8Try to run with the
-a
parameter (authenticate automatically)sudo chronyc -a makestep
Dec 19, 2018 at 16:21 -
3The man page for
chronyc (chrony) version 3.5.1 (+READLINE +SECHASH +IPV6 +DEBUG)
(Fedora 32) says the-a
is ignored. Sep 7, 2020 at 10:39
The chrony equivalent to the ntpdate SERVER-ADDRESS
command is:
chronyd -q 'server SERVER-ADDRESS iburst'
Note that chronyd
must not be already running, just as ntpd
must not be running when setting the date with ntpdate
.
-
After that I usually need an additional:
sudo systemctl start chronyd; sudo chronyc -a 'burst 4/4'
– olopopoJun 3, 2021 at 15:37
In my setup, for various reasons, chronyd is disabled and we want to occasionally manually sync with an NTP server.
For this type of scenario, the command in Rob Newton's answer is the one that worked (thanks!).
Note that if you are querying the ntp pool, it is advisable to use the pool command, as in:
chronyd -q 'pool pool.ntp.org iburst'
See this question for additional details.
Also note that if the chronyd service is not running, the command sudo chronyc -a makestep
in Richard Green's answer will not work, since it tries to communicate with the chronyd daemon.
chronyd -q
When run in this mode, chronyd will set the system clock once and exit. It will not detach from the terminal.