NTP doesn't seem to work


Recommended Posts

7 hours ago, John_M said:

In case it helps, mine have non-zero values

Well, it doesn't help as such, but it definitely points to a difference. I think that points out that your server calculate a drift of a little over 10 PPM and will use that to adjust your clock.

My system on the other hand does, according to syslog, notice that that the clock is wrong, but the drift is calculated to 0 (zero). If it is this that that makes the system not set the clock I don't know?

I can see that ntpd is started with "-g" so ntpd should be able to do the initial clock adjustment even if if the first jump is over the sanity value (1000s?)

 

I can see that if I make changes to Unraid, [Settings], [Date and Time] the values ends up in /etc/ntp.conf. Here is my configuration:

root@treebeard:/boot/config# cat /etc/ntp.conf
# Sample /etc/ntp.conf:  Configuration file for ntpd.

#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

#
# NTP server (list one or more) to synchronize with:
#server 0.pool.ntp.org iburst
#server 1.pool.ntp.org iburst
#server 2.pool.ntp.org iburst
#server 3.pool.ntp.org iburst

#
# Full path of a directory where statistics files should be created
#
statsdir /var/lib/ntp/stats

#
# Location of an alternate log file to be used instead of the default system syslog(3) facility
#
#logfile /var/log/ntp

#
# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /var/lib/ntp/drift

#
# Location of PID file
#
pidfile /var/run/ntpd.pid

#
# Uncomment to use a multicast NTP server on the local subnet:
#multicastclient 224.0.1.1              # listen on default 224.0.1.1
# Set an optional compensation for broadcast packet delay:
#broadcastdelay 0.008

#
# Keys file.  If you want to diddle your server at run time, make a
# keys file (mode 640 owned by root:ntp) and define the key number to
# be used for making requests.
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will.
#
#keysdir        /etc
#keys           /etc/ntp.keys
#trustedkey     65535
#requestkey     65535
#controlkey     65535

#
# Don't serve time or stats to anyone else by default (more secure)
restrict default limited kod nomodify notrap nopeer noquery
restrict -6 default limited kod nomodify notrap nopeer noquery

#
# Use these lines instead if you do want to serve time and stats to
# other machines on the network:
#restrict default limited kod nomodify notrap nopeer
#restrict -6 default limited kod nomodify notrap nopeer

#
# Trust ourselves.  :-)
restrict 127.0.0.1
restrict ::1

# Generated entries follow:
interface ignore wildcard
interface listen bond0
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

 

I can see that now /var/lib/ntp/drift have disappeared again have ended up as /boot/config/drift with the same timestamp as the file created an hour after ntpd restart yesterday.

root@treebeard:/var/lib/ntp# ls -l /boot/config/drift
-rw------- 1 root root 6 May 11 10:24 /boot/config/drift
root@treebeard:/var/lib/ntp# ls -l /var/lib/ntp/
total 0

 

Don't know what to do? I can set the time manually, but I would like to know what the problem is.

 

Link to comment

Here's mine for comparison:

 

root@Mandaue:~# cat /etc/ntp.conf
# Sample /etc/ntp.conf:  Configuration file for ntpd.

#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
server	127.127.1.0	# local clock
fudge	127.127.1.0 stratum 10

#
# NTP server (list one or more) to synchronize with:
#server 0.pool.ntp.org iburst
#server 1.pool.ntp.org iburst
#server 2.pool.ntp.org iburst
#server 3.pool.ntp.org iburst

#
# Full path of a directory where statistics files should be created
#
statsdir /var/lib/ntp/stats

#
# Location of an alternate log file to be used instead of the default system syslog(3) facility
#
#logfile /var/log/ntp

#
# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /var/lib/ntp/drift

#
# Location of PID file
#
pidfile /var/run/ntpd.pid

#
# Uncomment to use a multicast NTP server on the local subnet:
#multicastclient 224.0.1.1		# listen on default 224.0.1.1
# Set an optional compensation for broadcast packet delay:
#broadcastdelay	0.008

#
# Keys file.  If you want to diddle your server at run time, make a
# keys file (mode 640 owned by root:ntp) and define the key number to
# be used for making requests.
# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will.
#
#keysdir	/etc
#keys		/etc/ntp.keys
#trustedkey	65535
#requestkey	65535
#controlkey	65535

#
# Don't serve time or stats to anyone else by default (more secure)
restrict default limited kod nomodify notrap nopeer noquery
restrict -6 default limited kod nomodify notrap nopeer noquery

#
# Use these lines instead if you do want to serve time and stats to
# other machines on the network:
#restrict default limited kod nomodify notrap nopeer
#restrict -6 default limited kod nomodify notrap nopeer

#
# Trust ourselves.  :-)
restrict 127.0.0.1
restrict ::1

# Generated entries follow:
interface ignore wildcard
interface listen br0
server 0.uk.pool.ntp.org iburst
server 1.uk.pool.ntp.org iburst
server 2.uk.pool.ntp.org iburst
server 3.uk.pool.ntp.org iburst

 

I don't notice any significant difference, but I haven't compared the line by line.

 

You could try booting from another USB stick with a temporary licence and default configuration, as I suggested earlier. Don't try to assign any disks or start the array. Just boot, set up your timezone, use the default servers and leave it for a while to see if it syncs the time. That would at least indicate if you have a configuration problem. It would only cost you a USB stick and a few hours to try it and everything would be back as it was when you boot from your original USB.

 

Link to comment
17 hours ago, John_M said:

Are you still getting the "unable to create socket" error?

Thank you for caring! No, the socket error went away when I changed NTP servers.

 

Regarding the test with a temp licens, I will try that when I have a good amount of time. I have never done anything like that befor and is a little hesitant. I'm afraid to F something up :-$

Link to comment
14 hours ago, tetrapod said:

Thank you for caring!

 

That's ok! I'm really curious as to why this isn't working. There's little to configure and it doesn't use any specific hardware. It should just work!

 

All your configuration settings are stored in the config directory on the USB flash drive. Once you shut down and unplug it they are saved until you plug it back in and boot the server. You can use a trial licence on a different USB stick to do some testing of ntp and if you don't try to assign any of your disks they will simply be ignored.

 

Link to comment
  • 3 weeks later...
On 5/15/2021 at 4:32 AM, John_M said:

 

That's ok! I'm really curious as to why this isn't working. There's little to configure and it doesn't use any specific hardware. It should just work!

 

Ok, so I'm preparing to convert my daily driver to Unriad and took the time to test the rig with NTP problems with a fresh config.

 

With the new (default 6.9.2) config NTP works just fine. Ntpd will correct a clock that is off promptly.

Going back to my old config and I'm back to the exact same problem.

 

So, the problem is not HW it seems - it's my config... 😐

treebeard-diagnostics-20210601-1047.zip

Link to comment

The only relevant file that I can see is the /boot/config/ident.cfg file. That's where the NTP configuration is stored on the USB flash device. You could try deleting (or renaming) yours and replacing it with the one from the fresh config that you know to work. Maybe the file is corrupt in some way - an illegal character, possibly.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.