Bug 718183
Summary: | Provide native systemd unit file | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jóhann B. Guðmundsson <johannbg> | ||||||
Component: | net-snmp | Assignee: | Jan Safranek <jsafrane> | ||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
Severity: | unspecified | Docs Contact: | |||||||
Priority: | unspecified | ||||||||
Version: | 16 | CC: | jsafrane | ||||||
Target Milestone: | --- | ||||||||
Target Release: | --- | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Whiteboard: | |||||||||
Fixed In Version: | net-snmp-5.7-6.fc16 | Doc Type: | Bug Fix | ||||||
Doc Text: | Story Points: | --- | |||||||
Clone Of: | Environment: | ||||||||
Last Closed: | 2011-08-22 15:02:43 UTC | Type: | --- | ||||||
Regression: | --- | Mount Type: | --- | ||||||
Documentation: | --- | CRM: | |||||||
Verified Versions: | Category: | --- | |||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||
Embargoed: | |||||||||
Bug Depends On: | |||||||||
Bug Blocks: | 713562 | ||||||||
Attachments: |
|
Description
Jóhann B. Guðmundsson
2011-07-01 10:12:10 UTC
Created attachment 510838 [details]
Native systemd service file for snmp
Created attachment 510839 [details] Native systemd service file for snmptrap https://fedoraproject.org/wiki/Packaging:Guidelines:Systemd https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd http://fedoraproject.org/wiki/Packaging:Tmpfiles.d *** Bug 695584 has been marked as a duplicate of this bug. *** This turns out to be more complicated than simple .service file. Snmpd daemonizes itself in a way it confuses systemd. There can be (very short) time after main process exits and the .pid file is created by a forked child -> systemd assumes the service died and kills it. I'll try to rewrite snmpd not to fork and to send notification to systemd after initialization (via sd_notify). This will take some time though, especially passing it upstream. Hum.. I'm unable to duplicate this both snmpd and snmptrapd service start and stop cleanly. Does this happen in some oddball cases just wondering if those service files wont suffice until the fix is brought in via update. Would switching to Type=oneshot suffice as a workaround for this as in.. # snmpd.service [Unit] Description=Simple Network Management Protocol (SNMP) Daemon. After=syslog.target network.target [Service] Type=oneshot EnvironmentFile=-/etc/sysconfig/snmpd ExecStart=/usr/sbin/snmpd -LS0-6d -Lf /dev/null -p /var/run/snmpd.pid RemainAfterExit=yes [Install] WantedBy=multi-user.target # snmptrapd.service [Unit] Description=Simple Network Management Protocol (SNMP) Trap Daemon. After=syslog.target network.target [Service] Type=oneshot EnvironmentFile=-/etc/sysconfig/snmptrapd ExecStart=/usr/sbin/snmptrapd -Lsd -p /var/run/snmptrapd.pid RemainAfterExit=yes [Install] WantedBy=multi-user.target Remembert to restart the daemon when testing this as in systemctl daemon-reload systemctl stop snmpd.service snmptrapd.service systemctl start snmpd.service snmptrapd.service systemctl status snmpd.service snmptrapd.service Problem is the snmpd service. It forks twice to detach from terminal as usual daemons do. But instead of the grand-parent to wait until everything initializes in the children (and return proper exit code), snmpd grand-parent exits immediately. The .pid file is written by the child of the second fork. And now we have a race - if systemd processes the parent process SIGCHLD *before* the child creates the pid file, systemd assumes the daemon is dead and kills everything. This happens only sometimes and it took me some time to find out what is going on, systemd could log something on higher log level... Anyway, as a workaround, I can use snmpd -f (= do not fork) and service type 'simple', but if there is some service depending on snmpd (like subagents), it could get started before snmpd creates its listening sockets, so I am adding support for 'notify' service type. The code is simple, still it requires some testing and pushing upstream.... net-snmp-5.7-5.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/net-snmp-5.7-5.fc16 Please test carefully... I've checked systemd integration into upstream git and patched F16 and rawhide packages. New Net-SNMP version will be released after F16 is out, so Fedora is a bit ahead, but it has always been on the bleeding edge :). Package net-snmp-5.7-5.fc16: * should fix your issue, * was pushed to the Fedora 16 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing net-snmp-5.7-5.fc16' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/net-snmp-5.7-5.fc16 then log in and leave karma (feedback). Note that you forgot to drop the legacy sysv init script or package the legacy sysv init script in a separate sub package as stated by the guidelines ( follow links in comment 2 for details ) Damn guidelines :). Thanks for heads up. net-snmp-5.7-6.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/net-snmp-5.7-6.fc16 Package net-snmp-5.7-6.fc16: * should fix your issue, * was pushed to the Fedora 16 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing net-snmp-5.7-6.fc16' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/net-snmp-5.7-6.fc16 then log in and leave karma (feedback). net-snmp-5.7-6.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report. |