Bug #1219

Disabling a service on Red Hat systems should use 'chkconfig service off', not 'chkconfig --del service'

Added by Ingemar Nilsson about 4 years ago. Updated 7 months ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:service
Target version:-
Affected Puppet version:0.25.1 Branch:
Keywords:
Votes: 0

Description

Currently, if I disable a service with enable => false, Puppet seems to run ‘chkconfig —del servicename’. This is incorrect, as it removes the service from chkconfig management. The correct way is to use ‘chkconfig servicename off’.

One of the bad effects of the current behavior is that ‘chkconfig —del servicename’ removes all the /etc/rc.d/Kservicename links, which are there to make sure that temporarily started services are allowed to gracefully shutdown on a system shutdown. They are preserved when ‘chkconfig servicename off’ is used.

Obviously this also means that enable => true should result in a ‘chkconfig servicename on’ instead of the current ‘chkconfig —add servicename’.

History

Updated by James Turnbull about 4 years ago

Actually the provider does both: chkconfig —del service and chkconfig service off and the reverse when enabling.

Updated by AJ Christensen about 4 years ago

Are there any other reasons why we shouldn’t use —add/—del? I don’t have any redhat boxen lying around to see what chkconfig —del servicename actually does.

I have the code for this (http://github.com/fujin/puppet/commits/fix1219), but I don’t understand enough about the redhat service provider as to how it currently works and what would break if we changed this. As such, I’m going to leave the ticket as needs more info.

Anyone care to offer some input?

Updated by Ingemar Nilsson about 4 years ago

“Actually the provider does both: chkconfig —del service and chkconfig service off and the reverse when enabling.”

But why? The only command that needs to run to enable/disable a service is ‘chkconfig servicename on/off’, so why also run ‘chkconfig —add/del servicename’? The latter commands are used when installing and uninstalling a service (such as by a package manager), and are not supposed to be used for simple enabling/disabling of a service.

Updated by AJ Christensen about 4 years ago

Sent pull request to Luke

Updated by Luke Kanies about 4 years ago

I’m hesitant to accept the patch without feedback from David. I’m emailed him to ask about it.

Updated by David Lutterkort about 4 years ago

Yes, this is the right thing to do. chkonfig —add/—del should only be used by the RPM %post scripts to register a service for management with chkconfig.

Updated by James Turnbull about 4 years ago

  • Status changed from 1 to Closed
  • 7 set to fixed

Pushed in commit:83ef1b0cda1b010eea3f7d001716ea52f7081c24 in branch 0.24.x

Updated by Dan Bode over 2 years ago

  • Status changed from Closed to Re-opened
  • Affected Puppet version set to 0.25.1

I wanted to make a comment about this fix, in particular the decision not to use —add.

In some situations where the service is not currently registered, the “add” command needs to be used together with “on” to properly set up both kill and start links.

Example (from RH5)

[root@dansrh3 rc.d]# chkconfig —del httpd [root@dansrh3 rc.d]# !find find * | grep httpd init.d/httpd [root@dansrh3 rc.d]# chkconfig httpd on [root@dansrh3 rc.d]# !find find * | grep httpd init.d/httpd rc2.d/S85httpd rc3.d/S85httpd rc4.d/S85httpd rc5.d/S85httpd [root@dansrh3 rc.d]#

Now we are in a broken state where there are no kill scripts set up.

Should it be up to puppet to fix this? It seems that it should do both add and on (but not both off and del)

Updated by James Turnbull over 2 years ago

I’d be interested in David’s view on this.

Updated by James Turnbull over 2 years ago

  • Target version deleted (0.24.5)

Updated by David Lutterkort over 2 years ago

James Turnbull wrote:

I’d be interested in David’s view on this.

The original ticket is right: puppet should use ‘chkconfig service off’, not ‘chkconfig —del service’. If there are services that do not install themselves with ‘chkconfig —add service’ in a post script in the RPM, it should be filed as a bug against the package.

If puppet wants to be extra thorough, it should check that links have been set up by running ‘chkconfig —list service’, and if that produces an error, run ‘chkconfig —add’ again; this will be particularly important for systems that have been broken by puppet’s erroneous ‘chkconfig —del’

Updated by Ingemar Nilsson over 2 years ago

David Lutterkort wrote:

If puppet wants to be extra thorough, it should check that links have been set up by running ‘chkconfig —list service’, and if that produces an error, run ‘chkconfig —add’ again; this will be particularly important for systems that have been broken by puppet’s erroneous ‘chkconfig —del’

I would have suggested it if you hadn’t done so already. Earlier versions of Puppet has broken many services on our systems by using “chkconfig —del servicename”, and IIRC, trying to run “chkconfig servicename on/off” results in an error for such a service. It would be nice to include code that cleans up the breakage that the earlier version caused, so that the sysadmins won’t have to do that manually.

Updated by Markus Roberts over 2 years ago

  • Target version set to 0.25.3

Updated by Markus Roberts over 2 years ago

  • Target version changed from 0.25.3 to 0.25.4

Updated by James Turnbull over 2 years ago

  • Target version changed from 0.25.4 to 0.25.5

Updated by James Turnbull about 2 years ago

  • Target version changed from 0.25.5 to 49

Updated by Luke Kanies about 2 years ago

  • Assignee deleted (Luke Kanies)

Updated by James Turnbull almost 2 years ago

  • Status changed from Re-opened to Closed

I’m going to close this – it’s something I don’t see us fixing at this point for earlier releases.

Updated by James Turnbull over 1 year ago

  • Target version deleted (49)

Updated by Mariusz Gronczewski 12 months ago

  • Status changed from Closed to Re-opened

Maybe add chkconfig —add when turning script on, because atm. adding new service (for example second instance of apache) to /etc/init.d/ does not create /etc/rc(0|6).d scripts, which in turn can make problems while rebooting (for example second apache instance holding files on GFS share which in turn slows down clean reboot a lot)

Updated by James Turnbull 7 months ago

  • Status changed from Re-opened to Closed

I think this is a different issue – I suggest opening a new ticket please.

Also available in: Atom PDF