I am looking for an equivalent of 'ntpdate IPaddress' command in the chrony suite to force chronyd to synchronize time right now.
-
1You should really check the [documentation...](https://chrony.tuxfamily.org/doc/3.3/chronyd.html) `chronyd -q` When run in this mode, chronyd will set the system clock once and exit. It will not detach from the terminal. – user3788685 Apr 10 '18 at 16:20
4 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

- 13,720
- 5
- 57
- 57

- 711
- 5
- 10
-
2I am getting `501 Not authorised` error returned and clock stays the same – Dimitry K Jul 05 '18 at 09: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](https://chrony.tuxfamily.org/faq.html#_i_keep_getting_the_error_code_501_not_authorised_code) – Richard Green Jul 06 '18 at 22:31
-
ok, I was running on old server with ubuntu 14.04.5. And chrony version 1.29. I guess there should be some authentication step or smth there... – Dimitry K Jul 07 '18 at 16:49
-
8Try to run with the `-a` parameter (authenticate automatically) `sudo chronyc -a makestep` – StackEng2010 Dec 19 '18 at 16:21
-
3The man page for `chronyc (chrony) version 3.5.1 (+READLINE +SECHASH +IPV6 +DEBUG)` (Fedora 32) says the `-a` is ignored. – Richard Green Sep 07 '20 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
.

- 1,344
- 12
- 19
-
After that I usually need an additional: `sudo systemctl start chronyd; sudo chronyc -a 'burst 4/4' ` – olopopo Jun 03 '21 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.

- 141
- 1
- 5
If you're getting:
Could not read keyfile or commandkey in file /etc/chrony.conf
when running:
sudo chronyc -a makestep
Then make sure you have the following line in /etc/chrony.conf:
keyfile /etc/chrony.keys
And make sure you have a passowd for key 0 in /etc/chrony.keys:
0 SHA1 HEX:9222248F87B1FDDB01716FC8F1A7B5AB13CDAC91
You can generate a SHA1 hashed password:
echo -n Th15is4Pa55w0rd! | sha1sum
9222248F87B1FDDB01716FC8F1A7B5AB13CDAC91
If that doesn't work, it may be because you have commandkey
specified as something other than 0 in your /etc/chrony.conf. The default is 0, so if it's set to something else you need to align it with what's in /etc/chrony.keys.

- 401
- 3
- 10