Page MenuHomeVyOS Platform

NTP wasn't running, nor conigured in 1.2.0-beta1
Closed, ResolvedPublic


I was having some ipsec issues so i first suspected that the time may have been off.

To my surprise ntp.conf had no servers configured nor was ntpd running. But I had 3 servers in the VyOS config. I deleted and re-added the servers and then everything was as to be expected. Nothing unusual, maybe even the factory default:

del system ntp server ''
del system ntp server ''
del system ntp server ''
set system ntp server ''
set system ntp server ''
set system ntp server ''


Difficulty level
Normal (likely a few hours)

Event Timeline

gadams added a subscriber: gadams.

This hack does work, but it only lasts until you reboot VyOS. When the OS comes back up, you'll need to do this again.

I have just verified that this behavior persists in the latest dev build (from the current branch), 999.201609230235.

I tried adding this to /config/scripts/vyatta-postconfig-bootup.script:

# Run ntpd; see
/usr/sbin/ntpd -p /var/run/ -g -u 105:112

But that doesn't quite do the trick. It does start up ntpd, but VyOS doesn't know about it.

When ntpd starts, it seems to see the previous version of /etc/ntp.conf, but then the VyOS config system overwrites /etc/ntp.conf with an essentially empty version. That means that the next time you restart ntpd or VyOS, ntpd will get the empty ntp.conf, and not work. Worse, the make-trivial-changes-to-system ntp server trick no longer has any effect.

So this is not a viable workaround.

I've written a handy script to start ntpd manually:

source /opt/vyatta/etc/functions/script-template


/usr/sbin/invoke-rc.d ntp start

However, if I arrange for this script to be invoked at startup via /config/scripts/vyatta-postconfig-bootup.script, it doesn't work. (It creates an /etc/ntp.conf that contains just the contents of vyatta-cfg-system/sysconf/ntp.conf plus the line # Servers, and so ntp doesn't start up.) But worse, I am unable to enter configuration mode from an ssh login at that point:

gadams@core-rt:~$ configure
Failed to set up config session

My router is apparently hosed. Removing it from vyatta-postconfig-bootup.script and rebooting cured that.

However, if I log in and execute that script via sudo immediately after startup, ntp will start up fine, with correct servers listed in /etc/ntp.conf.

So, what is it about the conditions at startup that cause /etc/ntp.conf to be improperly written?

Can you test if this happens with SNMP in this particular 1.2.0-beta1 build as well, and maybe in the preview images? I may have just had it happen after rebooting an instance...


Hmm. Things are afoot.

I've been playing with the latest lithium (dev) build (999.201609230235), and now ntpd does start on boot. And the /etc/ntpd.conf file has the contents I'd expect. However, it is not able to make any connections to any remote servers.

$ ntpq -c peers
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================  .INIT.          16 -    -  512    0    0.000    0.000   0.000  .INIT.          16 -    -  512    0    0.000    0.000   0.000
 orchid.sidereal .INIT.          16 -    -  512    0    0.000    0.000   0.000
 eterna.binary.n .INIT.          16 -    -  512    0    0.000    0.000   0.000
*     2 u   24   64  377    0.162  -16.298   5.504

This seems to have something to do with the state of routing on startup; when ntpd starts, no network interfaces are up. Later, ntpd is able to connect only to a directly-attached ntp server (olaf, above). That's suspicious.

Issuing the command systemctl restart ntp after that fixes it:

$ ntpq -c peers
     remote           refid      st t when poll reach   delay   offset  jitter
*    2 u   11   64  177   17.632   19.562  43.529
+   2 u   10   64  177   76.361   -8.272  31.822
+orchid.sidereal   2 u    9   64  177   84.956   17.080  39.592
+eterna.binary.n     3 u    8   64  177   70.008   21.231  14.337     2 u    9   64  177    0.141   -7.596  22.159
syncer triaged this task as Normal priority.
syncer changed the edit policy from "Task Author" to "Custom Policy".
syncer changed Difficulty level from Easy (less than an hour) to Normal (likely a few hours).
syncer set Version to -.
syncer added subscribers: UnicronNL, syncer.

@UnicronNL do you think we can set ntp to start after network?

dmbaturin added a subscriber: dmbaturin.

I did test NTP in 1.2.0 and it works now.