Configure ntp

Discussion in 'Yocto' started by modjo, Dec 29, 2016.

  1. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    Hi, i would like to configure ntpd for my udoo quad (yocto krogoth) but i have some issues ...
    First, i have added ntpd in my local.conf, all build fine.
    Then, on the card try to configure it, under my ntp.conf
    Code:
    server 0.fr.pool.ntp.org
    server 1.fr.pool.ntp.org
    server 2.fr.pool.ntp.org
    server 3.fr.pool.ntp.org
    
    relaunch ntpd but the date didn't update ?

    an exemple of ntpd -date :
    Code:
    root@udooqdl:~# ntpd -date
    28 Dec 16:43:08 ntpd[521]: ntpd 4.2.8p8@1.3265 Fri Nov 25 14:27:27 UTC 2016 (2): Starting
    28 Dec 16:43:08 ntpd[521]: Command line: ntpd -date
    28 Dec 16:43:08 ntpd[521]: proto: precision = 3.000 usec (-18)
    28 Dec 16:43:08 ntpd[521]: command line trusted key e is invalid
    Finished Parsing!!
    move_fd: estimated max descriptors: 1024, initial socket boundary: 16
    28 Dec 16:43:08 ntpd[521]: Listen and drop on 0 v6wildcard [::]:123
    28 Dec 16:43:08 ntpd[521]: Listen and drop on 1 v4wildcard 0.0.0.0:123
    28 Dec 16:43:08 ntpd[521]: Listen normally on 2 lo 127.0.0.1:123
    restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00003000 flags 00000001
    28 Dec 16:43:08 ntpd[521]: Listen normally on 3 eth0 192.168.1.38:123
    restrict: op 1 addr 192.168.1.38 mask 255.255.255.255 mflags 00003000 flags 00000001
    28 Dec 16:43:08 ntpd[521]: Listen normally on 4 wlan0 192.168.1.31:123
    restrict: op 1 addr 192.168.1.31 mask 255.255.255.255 mflags 00003000 flags 00000001
    28 Dec 16:43:08 ntpd[521]: Listen normally on 5 lo [::1]:123
    restrict: op 1 addr ::1 mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff mflags 00003000 flags 00000001
    28 Dec 16:43:08 ntpd[521]: Listen normally on 6 eth0 [fe80::2c0:8ff:fe88:27f8%2]:123
    restrict: op 1 addr fe80::2c0:8ff:fe88:27f8%2 mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff mflags 00003000 flags 00000001
    28 Dec 16:43:08 ntpd[521]: Listen normally on 7 wlan0 [fe80::7edd:90ff:fe90:cec9%3]:123
    restrict: op 1 addr fe80::7edd:90ff:fe90:cec9%3 mask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff mflags 00003000 flags 00000001
    28 Dec 16:43:08 ntpd[521]: Listening on routing socket on fd #24 for interface updates
    event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled
    event at 0 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
    event at 0 0.0.0.0 c011 01 freq_not_set
    event at 0 0.0.0.0 c016 06 restart
    sleep until 16:43:10 scheduled at 16:43:08 (>= 00:00:00)
    sleep until 16:43:14 scheduled at 16:43:10 (>= 00:00:00)
    sleep until 16:43:22 scheduled at 16:43:14 (>= 00:00:00)
    
    Normaly the date would be thursday 29 december 14:00:06

    An idea ?
     
  2. graugans

    graugans Administrator Staff Member

    Joined:
    Sep 17, 2015
    Messages:
    328
    Likes Received:
    141
  3. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    Thanks, but it didn't help me.
    @cyrilf , i cry that you already configure ntpd, can you say me how you did it please ?
     
  4. cyrilf

    cyrilf Active Member

    Joined:
    Feb 19, 2015
    Messages:
    168
    Likes Received:
    47
    I simply added a *.bbappend file to specify the ntp.conf file I want to use.

    receipes-support/ntp/:
    • files/ntp.conf
    • ntp_%.bbappend
    ntp_%.bbappend
    Code:
    FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
    
    # Add Red Hat NTP servers to synchronize the UDOO local date
    SRC_URI += "file://ntp.conf"
    
    do_install_append() {
       install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir}
    }
    ntp.conf
    Code:
    # This is the most basic ntp configuration file
    # The driftfile must remain in a place specific to this
    # machine - it records the machine specific clock error
    driftfile /var/lib/ntp/drift
    # This should be a server that is close (in IP terms)
    # to the machine.  Add other servers as required.
    # Unless you un-comment the line below ntpd will sync
    # only against the local system clock.
    #
    # server time.server.example.com
    #
    # Using local hardware clock as fallback
    # Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself
    server 127.127.1.0
    # Red Hat time servers
    server 0.rhel.pool.ntp.org iburst
    server 1.rhel.pool.ntp.org iburst
    server 2.rhel.pool.ntp.org iburst
    server 3.rhel.pool.ntp.org iburst
    fudge 127.127.1.0 stratum 14
    # Defining a default security setting
    restrict default kod nomodify notrap nopeer noquery
    restrict -6 default kod nomodify notrap nopeer noquery
    restrict 127.0.0.1
    restrict -6 ::1
     
    modjo likes this.
  5. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    I will make a try and let you know.
     
    cyrilf likes this.
  6. modjo

    modjo Active Member

    Joined:
    Sep 29, 2014
    Messages:
    417
    Likes Received:
    127
    it take a time but after adding your config ntp works :)
    edit : i just add it at
    at the top of the file to ignore the panic threshold.
     
    Last edited: May 11, 2017
    graugans likes this.

Share This Page