3

I am currently using Arch Linux as my OS on my desktop. When I look at my time, it is 22:38, when the time clearly is around 17:08. When I invoke the command timedatectl, I get:

Local time: Wed 2017-01-11 22:37:43 IST
Universal time: Wed 2017-01-11 17:07:43 UTC
    RTC time: Wed 2017-01-11 17:07:41
    Time zone: Asia/Kolkata (IST, +0530)
Network time on: yes
NTP synchronized: no
RTC in local TZ: no

Update

When I run sudo systemctl status systemd-timesyncd, I get:

● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2017-01-11 00:49:36 IST; 1 day 1h ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 31123 (systemd-timesyn)
   Status: "Idle."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/systemd-timesyncd.service
           └─31123 /usr/lib/systemd/systemd-timesyncd

Jan 12 01:39:42 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 5.9.78.71:123 (1.arch.pool.ntp.org).
Jan 12 01:39:53 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 192.53.103.108:123 (1.arch.pool.ntp.org).
Jan 12 01:40:03 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 139.59.19.184:123 (2.arch.pool.ntp.org).
Jan 12 01:40:13 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 139.59.45.40:123 (2.arch.pool.ntp.org).
Jan 12 01:40:24 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 123.108.200.124:123 (2.arch.pool.ntp.org).
Jan 12 01:40:34 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 125.62.193.121:123 (2.arch.pool.ntp.org).
Jan 12 01:40:44 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 139.59.45.40:123 (3.arch.pool.ntp.org).
Jan 12 01:40:55 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 123.108.200.124:123 (3.arch.pool.ntp.org).
Jan 12 01:41:05 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 139.59.19.184:123 (3.arch.pool.ntp.org).
Jan 12 01:41:15 sharan-pc systemd-timesyncd[31123]: Timed out waiting for reply from 125.62.193.121:123 (3.arch.pool.ntp.org).

traceroute

I also tried the command traceroute -U -p ntp pool.ntp.org, and I get:

traceroute to pool.ntp.org (139.59.19.184), 30 hops max, 60 byte packets
 1  10.114.1.1 (10.114.1.1)  1.713 ms  2.020 ms  2.343 ms
 2  10.10.2.41 (10.10.2.41)  1.123 ms  2.580 ms  2.836 ms
 3  cyberoam.iisc.ac.in (10.10.1.98)  0.553 ms  0.806 ms  0.813 ms
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

How do I fix this? I've even tried timedatectl set-ntp true. Am I supposed to reboot for this to take effect?

  • good work. Google says cyberoam is a brand of (web-filtering?) firewall. It is not uncommon for your university to use an internal NTP server for their own computers, and it's quite possible you have access to those. (Apparently Windows PCs using Active Directory will use the domain controller as an NTP server). University of York had a very similar setup IIRC. I can't find any documentation about your IT on the IISC website unfortunately. – sourcejedi Jan 11 '17 at 15:31
  • 1
    It looks like SERC handle your campus IT. They have some Linux instructions although nothing about NTP, maybe you can get directed to someone who will help? nitss.iisc.ac.in and serc.iisc.in/facilities/support – sourcejedi Jan 11 '17 at 15:44
  • @sourcejedi Thanks so much, you've gone above and beyond what is needed for an SE answer. – Sharan Duggirala Jan 11 '17 at 17:29
  • Related bug report on systemd's GitHub: Can't sync time when time is incorrect due to dnssec – Marc.2377 Apr 18 at 3:19
3

systemd-timesyncd will not require you to reboot. I've tested timedatectl on my system. It might be necessary to wait a minute for a connection.

man timedatectl

status

Show current settings of the system clock and RTC, including whether network time synchronization is on. Note that whether network time synchronization is on simply reflects whether the systemd-timesyncd.service unit is enabled. Even if this command shows the status as off, a different service might still synchronize the clock with the network.

$ timedatectl status
      Local time: Wed 2017-01-11 13:45:07 GMT
  Universal time: Wed 2017-01-11 13:45:07 UTC
        RTC time: Wed 2017-01-11 13:45:07
       Time zone: Europe/London (GMT, +0000)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: yes

timedatectl manpage is lying on my system. Possibly the implementation was patched by Fedora, without patching the manpage. I do not know how to query which service is used; my system happens to use chronyd. I imagine it might also be possible to use ntp/ntpd.

However in your case I would be quite confident that Arch uses the upstream default of timesyncd.

$ systemctl status systemd-timesyncd
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; disabled; 
   Active: inactive (dead)
     Docs: man:systemd-timesyncd.service(8)

$ systemctl status chronyd
● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor pres
   Active: active (running) since Mon 2017-01-09 19:09:39 GMT; 1 day 18h ago
 Main PID: 928 (chronyd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/chronyd.service
           └─928 /usr/sbin/chronyd

You might have errors logged underneath the status. Make sure to run systemctl as a user with access to the system journal, e.g. using sudo.

Unlike chronyd with chronyc, there is no documented way to additionally query systemd-timesyncd for... anything really, beyond "NTP synchronized: no". Hope it has useful logs!

I suggest aiming to

  1. Identify which well-known pool.ntp.org alias your system is trying to use.
  2. Test the alias e.g. ntpdate -q arch.pool.ntp.org.
  3. traceroute to the alias to see if there is a nearby block i.e. a firewall preventing access. As always, I would use ping first because it gets results quicker (and is less prone to mis-interpretation), or use the mtr version of traceroute (this also defaults to ICMP traceroute, which avoids lots of output from multi-path networks). Ultimately you want something like traceroute -U -p ntp pool.ntp.org, i.e. using the same UDP port as NTP does.

EDIT: previous versions of this answer were confused about systemd-timesyncd's default NTP servers. Although they are commented out (disabled) in timesyncd.conf, it should only be necessary to uncomment the line if you need to change the server. The default values are built in to timesyncd at compile time. This is mentioned in all documentation.

https://www.cyberciti.biz/faq/linux-unix-bsd-is-ntp-client-working/

https://wiki.archlinux.org/index.php/Systemd-timesyncd

  • Take a look above. I have queried sudo systemctl status systemd-timesyncd and it seems like I have some timed-out logs. Do I have to traceroute now? – Sharan Duggirala Jan 11 '17 at 15:08
  • just used traceroute and got a few results. How can I use traceroute with ping? – Sharan Duggirala Jan 11 '17 at 15:13
  • On my fresh install of Archlinux systemd-timesyncd.service was not running. I started and enabled it and now the time on my machine is correct. – Waseem Jul 3 '18 at 11:52
-1

Did time zone is correct for your location? And you should set the correct time zone via timedatectl set-timezone

The date command is showing system time, for your current location.

ntpdate will correct time for your time zone.

for example use apple ntp server will result:

sudo ntpdate time.apple.com

11 Jan 19:18:28 ntpdate[1052]: adjust time server 17.253.38.125 offset 0.004981 sec
  • 1
    timezone will not fix "NTP synchronized: no" – sourcejedi Jan 11 '17 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.