Bug 237097

Summary: chkconfig misbehaves with LSB style INIT INFO blocks
Product: Red Hat Enterprise Linux 4 Reporter: Bryn M. Reeves <bmr>
Component: chkconfigAssignee: Bill Nottingham <notting>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-19 17:19:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
trace of chkconfig on fc6
none
trace of chkconfig on rhel4 none

Description Bryn M. Reeves 2007-04-19 12:58:18 UTC
Description of problem:
LSB defines INIT INFO blocks as an alternate way of specifying dependencies
between services. For example:

# AFS   Start and stop AFS components
#
#
# chkconfig: 35 60 20
# description:  AFS is a distributed file system which provides location
#               transparency, caching and secure authentication.
#               Additional configuration can be done in the /etc/sysconfig/afs
#               file. Read the documentation in that file for more information.
#
# The following section is used at least by SuSE insserv(8)
### BEGIN INIT INFO
# Provides: afs
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description:  AFS is a distributed file system which provides location
#              transparency, caching and secure authentication.
#              Additional configuration can be done in the /etc/sysconfig/afs
#              file. Read the documentation in that file for more information.
### END INIT INFO

Without the LSB block, you would expect the "# chkconfig: 35 60 20" line to link
the scripts like this:

$ ls -l rc?.d/*afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc0.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc1.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc2.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc3.d/S60afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc4.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc5.d/S60afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc6.d/K20afs -> ../init.d/afs

When adding this service using RHEL4's chkconfig and the LSB INIT INFO block you
get this:

$ ls -l rc?.d/*afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc0.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc1.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc2.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc3.d/S99afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc4.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc5.d/S99afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc6.d/K01afs -> ../init.d/afs

This is not reproducible on FC6 with chkconfig-1.3.30-1. Strangely, rebuilding
this version of chkconfig on RHEL4 still has the problem so I'm assuming that
something has changed in the environment that is affecting chkconfig's
operation. chkconfig only really depends on libc:

$ ldd /sbin/chkconfig 
        linux-gate.so.1 =>  (0x005ea000)
        libc.so.6 => /lib/i686/nosegneg/libc.so.6 (0x41000000)
        /lib/ld-linux.so.2 (0x461a8000)

So my first thought was a locale/sort/collate change, but running in the C
locale didn't change things.


Version-Release number of selected component (if applicable):
chkconfig-1.3.13.4-1
chkconfig-1.3.30-1

How reproducible:
100%

Steps to Reproduce:
1. add an initscript with LSB INIT INFO block using chkconfig:
# chkconfig --add <script>
2. examine symlink start/stop orders:
$ ls /etc/rc.d/rc?.d/*<script>

  
Actual results:
K/S numbers are wrong, for e.g. the afs script gives K01/S99 and the ipmi script
from OpenIPMI gives K87 (it's off by default):

 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc0.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc1.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc2.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc3.d/S99afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc4.d/K01afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc5.d/S99afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 20 11:54 rc6.d/K01afs -> ../init.d/afs


Expected results:

Start/stop ordering obeys either the chkconfig line or the LSB INIT INFO block.

For AFS:

 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc0.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc1.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc2.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc3.d/S60afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc4.d/K20afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc5.d/S60afs -> ../init.d/afs
 lrwxrwxrwx  1 root root 13 Feb 13 18:57 rc6.d/K20afs -> ../init.d/afs

Additional info:

A lot of 3rd party initscripts seem to be including the INIT INFO block now;
mysql, hp's monitoring services, OpenIPMIetc.

Comment 1 Bryn M. Reeves 2007-04-19 13:05:43 UTC
Adding some very simple tracing to chkconfig produces very different results on
FC6 and RHEL4 for the same chkconfig version. For e.g. adding a printf on entry
to these functions:

addService
frobDependencies
frobOneDependencies
delServiceOne

Yields a quite different looking trace on the two versions of the distro with
chkconfig-1.3.30-1.

Attaching these as chkconfig-rhel4.trace and chkconfig-fc6.trace.


Comment 2 Bryn M. Reeves 2007-04-19 13:06:29 UTC
Created attachment 153001 [details]
trace of chkconfig on fc6

Comment 3 Bryn M. Reeves 2007-04-19 13:07:07 UTC
Created attachment 153002 [details]
trace of chkconfig on rhel4

Comment 4 Bill Nottingham 2007-04-19 17:03:59 UTC
Do you have NetworkManager installed?

Comment 5 Bryn M. Reeves 2007-04-19 17:16:34 UTC
Yes on both the fc6 and RHEL4 machines I've tested with. Will check with the
original reporter for their configuration.


Comment 6 Bryn M. Reeves 2007-04-19 17:18:08 UTC
Removing network manager gives the expected behavior with afs' initscript on my
RHEL4 test box.

Comment 7 Bill Nottingham 2007-04-19 17:19:19 UTC
NM in RHEL 4 provides $network, chkconfig is honoring that.

*** This bug has been marked as a duplicate of 166716 ***

*** This bug has been marked as a duplicate of 166716 ***