Greetings.
The symptoms are:
ntpd never started.
owrt tried to start /usr/sbin/ntpd. Should have been /sbin/ntpd.
Strange logread output.
/etc/openwrt_release:
cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='22.03.3'
DISTRIB_REVISION='r20028-43d71ad93e'
DISTRIB_TARGET='x86/generic'
DISTRIB_ARCH='i386_pentium4'
DISTRIB_DESCRIPTION='OpenWrt 22.03.3 r20028-43d71ad93e'
DISTRIB_TAINTS='no-all busybox'
All commands are from root account.
logread | grep -E 'crash|ntp'
Sat Jan 28 23:27:00 2023 daemon.notice procd: /etc/rc.d/S98sysntpd: /lib/functions/procd.sh: line 142: shift: shift count out of range
Sat Jan 28 23:27:20 2023 daemon.info procd: Instance sysntpd::instance1 s in a crash loop 6 crashes, 0 seconds since last crash
And there is no ntpd process running.
file /etc/rc.d/S98sysntpd:
PROG=/usr/sbin/ntpd (the expected executable)
line 55: procd_open_instance is called.
This function seems to require an argument.
I tried putting $PROG as an argument and rebooted, but no changes.
file: /lib/functions/procd.sh
l55: _procd_open_instance: the shift statement balks.
This command also shows /usr/bin/ntpd as the executable:
service sysntpd info
{
"sysntpd": {
"instances": {
"instance1": {
"running": false,
"command": [
"/usr/sbin/ntpd",
"-n",
"-N",
"-S",
"/usr/sbin/ntpd-hotplug",
"-p",
"0.openwrt.pool.ntp.org",
"-p",
"1.openwrt.pool.ntp.org",
"-p",
"2.openwrt.pool.ntp.org",
"-p",
"3.openwrt.pool.ntp.org"
],
etc...
This command gives incorrect output:
service sysntpd status
running
(no it isn't)
There is no /usr/bin/ntpd:
which ntpd
/sbin/ntpd
$ ls -l /usr/sbin/ntpd
ls: /usr/sbin/ntpd: No such file or directory
So I did this:
ln -s /sbin/ntpd /usr/sbin/ntpd
$ ls -l /usr/sbin/ntpd
lrwxrwxrwx 1 root root 10 Jan 29 00:56 /usr/sbin/ntpd -> /sbin/ntpd
I rebooted and got this:
ps -ef
root 3026 1 0 00:58 ? 00:00:00 /usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p 0.openwrt.pool.ntp.org -p 1.openwrt.pool.ntp.org -p 2.openwrt.pool.ntp.org -p 3.openwrt.pool.ntp.org
So ntpd is running.
But I still got this error:
logread | egrep 'crash|ntp'
Sun Jan 29 00:58:18 2023 daemon.notice procd: /etc/rc.d/S98sysntpd: /lib/functions/procd.sh: line 142: shift: shift count out of range
But the crash error is gone, as expected.
So going back to /etc/rc.d/S98sysntpd, I again tried:
line 55: procd_open_instance (appended "$PROG")
I rebooted and the line
Sun Jan 29 00:58:18 2023 daemon.notice procd: /etc/rc.d/S98sysntpd: /lib/functions/procd.sh: line 142: shift: shift count out of range
seems to be gone.
So there might be three bugs here:
1: /etc/rc.d/S98sysntpd points to the wrong executable.
/etc/rc.d/S98sysntpd needs to check for the correct executable to prevent the issue from being misrepresented.
2: service sysntpd status give wrong output when ntpd is not running.
3: /etc/rc.d/S98sysntpd line 55: procd_open_instance may need (appended "$PROG")