Puppet: System Administration Automated

Support

Ticket #1060 (closed defect: fixed)

Opened 8 months ago

Last modified 8 months ago

services not disabled correctly on Debian

Reported by: rra Assigned to: luke
Priority: normal Milestone: elmo
Component: library Version: 0.24.1
Severity: normal Keywords: debian service
Cc: Triage Stage: Ready for checkin
Attached Patches: None Complexity: Unknown

Description

It looks like when disabling a service on Debian, Puppet deletes all the /etc/rc?.d links. This isn't the correct way to disable a service since it mimics the service not being installed at all. The next time the package is updated, the service will be linked back in and dpkg will attempt to start it.

The correct way to disable a service is to rename the S* links to K* links but otherwise leave them in place. If done this way, the service will not be started even on upgrades.

update-rc.d could be used to set the links up that way, but it may be easier just to manipulate the file system since you have to look at the file system to figure out what priority to use for the stop links anyway, at least currently. (This will all change eventually with dependency-managed boots, which are coming hopefully for lenny.)

Change History

02/14/08 00:39:03 changed by luke

  • stage changed from Unreviewed to Needs more info.

Can you explain how update-rc.d can be used to do this?

02/14/08 01:21:06 changed by rra

There's an example in the man page, as it turns out (which I didn't notice when I filed the original ticket).

       Example of disabling a service:
          update-rc.d -f foobar remove
          update-rc.d foobar stop 20 2 3 4 5 .

02/14/08 08:56:23 changed by gadnet

yes, just disabling the links will work for a while but fails as at each apt-get upgrade the link will be back. The proper way to prevent this is the above mentionned way:

update-rc.d -f foobar remove update-rc.d foobar stop 20 2 3 4 5 .

this way debian apt does not rebuild the link as they allready exist.

02/14/08 11:52:31 changed by jamtur01

Hmmm - tricky to re-enable. I've tried the above commands:

update-rc.d -f foobar remove
update-rc.d foobar stop 1 2 3 4 5 6 .

and then tried to re-enable:

update-rc.d foobar defaults

I get the error:

System startup links for /etc/init.d/foobar already exist.

But the links remain K* rather than S*

02/14/08 15:05:34 changed by gadnet

indeed you have to make

update-rc.d -f foobar remove update-rc.d foobar start defaults

i wonder if it keeps the priority numbers, the issue is that not all init script use those even if they should: http://wiki.debian.org/LSBInitScripts/DependencyBasedBoot

those headers are described here: http://wiki.debian.org/LSBInitScripts

ghislain.

02/14/08 20:57:39 changed by rra

Re-enabling in this fashion will indeed not keep priority numbers. Unfortunately, unlike on Red Hat, Debian never represented the priority numbers in the init script itself, so the priority numbers are only known to the package postinst script and aren't really derivable.

The same thing is true, however, of the current behavior. As soon as the init scripts are removed, there's no way to know what priority to put them back at. So that problem is somewhat ancillary to this report.

Dependency-based boot in lenny will hopefully fix the underlying problem.

02/15/08 00:03:42 changed by jamtur01

Then I can't see how this issue can be fixed. Any other ideas?

02/15/08 00:45:35 changed by rra

I don't understand what you don't think can be fixed.

Currently, Puppet runs update-rc.d -f foobar remove. This is not the correct way to disable a service, since it means the service will be re-enabled on package upgrade.

The correct way to disable a service is to run:

    update-rc.d -f foobar remove
    update-rc.d foobar stop 1 2 3 4 5 6 .

When re-enabling the service, Puppet needs to run:

    update-rc.d -f foobar remove
    update-rc.d foobar defaults

This change will fix the current problems with disabling services.

There is a separate problem that both the current Puppet behavior and Puppet behavior after this change doesn't preserve the start order of a script after disabling it and re-enabling it, but that problem is not new and making this change doesn't make it either better or worse.

02/15/08 01:22:45 changed by luke

  • stage changed from Needs more info to Accepted.
  • milestone set to elmo.

02/15/08 01:33:03 changed by jamtur01

Okay - fixed in commit [f3fbc77b52bde3ce643d25f4a0d28a2cd35ef52] in branch 0.24.x

02/15/08 01:33:16 changed by jamtur01

  • owner changed from community to luke.
  • stage changed from Accepted to Ready for checkin.

02/16/08 21:36:30 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Pushed.