Systemctl TimeDateCtl replacement for NTP daemon

  • Still with the latest OMV 3.x images, I find that the clock source synchronisation is still being accomplished with the NTP daemon rather then with the "timedated" daemon.


    Below describes the steps to remove the setup of the legacy NTP configuration, and setup the new light weight “system-timedated” configuration to synchronise your system’s clock from the network source.


    First shutdown the NTP daemon process(es), disable the auto-start setup and deinstall the packages with the following commands on the shell prompt:


    sudo systemctl stop ntp
    sudo systemctl disable ntp
    sudo apt-get -y remove ntp
    sudo rm -f /etc/init.d/ntp
    sudo rm -f /etc/default/ntp
    sudo rm -f /etc/rc?.d/{S,K}??ntp
    sudo rm -f /etc/ntp.conf
    sudo rm -f /etc/cron.daily/ntp
    sudo rm -f /var/log/ntpstats


    With your favourite text editor, modify the file “/etc/systemd/timesyncd.conf” to have the similar contents as follows:


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


    You may choose the NTP sources according to your region as described with the NTP Sources article.


    With your favourite text editor, modify the file “/etc/rc.local” to include the followoing line contents:


    [ ! -e /var/lib/systemd/clock -a "`systemctl is-active systemd-timesyncd | grep -i active`" ] && timedatectl set-ntp 1 > /dev/null 2>&1
    sleep 2


    Note: The back-quote in the "systemctl" command and the "sleep" statement are very important to keep!


    Now, to enable the automatic start-up of the system’s clock synchronisation during boot-up using the "systemd-timesyncd" service, execute the following commands on the shell prompt:


    sudo systemctl enable systemd-timesyncd
    sudo systemctl start systemd-timesyncd
    sudo timedatectl set-ntp 1


    With this approach, we leave it up to the “systemd” PID 1 daemon to start up the relevant services for date and time synchronisation from the network during boot up.


    To verify its proper operation, after a little while, simply execute the following command on the shell prompt:


    timedatectl


    It shall provide an output similar to the following:


    Local time: Wed 2017-03-18 09:44:46 CET
    Universal time: Wed 2017-03-18 08:44:46 UTC
    RTC time: Wed 2017-03-18 08:44:46
    Time zone: … (CET, +0100)
    Network time on: yes
    NTP synchronized: yes
    RTC in local TZ: no


    Hope, you find this useful and above can be incorporated in the next OMV 3.0 image update...

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!