Wind River Support Network

HomeDefectsLIN6-10049
Fixed

LIN6-10049 : update-rc.d script does not take start level into account

Created: Jun 19, 2015    Updated: Dec 3, 2018
Resolved Date: Sep 24, 2015
Found In Version: 6.0.0.17
Fix Version: 6.0.0.25
Severity: Standard
Applicable for: Wind River Linux 6
Component/s: Userspace

Description

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.

Workaround

A Sxx level can be specified when enabling the start script as follows:

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 60
 Adding system startup for /etc/init.d/crond.
root@qemu0:/etc/init.d# ls /etc/rc3.d/
S02dbus-1       S19nfscommon    S20nfsserver     S999rcinit
S09sshd         S20acpid        S20syslog        S99rmnologin.sh
S10networking   S20bind         S21avahi-daemon  S99stop-bootlogd
S12rpcbind      S20hwclock.sh   S58postfix       S99tcf-agent
S15mountnfs.sh  S20irqbalanced  S60crond

However, this would require the user to work out the required start level.

Steps to Reproduce

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

Other Downloads


Live chat
Online