"killall -u snmp" in a pre-install step kills any running snmpd

Bug #1245604 reported by Eamon Bisson-DOnahue on 2013-10-28
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
net-snmp (Debian)
Fix Released
Unknown
net-snmp (Ubuntu)
High
Christian Ehrhardt 

Bug Description

If I am running snmpd (which I was) and I install snmp (which I did), it kills snmpd due to a pre-install step of the snmp package that calls a 'killall -u snmp' :(

Found the pre-install step here:

user@host3:~$ cat /var/lib/dpkg/info/snmp.preinst
#! /bin/sh

set -e

action="$1"

killall -u snmp 2>/dev/null || true

if [ "$action" = upgrade ]
then
  if [ -L /usr/share/doc/snmp ]; then
    rm -f /usr/share/doc/snmp
  fi
  if [ -d /usr/doc/snmp ]; then
    rm -rf /usr/doc/snmp
  fi
fi

exit 0

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in net-snmp (Ubuntu):
status: New → Confirmed
Graham Clinch (g-clinch) on 2015-10-07
affects: debian → net-snmp (Debian)
Changed in net-snmp (Debian):
status: Unknown → New
Robie Basak (racb) on 2015-10-08
Changed in net-snmp (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → High
Robie Basak (racb) on 2015-10-08
Changed in net-snmp (Ubuntu):
assignee: nobody → ChristianEhrhardt (paelzer)

snmp and snmpd are part of one source being: net-snmp

I could confirm that this still affects wily/upstream

The killall was introduced way back by
  * debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
 -- Dustin Kirkland <email address hidden> Tue, 22 Jun 2010 14:04:48 -0500

Gimmick: killall is psmisc which is not a dependency of snmp - if we keep the killall we would have to add this dependency

The killall is done with "-u snmp" but no binary is given, so it kills everything of that user.
The reason for that was, that certain scripts would call deluser which fails as long as a user is logged in.

There would be complex solutions like storing&restoring the service state.
But it turns out that the original motivation why the killall was added is gone.
These days the install scripts no more call deluser (only snmpd.postrm).

So we can just remove the killall introduced by LP: #573391 to fix LP: #1245604

At the same time I submitted an equivalent fix to debian to fix it as well and one day be able to drop the diff.

The attachment "debdiff for wily and upstream" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Robie Basak (racb) wrote :

Uploaded, thanks!

Changed in net-snmp (Ubuntu):
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-snmp - 5.7.3+dfsg-1ubuntu2

---------------
net-snmp (5.7.3+dfsg-1ubuntu2) wily; urgency=medium

  * debian/snmp.preinst:
    It turns out that the original motivation why killall was added is gone.
    So we can just remove the killall introduced by Ubuntu LP #573391
    (Closes: #781257, LP: #1245604)

 -- Christian Ehrhardt <email address hidden> Fri, 09 Oct 2015 13:18:25 +0200

Changed in net-snmp (Ubuntu):
status: Fix Committed → Fix Released
Changed in net-snmp (Debian):
status: New → Fix Committed
Changed in net-snmp (Debian):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.