Bug 1468036 - "chkconfig $service on" and "chkconfig --override $service" inconsistency when there are override files
"chkconfig $service on" and "chkconfig --override $service" inconsistency whe...
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: chkconfig (Show other bugs)
6.9
All Linux
unspecified Severity medium
: rc
: ---
Assigned To: Lukáš Nykrýn
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-05 16:03 EDT by Paulo Andrade
Modified: 2017-08-16 13:01 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-16 13:01:14 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Paulo Andrade 2017-07-05 16:03:43 EDT
Steps to reproduce:

# cat /etc/init.d/nxserver
# chkconfig: - 99 01
# description: Starts and stops the NoMachine NX Server.
#
### BEGIN INIT INFO
# Provides:       nxserver
# Required-Start: $local_fs $remote_fs
# Should-Start: $network sshd
# Required-Stop:  $local_fs $remote_fs
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    Starts and stops the NoMachine NX Server.
### END INIT INFO

# cat /etc/chkconfig.d/nxserver
# chkconfig: 35 88 01
# description: Starts and stops the NoMachine NX Server.
# 

# chkconfig nxserver on
# find /etc/rc*.d/*nx*
/etc/rc0.d/K01nxserver
/etc/rc1.d/K01nxserver
/etc/rc2.d/S88nxserver
/etc/rc3.d/S88nxserver
/etc/rc4.d/S88nxserver
/etc/rc5.d/S88nxserver
/etc/rc6.d/K01nxserver

# chkconfig nxserver off
# find /etc/rc*.d/*nx*
/etc/rc0.d/K01nxserver
/etc/rc1.d/K01nxserver
/etc/rc2.d/K01nxserver
/etc/rc3.d/K01nxserver
/etc/rc4.d/K01nxserver
/etc/rc5.d/K01nxserver
/etc/rc6.d/K01nxserver

# chkconfig nxserver on
# find /etc/rc*.d/*nx*
/etc/rc0.d/K01nxserver
/etc/rc1.d/K01nxserver
/etc/rc2.d/S88nxserver
/etc/rc3.d/S88nxserver
/etc/rc4.d/S88nxserver
/etc/rc5.d/S88nxserver
/etc/rc6.d/K01nxserver

# chkconfig nxserver reset
# find /etc/rc*.d/*nx*
/etc/rc0.d/K01nxserver
/etc/rc1.d/K01nxserver
/etc/rc2.d/K01nxserver
/etc/rc3.d/S88nxserver
/etc/rc4.d/K01nxserver
/etc/rc5.d/S88nxserver
/etc/rc6.d/K01nxserver

  It is required to run "chkconfig nxserver reset" to actually use the
overrides. The overrides will only work if:

1. run: chkconfig nxserver off
2. remove /etc/chkconfig.d/nxserver
3. run: chkconfig nxserver on
4. add back /etc/chkconfig.d/nxserver
5. run chkconfig --override nxserver

  First inconsistency is that if one runs "chkconfig nxserver on" with
the override file installed, it will change the priority but not properly
update the run levels, then, if running with --overrride it will fail
due to the checks in the comment:

    /* Apply overrides only if the service has not been changed since
     * being added, and not if the service has never been configured
     * at all.
     */

on a simple test build, with this pseudo patch in overrideService:overrideService()

-    if (configured && doChange) {
+    if (1/*configured && doChange*/) {

executing "chkconfig --override nxserver" works as if "chkconfig nxserver reset"
had been run.

  But, the main issue is that unless one runs the above as:

# chkconfig --level 35 nxserver on

it will just use default values for levels, instead of reading from the
file and/or overrides.

  The problem is that the "reset" option and --override logics are
disjoint. *If* there is an override file, to give the expected results,
setService() should receive a -1 value for state.

Note You need to log in before you can comment on or make changes to this bug.