Hi,
I also got the same result: no /etc/ntp.conf. I'm running OpenWrt 19.07.3 r11063-85e04e9f46 / LuCI openwrt-19.07 branch git-20.247.75781-0d0ab01.
What I noticed is that ntpd generates the ntpd.conf under /var/etc/ every time it starts parsing /etc/config/system for timeserver section for the list of ntp servers. I made some modifications to /etc/init.d/ntpd file to look like following:
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=65
STOP=65
USE_PROCD=1
PROG=/sbin/ntpd
HOTPLUG_HELPER=/usr/sbin/ntpd.hotplug-helper
config_file=/var/etc/ntpd.conf
trunc() {
echo -n "" > $config_file
}
emit() {
echo -e "$@" >> $config_file
}
validate_ntp_section() {
uci_load_validate system timeserver "$1" "$2" \
'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0' \
'interface:list(string)'
}
start_ntpd_instance() {
local intf i
[ "$2" = 0 ] || {
echo "validation failed"
return 1
}
[ "$enabled" = 0 ] && return
[ -z "$server" -a "$enable_server" = 0 ] && return
# not sure that the interfaces enumerated should be validated,
# since some of them might be dynamic interfaces (like IPsec
# tunnels) which aren't known by ubus.
mkdir -p "$(dirname "$config_file")"
trunc
emit "driftfile /var/lib/ntp/ntp.drift\n"
if [ "$enable_server" != 0 ]; then
emit "restrict default limited kod nomodify notrap nopeer"
emit "restrict -6 default limited kod nomodify notrap nopeer"
else
emit "restrict -4 default noserve"
emit "restrict -6 default noserve"
fi
emit "restrict source noquery"
emit "\n# No limits for local monitoring"
emit "restrict 127.0.0.1"
emit "restrict -6 ::1\n"
emit "\n# GPS"
emit "server 127.127.28.0 minpoll 4 prefer"
emit "fudge 127.127.28.0 refid GPS\n"
if [ -n "$interface" ]; then
local loopback=$(ubus call network.interface dump | jsonfilter -e "@.interface[@.interface='loopback']['device']")
local saw_lo=
for intf in $interface; do
emit "interface listen $intf"
[ "$intf" = "$loopback" ] && saw_lo=1
done
[ -z "$saw_lo" ] && emit "interface listen $loopback"
emit ""
fi
emit "\n# Servers or Pools found in /etc/config/system timeserver section"
for i in $server
do
emit "server $i iburst"
done
mkdir -p /var/lib/ntp
chown -R ntp:ntp /var/lib/ntp
procd_open_instance
procd_set_param command $PROG -g -u ntp:ntp -p /var/run/ntpd.pid -n \
-c $config_file
procd_close_instance
procd_open_instance
procd_set_param command $HOTPLUG_HELPER
procd_close_instance
}
start_service() {
validate_ntp_section ntp start_ntpd_instance
}
service_triggers() {
procd_add_reload_trigger "system"
procd_add_validation validate_ntp_section
}
with my changes being:
...
emit "\n# GPS"
emit "server 127.127.28.0 minpoll 4 prefer"
emit "fudge 127.127.28.0 refid GPS\n"
...
emit "\n# Servers or Pools found in /etc/config/system timeserver section"
Must make these changes every time ntpd is upgraded, till someone in the project pushes these modifications to the package.
Hope this hleps someone