Installing hp-snmp-agents on Debian 6.0 “squeeze”

I was installing the hp-snmp-agents package for a new server on a freshly installed Debian 6.0 “squeeze” server when it threw this error:

Setting up hp-snmp-agents (8.5.0.1.1-2) ...
insserv: Service snmp has to be enabled to start service hp-snmp-agents
insserv: exiting now!
update-rc.d: error: insserv rejected the script header

Uh oh, it looks like there’s a problem with the dependency based boot support. But wait, there’s an easy way to fix this! (There are some blogs out there indicating an incorrect workaround, but I won’t repeat it here.) The init script for hp-snmp-agents has a minor error in it: the SNMP daemon Required-Start dependency needs to be changed from “snmp” to “snmpd” for Debian. Here’s a diff:

--- /etc/init.d/hp-snmp-agents.orig 2011-02-10 12:43:44.394801490 -0800
+++ /etc/init.d/hp-snmp-agents 2011-02-10 12:44:01.402801357 -0800
@@ -10,7 +10,7 @@
# Following lines are in conformance with LSB 1.2 spec
### BEGIN INIT INFO
# Provides: hp-snmp-agents
-# Required-Start: hp-health snmp
+# Required-Start: hp-health snmpd
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6

Ignoring the fact that my clock wasn’t set yet, simply correct the Required-Start line and you’re good to go. Plus, by fixing this the right way, you’ve preserved the dependency based boot functionality as was originally intended by the init script’s inclusion of those lines.