#1093279 snmptrapd ignores any shipped configuration when started from systemd

Package:
snmptrapd
Source:
snmptrapd
Description:
Net-SNMP notification receiver
Submitter:
Jerome Warnier
Date:
2025-01-18 07:09:03 UTC
Severity:
normal
#1093279#5
Date:
2025-01-17 09:35:06 UTC
From:
To:
Dear Maintainer,

The shipped /lib/systemd/system/snmptrapd.service unit file ignores both the
included /etc/default/snmptrapd (only used from the initscript) and
/etc/snmp/snmptrapd.conf.

On top of that, since the ExecStart= line is wrong
(ExecStart=/usr/sbin/snmptrapd -LOw -f udp:162 udp6:162), it is rather tricky to
overcome with an override file (you have to "reset" ExecStart first).

Example local "user" fix in /etc/systemd/system/snmptrapd.service.d/execstart.conf:
---
[Service]
ExecStart=
ExecStart=/usr/sbin/snmptrapd -Cc /etc/snmp/snmptrapd.conf
---

But of course, this should rather be fixed in the packaging itself, hence this
ticket.

Best regards.

#1093279#10
Date:
2025-01-18 07:07:05 UTC
From:
To:
The first is by design, the second is not true.

/etc/default/* is used for old init scripts, not for systemd units.
It actually says that in the file
# This file controls the behaviour of /etc/init.d/snmptrapd
# but not of the corresponding systemd service file.

Onto snmptrapd.conf, let's first put "outputOption n" into the
configuration file, send a trap and check the journal:

Jan 18 17:58:16 elmo snmptrapd[853516]: .1.3.6.1.6.3.1.1.4.1.0 = OID:
.1.3.6.1.6.3.1.1.5.3        .1.3.6.1.2.1.2.2.1.1 = INTEGER: 2
 .1.3.6.1.2.1.2.2.1.7 = INTEGER: up(1)        .1.3.6.1.2.1.2.2.1.8 =
INTEGER: up(1)

Now lets comment out that line, restart the daemon, send a trap and check
the journal:
Jan 18 18:00:03 elmo snmptrapd[854207]: SNMPv2-MIB::snmpTrapOID.0 = OID:
IF-MIB::linkDown        IF-MIB::ifIndex = INTEGER: 2
 IF-MIB::ifAdminStatus = INTEGER: up(1)        IF-MIB::ifOperStatus =
INTEGER: up(1)

That looks like the configuration file is working.

On top of that, since the ExecStart= line is wrong
It's not, I have no idea what you're trying to do in the configuration file
but it's parsing it fine here.

 - Craig