Tag Archives: ntp

Too good to #0005

Prioritizing own NTP servers for systemd-timesyncd

# cat /etc/systemd/timesyncd.conf.d/timesyncd-corporate.conf 
[Time]
NTP=ntp1.example.com ntp2.example.com ntp.ubuntu.com

Test if text is empty (even if it does contain a linebreak)

Good job by: https://unix.stackexchange.com/q/386499/2028

if ! grep -q '[^[:space:]]' "${file}"; then echo "Text is empty"; fi

Watch for changes in the Gnome registry

(To reproduce manual changes, for configuration management.)

dconf watch / # (Sorry, thats all)

Trigger Debian/Ubuntu unattended-upgrade

(For testing configuration changes)

rm /var/lib/apt/periodic/*
systemctl start apt-daily.service 
systemctl start apt-daily-upgrade.service 

And remember:

tail -f /var/log/unattended-upgrades/*log

Aggressive NTP configuration on Windows 10

Screenshot of time.is in Esperanto

While clicking around on time.is, which has a nice Esperanto translation that you may want to to check out, I kept running into large-ish time offsets of at least several tenths of a second on a Windows 10 machine.

As a Linux guy, my first instinct was to replace the interval-based synchronization option in Windows with an NTP daemon, and so I found Meinberg’s ntpd distribution for Windows. While this ntpd would start flawlessly, over the course of every day it ran into some impossible to debug condition where NTP time reached a significant offset from the system clock again and unlike at startup, the daemon wouldn’t adjust the system clock anymore.

So I turned back to Windows’ built-in time synchronization. Indeed, the people at Meinberg also have helpful advice for it and suggest a few defaults to keep the system clock closely tied to an NTP reference clock. So here’s an attempt at configuring a clean NTP setup on Windows 10.

First of all, the timekeeping service needs to be stopped and fortunately Windows 10 provides the ability to start over with a fresh timekeeping configuration (all following actions must be applied using an administrator role):

net stop w32time
w32tm /unregister
w32tm /register

At this point, the defaults as suggested by Meinberg can be added to the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
"FrequencyCorrectRate"=dword:00000002
"MaxPollInterval"=dword:00000006
"MinPollInterval"=dword:00000006
"UpdateInterval"=dword:00000064

Finally, a restart of the timekeeping service and configuration of the NTP reference clocks:

net start w32time
sc config w32time start=auto
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org" /update

NTP synchronization status can be queried using the w32tm command again:

w32tm /query /peers
w32tm /query /status /verbose

In my highly scientific observation of the system, I haven’t seen any clock offsets ever since.

Further reading: “Windows Time Service Tools and Settings” by Microsoft.