update-rc.d always throws a warning when "enable" or "disable" is used

Bug #1365007 reported by Paul Smith on 2014-09-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sysvinit (Ubuntu)

Bug Description

After a lot of puzzling and confusion I've discovered that update-rc.d has a bug in it, in Ubuntu (I've checked the Debian sid version of this script and the bug doesn't exist there).

If you run "update-rc.d <svc> enable" or "update-rc.d <svc> disable" for any service (with or without extra runlevel arguments) it will always, if the sysvinit control script in /etc/init.d/<svc> DOES contain correct LSB init info settings, throw this warning:

update-rc.d: warning: start runlevel arguments (none) do not match <svc> Default-Start values (2 3 4 5)

I thought there was something wrong with my init scripts, but it happens for all of them. Looking at the implementation of update-rc.d:cmp_args_with_defaults() it's clear there's a bug in the script though.

When you run update-rc.d with the "enable" or "disable" action and this function is called, there is an if-statement that tries to operate differently depending on the action you give and there's no operation for the actions "enable" or "disable":

    if ($act eq 'defaults') {
    } elsif ($act eq 'start' or $act eq 'stop') {

As a result of this oversight, the values of @arg_start_lvls and @arg_stop_lvls are never set to anything and there's no way they can match the values provided in the LSB init info settings in the init script and the warning is always printed.

In fact it seems there are a lot of issues with this function and this script; for example if you give an illegal "start" command you get this:

  $ sudo update-rc.d <svc> start
  update-rc.d: warning: start runlevel arguments (none) do not match <svc> Default-Start values (2 3 4 5)
  update-rc.d: warning: stop runlevel arguments (none) do not match <svc> Default-Stop values (0 1 6)
  Use of uninitialized value $argv[1] in pattern match (m//) at /usr/sbin/update-rc.d line 299.
  update-rc.d: error: expected NN after start
  usage: update-rc.d [-n] [-f] <basename> remove
         update-rc.d [-n] <basename> defaults [NN | SS KK]
         update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
         update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
                  -n: not really
                  -f: force

which is clearly unpleasant.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers