You are not logged in.

#1 2021-05-07 15:49:47

EgidioCaprino
Member
Registered: 2016-03-13
Posts: 104

[SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

Hi all,

What's the difference between executing timedatectl set-ntp true and enabling systemd-timesyncd?

Also, on a fresh Arch install timedatectl status shows NTP service: active, so why in the General recommendations page there is a section about Clock synchronization?

Last edited by EgidioCaprino (2021-05-07 18:56:50)

Offline

#2 2021-05-07 17:56:12

Daerandin
Member
From: Norway
Registered: 2013-05-07
Posts: 268
Website

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

man timedatectl wrote:

set-ntp [BOOL]
           Takes a boolean argument. Controls whether network time synchronization is active and enabled (if available). If
           the argument is true, this enables and starts the first existing network synchronization service. If the
           argument is false, then this disables and stops the known network synchronization services. The way that the
           list of services is built is described below.

In other words, it will enable AND start systemd-timesyncd.service. According to the man page it might also start and enable another ntp service instead, but from a quick glance I could not see how it will determine which service to use if multiple are available. However, on a clean Arch install, you will only have systemd-timesynd.service available, as it is a part of systemd. Other ntp services must be installed manually.

Enabling systemd-timesyncd.service will not take effect until next boot, unless you also start the service.

As for this being active after a fresh Arch install is something I am not familiar with, and from what I know it will not be so unless you specifically enable it at some point.

Offline

#3 2021-05-07 17:59:25

EgidioCaprino
Member
Registered: 2016-03-13
Posts: 104

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

It's all clear now, thank you so much!

Offline

#4 2021-05-07 18:07:57

Daerandin
Member
From: Norway
Registered: 2013-05-07
Posts: 268
Website

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

Please remember to mark your thread as [SOLVED] by editing your first post and appending it to the title.

Offline

#5 2021-05-07 18:21:21

EgidioCaprino
Member
Registered: 2016-03-13
Posts: 104

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

I tried but the title is too long. Should I trim it?

Offline

#6 2021-05-07 18:31:25

Daerandin
Member
From: Norway
Registered: 2013-05-07
Posts: 268
Website

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

That might be a good idea, you might try to trim it down to:

"timedatectl set-ntp true" vs systemd-timesyncd

It is shorter, but still clearly states what your question was about.

Offline

#7 2021-05-07 18:57:10

EgidioCaprino
Member
Registered: 2016-03-13
Posts: 104

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

Done, thank you!

Offline

#8 2021-06-13 05:29:04

adigitoleo
Member
From: Australia
Registered: 2020-08-02
Posts: 47

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

For completeness, regarding the second part of your question:

EgidioCaprino wrote:

[...] why in the General recommendations page there is a section about Clock synchronization?

I don't know the exact technical reasons, but there are other NTP/time sync options beside systemd-timesyncd, some of which are more accurate (usually only a concern for distributed systems as far as I understand).

https://unix.stackexchange.com/a/464729

Offline

#9 2021-06-13 08:38:49

EgidioCaprino
Member
Registered: 2016-03-13
Posts: 104

Re: [SOLVED] "timedatectl set-ntp true" vs systemd-timesyncd

That makes sense. Thank you adigitoleo!

Offline

Board footer

Powered by FluxBB