2

I am on a dual boot laptop running Ubuntu 17.04 and Windows 7. Booting into windows sets RTC to local time, breaking the system clock in ubuntu.

I do not want to change the RTC configuration on ubuntu or windows; I want ubuntu to sync time to the network as soon as there is a network connection. This used to be done with ntpdate (which is now deprecated) and as far as I can see, the current configuration for ubuntu systems uses systemd-timesyncd. This is not working, and so far I have been unable to force timesyncd to sync time.

/etc/systemd/timesyncd.conf is set to use pool.ntp.org:

[Time]                                                                                                                                                                                                                                      
NTP=0.pool.ntp.org                                                                                                                                                                                                                          
FallbackNTP=1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org 

However, systemd status shows that timesyncd is not capable of connecting to pool.ntp.org:

● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Mon 2017-08-07 10:13:38 PDT; 1min 44s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 986 (systemd-timesyn)
   Status: "Idle."
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/systemd-timesyncd.service
           └─986 /lib/systemd/systemd-timesyncd

Aug 07 10:13:37 rachael systemd[1]: Starting Network Time Synchronization...
Aug 07 10:13:38 rachael systemd[1]: Started Network Time Synchronization.
Aug 07 10:14:48 rachael systemd-timesyncd[986]: Timed out waiting for reply from 204.2.134.163:123 (0.pool.ntp.org).
Aug 07 10:14:59 rachael systemd-timesyncd[986]: Timed out waiting for reply from 91.224.149.41:123 (0.pool.ntp.org).
Aug 07 10:15:09 rachael systemd-timesyncd[986]: Timed out waiting for reply from 103.242.70.5:123 (0.pool.ntp.org).
Aug 07 10:15:19 rachael systemd-timesyncd[986]: Timed out waiting for reply from 178.62.16.103:123 (0.pool.ntp.org).

This is probably due to the fact that timesyncd depends on networkd, but since ubuntu uses network-manager to handle its connections, networkd is disabled:

● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-networkd.service(8)

Incidentally, timedated is also disabled (no idea if this is relevant):

● systemd-timedated.service - Time & Date Service
   Loaded: loaded (/lib/systemd/system/systemd-timedated.service; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-timedated.service(8)
           man:localtime(5)
           http://www.freedesktop.org/wiki/Software/systemd/timedated

Consequently, timedatectl lists ntp sync as disabled, independent of the content of the config file:

      Local time: Mon 2017-08-07 10:27:48 PDT                                                                                                                                                                                               
  Universal time: Mon 2017-08-07 17:27:48 UTC                                                                                                                                                                                               
        RTC time: Mon 2017-08-07 17:27:48                                                                                                                                                                                                   
       Time zone: America/Los_Angeles (PDT, -0700)                                                                                                                                                                                          
 Network time on: yes                                                                                                                                                                                                                       
NTP synchronized: no                                                                                                                                                                                                                        
 RTC in local TZ: no   

Trying to enable ntp sync on timesyncd by hand has no effect. i.e.:

# timedatectl set-ntp true

does nothing.

How is network time synchronization supposed to work in newer ubuntu systems?

closed as unclear what you're asking by Panther, Ravexina, waltinator, Zanna, Eric Carvalho Aug 8 '17 at 23:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • related: askubuntu.com/questions/943920/… – WinEunuuchs2Unix Aug 7 '17 at 18:43
  • @WinEunuuchs2Unix, yup, I am aware that you can tell windows to treat RTC as UTC time with [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] “RealTimeIsUniversal”=dword:00000001 but I do not want to mess with RTC in either windows or linux; I want to get network time sync to work :) – jtatria Aug 7 '17 at 18:47
  • Oh so you have to manually edit the Windows registry? I always hated doing that. – WinEunuuchs2Unix Aug 7 '17 at 18:49
  • timedatectl is the tool. Cant tell what you are asking exactly. If you want ntp use a different ntp server. – Panther Aug 7 '17 at 18:56
  • 1
    linoxide.com/ubuntu-how-to/… – Panther Aug 7 '17 at 19:04