Wednesday, May 29, 2013

chkconfig priorities

I recently had a problem on a CentOS-6 machine where my dhcp server did not start at boot because it was serving a virtual network interface which did not yet exist.

The best solution to this problem would be for the dhcp server to start up and wait for the network interface to come up. Many other network tools do this successfully so I don't know why dhcpd should be different. That problem is however too big for me to fix on my server so I need a more simple approach.

To solve this, I would like to adjust my dhcp server to start after the virtual network interface service. CentOS-6 uses the (old) RedHat style init scripts (with some LSB configuration too). RedHat like to proclaim that they use upstarts now but all the upstarts do is make a call to the /etc/rc.d/rc script, just like init used to do.

So, the problem is still based around the System V style scripts which have magic comments which define when to start & stop the scripts.

This is the relevant parts of the header for the dhcp server (/etc/rc.d/init.d/dhcpd):
# Provides: dhcpd
# Default-Start:
# Default-Stop:
# Should-Start: portreserve
# Required-Start: $network
# Required-Stop:
# Short-Description: Start and stop the DHCP server
# Description: dhcpd provides the Dynamic Host Configuration Protocol (DHCP)
#              server.
# The fields below are left around for legacy tools (will remove later).
# chkconfig: - 65 35

Despite the comments about being legacy, when installed using chkconfig, the priorities used are indeed Start 65, Kill 35. We can confirm this with a simple ls
ls /etc/rc.d/rc?.d/*dhcpd

The virtual network is also controlled by an init script with a more modest header (/etc/rc.d/init.d/vand):
# chkconfig: 2345 95 05
# description: Virtual Area Network Deamon

Not surprisingly, this will Start at 95 and Kill at 05.

The first idea I had was to modify the dhcpd init scrip directly. Unfortunately this script is not marked as config file (in the rpm) so when a new version comes out, my changes will be lost. I need something better than that.

It is not immediately obvious but chkconfig does have the ability to alter the priorities. This is called override (but not to be confused with the command line parameter --override).

I was unable to find and documentation on the override but I did work out that his minimal config file was all that was needed:

# Required-Start: vand

When chkconfig reads the headers from the dhpcd init script, it will also read this file (because it has the same basename) and override the values from the init script.

All that is needed is to apply the settings with:
chkconfig dhcpd on

Some information about LSB init scripts can be found here

The final job is to make puppet aware of my changes. Perhaps in my next post.


  1. Replies
    1. Osm! This post is very informative and effective. I got what I was looking for. Here to say thank you. Thanks for sharing FMWhatsapp valuable content.

  2. The information you shared is very helpful to us. fleeing the complex

  3. Visit neighborhood reston dental center specialist Dr. Ali Miami, VA for family and corrective dentistry. Offering dental inserts, porcelain facade, tooth cleanings, and more.

  4. How to enable or disable service on boot with chkconfig

    hotstar app

  5. The source is offering excellent whatsapp features, safe, anti ban and privacy protected features for android and iphone users.

  6. Obrigado por compartilhar isso, muito interessante. Eu recomendo que vocĂȘ visite este site para encontrar jogos de cassino gratis.

  7. Great, your post is helping me a lot. Thanks for the detailed info on this topic. It’s hard to find nowadays to know about the basics but you did it so much well. I would love to see more about it. Keep sharing and updated. Also share more posts with us. Thank you. FMWhatsapp

  8. I have also encountered such a case and fortunately the WAGBPro team has supported me

  9. Thanks a lot for sharing about these chkconfig priorities. I am so much happy to read. Kinemaster Diamond

  10. Thanks for the detailed article on this topic. I would like to see more such awesome articles from you. Download GBWhatsApp APK

  11. Thanks for sharing this valuable piece of information. Keep sharing more such awesome articles in the future. Goodbye! Download FMWhatsApp APK