openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
3.95k stars 3.46k forks source link

chrony: Config files are not updated to match UCI config #25037

Open nroach44 opened 2 days ago

nroach44 commented 2 days ago

Maintainer: @BKPepe (find it by checking history of the package Makefile) Environment: ath79, Meraki MR18, 23.05.05

Description: I've built my own image for the device, but no code changes, only to the OWRT config.

UCI doesn't seem to update the chrony config correctly, if at all:

root@OWRT-MR18:~# cat /etc/chrony/chrony.conf 
# Load UCI configuration
confdir /var/etc/chrony.d

# Load NTP servers from DHCP if enabled in UCI
sourcedir /var/run/chrony-dhcp

# Log clock errors above 0.5 seconds
logchange 0.5

# Don't log client accesses
noclientlog

# Mark the system clock as synchronized
rtcsync

# Record the clock's drift
driftfile /var/run/chrony/drift

# Save NTS keys and cookies
ntsdumpdir /var/run/chrony
root@OWRT-MR18:~# cat /var/etc/chrony.d/10-uci.conf 
pool 2.openwrt.pool.ntp.org maxpoll 12 iburst
makestep 1.0 3
nocerttimecheck 1
root@OWRT-MR18:~# cat /var/run/chrony-dhcp/lan.sources 
server <IP2> iburst
root@OWRT-MR18:~# uci export system.ntp
config timeserver 'ntp'
    list server '<IP1>'
    list server '<IP2>'
    list server '<IP3>'
    option use_dhcp '0'

As you can see here, the list of NTP servers is not reflected in the chrony config, as it only has "<IP2>", which is the IP of the server that DHCP tells clients to use.

It looks like neither the "use_dhcp" option, nor the server list is being written into the config files.

mlichvar commented 2 days ago

chrony has its own UCI configuration in /etc/config/chrony. The one in /etc/config/system is used for the minimal ntpd from busybox.

nroach44 commented 2 days ago

chrony has its own UCI configuration in /etc/config/chrony. The one in /etc/config/system is used for the minimal ntpd from busybox.

I am reading the chrony config (/etc/chrony/chrony.conf) in the above. Just to check, I checked uci export, but that only lists the package, no specific config:

uci export | grep -i chrony
package chrony
mlichvar commented 2 days ago

Try uci show chrony.