Fixed
Created: Sep 24, 2015
Updated: Sep 8, 2018
Resolved Date: Oct 18, 2015
Found In Version: 7.0
Fix Version: 7.0.0.10
Severity: Standard
Applicable for: Wind River Linux 7
Component/s: Userspace
Service start scripts have a standard (LSB) header of the following form:
### BEGIN INIT INFO
# Provides: my_daemon
# Required-Start: postgresql networking
# Required-Stop: postgresql networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This is a test daemon
# Description: This is a test daemon
# This provides example about how to
# write a Init script.
### END INIT INFO
update-rc.d seems to ignore this information and sets all scripts to start at S20. It should adjust the Sxx number to account for prerequisites specified in the Required-Start line.
Possibly other lines are being ignored too, so update-rc.d is not conforming to the LSB.
Create and start a standard project.
Using crond as an example, by default after installation it has a symlink in /etc/rc3.d called S90crond.
If we disable and re-enable crond we find it changes to S20crond:
root@qemu0:/etc/init.d# update-rc.d -f crond remove
update-rc.d: /etc/init.d/crond exists during rc.d purge (continuing)
Removing any system startup links for crond ...
/etc/rc0.d/K90crond
/etc/rc1.d/K90crond
/etc/rc2.d/S90crond
/etc/rc3.d/S90crond
/etc/rc4.d/S90crond
/etc/rc5.d/S90crond
/etc/rc6.d/K90crond
root@qemu0:/etc/init.d# update-rc.d -f crond defaults
Adding system startup for /etc/init.d/crond.
root@qemu0:/etc/init.d# ls /etc/rc3.d/
S02dbus-1 S19nfscommon S20irqbalanced S999rcinit
S09sshd S20acpid S20nfsserver S99rmnologin.sh
S10networking S20bind S20syslog S99stop-bootlogd
S12rpcbind S20crond S21avahi-daemon S99tcf-agent
S15mountnfs.sh S20hwclock.sh S58postfix
If we edit the header of crond to require it to start after postfix (which is at S58) by changing the header to the following:
#!/bin/sh
### BEGIN INIT INFO
# Provides: crond crontab
# Required-Start: postfix
# Default-Start: 2345
# Default-Stop: 016
...
then repeat the above steps we would expect crond to have a link of S59 to ensure it starts after postfix, but this does not occur:
root@qemu0:/etc/init.d# update-rc.d -f crond remove
update-rc.d: /etc/init.d/crond exists during rc.d purge (continuing)
Removing any system startup links for crond ...
/etc/rc0.d/K20crond
/etc/rc1.d/K20crond
/etc/rc2.d/S20crond
/etc/rc3.d/S20crond
/etc/rc4.d/S20crond
/etc/rc5.d/S20crond
/etc/rc6.d/K20crond
root@qemu0:/etc/init.d# update-rc.d -f crond defaults
Adding system startup for /etc/init.d/crond.
root@qemu0:/etc/init.d# ls /etc/rc3.d/
S02dbus-1 S19nfscommon S20irqbalanced S999rcinit
S09sshd S20acpid S20nfsserver S99rmnologin.sh
S10networking S20bind S20syslog S99stop-bootlogd
S12rpcbind S20crond S21avahi-daemon S99tcf-agent
S15mountnfs.sh S20hwclock.sh S58postfix
We see crond is still S20