package snmpd 5.7.3+dfsg-1ubuntu4 failed to install error exit status 1

Bug #1710579 reported by Ashish Srivastava
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
net-snmp (Ubuntu)
Incomplete
Medium
Unassigned

Bug Description

root@snmp-agent:~# journalctl
-- Logs begin at Mon 2017-08-14 13:21:17 IST, end at Mon 2017-08-14 14:20:21 IST. --
Aug 14 13:21:17 snmp-agent systemd-journald[232]: Runtime journal (/run/log/journal/) is 1.2M, max 9.9M, 8.6M free.
Aug 14 13:21:17 snmp-agent kernel: Linux version 4.10.0-32-generic (buildd@lcy01-01) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubunt
Aug 14 13:21:17 snmp-agent kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.10.0-32-generic root=UUID=97f8568c-9826-450d-837f-4d91b31
Aug 14 13:21:17 snmp-agent kernel: KERNEL supported cpus:
Aug 14 13:21:17 snmp-agent kernel: Intel GenuineIntel
Aug 14 13:21:17 snmp-agent kernel: AMD AuthenticAMD
Aug 14 13:21:17 snmp-agent kernel: Centaur CentaurHauls
Aug 14 13:21:17 snmp-agent kernel: x86/fpu: Legacy x87 FPU detected.
Aug 14 13:21:17 snmp-agent kernel: e820: BIOS-provided physical RAM map:
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x0000000000100000-0x000000003ffeffff] usable
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x000000003fff0000-0x000000003fffffff] ACPI data
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
Aug 14 13:21:17 snmp-agent kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
Aug 14 13:21:17 snmp-agent kernel: NX (Execute Disable) protection: active
Aug 14 13:21:17 snmp-agent kernel: SMBIOS 2.5 present.
Aug 14 13:21:17 snmp-agent kernel: DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
Aug 14 13:21:17 snmp-agent kernel: Hypervisor detected: KVM
Aug 14 13:21:17 snmp-agent kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
Aug 14 13:21:17 snmp-agent kernel: e820: remove [mem 0x000a0000-0x000fffff] usable
Aug 14 13:21:17 snmp-agent kernel: e820: last_pfn = 0x3fff0 max_arch_pfn = 0x400000000
Aug 14 13:21:17 snmp-agent kernel: MTRR default type: uncachable
Aug 14 13:21:17 snmp-agent kernel: MTRR variable ranges disabled:
Aug 14 13:21:17 snmp-agent kernel: MTRR: Disabled
Aug 14 13:21:17 snmp-agent kernel: x86/PAT: MTRRs disabled, skipping PAT initialization too.
Aug 14 13:21:17 snmp-agent kernel: x86/PAT: Configuration [0-7]: WB WT UC- UC WB WT UC- UC
Aug 14 13:21:17 snmp-agent kernel: CPU MTRRs all blank - virtualized system.
Aug 14 13:21:17 snmp-agent kernel: found SMP MP-table at [mem 0x0009fff0-0x0009ffff] mapped at [ffffa04e4009fff0]
Aug 14 13:21:17 snmp-agent kernel: Scanning 1 areas for low memory corruption
Aug 14 13:21:17 snmp-agent kernel: Base memory trampoline at [ffffa04e40099000] 99000 size 24576
Aug 14 13:21:17 snmp-agent kernel: BRK [0x0ec28000, 0x0ec28fff] PGTABLE
Aug 14 13:21:17 snmp-agent kernel: BRK [0x0ec29000, 0x0ec29fff] PGTABLE
Aug 14 13:21:17 snmp-agent kernel: BRK [0x0ec2a000, 0x0ec2afff] PGTABLE
Aug 14 13:21:17 snmp-agent kernel: BRK [0x0ec2b000, 0x0ec2bfff] PGTABLE

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: snmpd 5.7.3+dfsg-1ubuntu4
ProcVersionSignature: Ubuntu 4.10.0-32.36~16.04.1-generic 4.10.17
Uname: Linux 4.10.0-32-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.10
AptOrdering:
 snmpd: Install
 snmpd: Configure
 NULL: ConfigurePending
Architecture: amd64
Date: Mon Aug 14 14:19:21 2017
DuplicateSignature:
 package:snmpd:5.7.3+dfsg-1ubuntu4
 Setting up snmpd (5.7.3+dfsg-1ubuntu4) ...
 adduser: The user `snmp' already exists. Exiting.
 dpkg: error processing package snmpd (--configure):
  subprocess installed post-installation script returned error exit status 1
ErrorMessage: subprocess installed post-installation script returned error exit status 1
InstallationDate: Installed on 2017-08-14 (0 days ago)
InstallationMedia: Ubuntu 16.04.2 LTS "Xenial Xerus" - Release amd64 (20170215.2)
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1.2
 apt 1.2.24
SourcePackage: net-snmp
Title: package snmpd 5.7.3+dfsg-1ubuntu4 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Ashish Srivastava (its-ashish) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

The postinst script has guards against adding the user if it exists already:
    if [ ! `getent passwd snmp >/dev/null` ]; then

      if [ ! `getent group snmp >/dev/null` ]; then
         # no snmp user & group
         adduser --quiet --system --group --home $SNMPDIR \
                 --shell /usr/sbin/nologin snmp
      else
         # no snmp user, but snmp group exists
         adduser --quiet --system --ingroup snmp --home $SNMPDIR \
                 --shell /usr/sbin/nologin snmp
      fi

    elif [ ! `getent group snmp >/dev/null` ]; then

      # snmp user exists but no snmp group
      addgroup --quiet --system snmp

      # if user is local system user (not LDAP or so), then exec usermod
      # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482041#25
      if [ ! `getent passwd snmp | cut -d':' -f3` -ge 1000 ]; then
        mkdir -p $SNMPDIR || true
        usermod -d $SNMPDIR -m -g snmp -s /usr/sbin/nologin snmp
      fi

    fi

It specifically uses getent to check for an existing user or group, in case it's in a remote (networked) database like ldap.

That being said, looks like it's not working:
root@xenial-snmpd-1710579:~# ./postinst.sh
+ set -e
+ SNMPDIR=/var/lib/snmp
+ getent passwd snmp
+ [ ! ]
+ getent group snmp
+ [ ! ]
+ echo no snmp user and group
no snmp user and group
+ adduser --quiet --system --group --home /var/lib/snmp --shell /usr/sbin/nologin snmp

That adduser call doesn't fail, though:
root@xenial-snmpd-1710579:~# adduser --quiet --system --group --home /var/lib/snmp --shell /usr/sbin/nologin snmp
root@xenial-snmpd-1710579:~# echo $?
0

Removing --quiet:
root@xenial-snmpd-1710579:~# adduser --system --group --home /var/lib/snmp --shell /usr/sbin/nologin snmp
Warning: The home dir /var/lib/snmp you specified already exists.
The system user `snmp' already exists. Exiting.
root@xenial-snmpd-1710579:~# echo $?
0

This warrants further debugging.

tags: added: server-next
Changed in net-snmp (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

They probably meant for the check to be:

if ! getent passwd snmp >/dev/null

i.e., check exit status ($?).

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Ok, got it. To reproduce the problem, before installing the snmpd package you need to have an snmp user with an uid that does not belong in the system user range. Something with an uid higher than 999.

For example:

root@xenial-snmpd-1710579:~# useradd -M snmp
root@xenial-snmpd-1710579:~# id snmp
uid=1001(snmp) gid=1001(snmp) groups=1001(snmp)
root@xenial-snmpd-1710579:~# apt install snmpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
snmpd is already the newest version (5.7.3+dfsg-1ubuntu4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up snmpd (5.7.3+dfsg-1ubuntu4) ...
adduser: The user `snmp' already exists. Exiting.
dpkg: error processing package snmpd (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 snmpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

@~its-ashish can you please confirm that your existing snmp user (and group) have a high uid? Please show:

getent passwd snmp
getent group snmp

Thanks

David Britton (dpb)
Changed in net-snmp (Ubuntu):
status: Triaged → Incomplete
Robie Basak (racb)
tags: added: server-next-drop
Robie Basak (racb)
tags: removed: server-next server-next-drop
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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