postinst fails if group exists

Bug #611721 reported by Disconnect on 2010-07-30
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Server papercuts
Medium
Thierry Carrez
tomcat6 (Ubuntu)
Medium
Thierry Carrez
Lucid
Medium
Thierry Carrez

Bug Description

Binary package hint: tomcat6

In cases where the tomcat6 group already exists (eg ldap), the postinst fails due to running addgroup blindly.
Commenting out the addgroup works fine, although that isn't a generic fix.

> addgroup --system "$TOMCAT6_GROUP" --quiet
> if ! id $TOMCAT6_USER > /dev/null 2>&1 ; then

(I had a better bug report with more detail, but the "no referrer" error ate it. Lovely..)

== SRU Report ==
Impact:
If the tomcat6 group already exists, tomcat6 will fail to install correctly.

Development branch fix:
Fix is in maverick as of 6.0.28-2ubuntu1

Minimal patch:
- addgroup --system "$TOMCAT6_GROUP" --quiet
+ if ! getent group "$TOMCAT6_GROUP" > /dev/null 2>&1 ; then
+ addgroup --system "$TOMCAT6_GROUP" --quiet
+ fi

TEST CASE:
$ sudo addgroup tomcat6
$ sudo apt-get install tomcat6
Affected version:
Tomcat fails to install (subprocess installed post-installation script returned error exit status 1)
Fixed version:
Tomcat installs successfully.

Regression potential:
Given the nature of the patch, it is minimal.

Thierry Carrez (ttx) on 2010-08-02
Changed in tomcat6 (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Thierry Carrez (ttx) on 2010-08-03
Changed in server-papercuts:
importance: Undecided → Medium
status: New → Confirmed
Thierry Carrez (ttx) on 2010-08-03
Changed in server-papercuts:
milestone: none → maverick-beta
Thierry Carrez (ttx) on 2010-08-03
Changed in server-papercuts:
assignee: nobody → Thierry Carrez (ttx)
Thierry Carrez (ttx) on 2010-08-12
Changed in tomcat6 (Ubuntu):
assignee: nobody → Thierry Carrez (ttx)
status: Confirmed → In Progress
Changed in server-papercuts:
status: Confirmed → In Progress
Thierry Carrez (ttx) wrote :

I can't reproduce that.
If the group already exists, "addgroup --system tomcat6 --quiet" returns 0 and the script proceeds.

Could you confirm what the issue is ?

Changed in tomcat6 (Ubuntu):
status: In Progress → Incomplete
Changed in server-papercuts:
status: In Progress → Incomplete
Disconnect (dismc) wrote :

root@foo:~# aptitude -vvv install tomcat6
..
The following partially installed packages will be configured:
  tomcat6
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Setting up tomcat6 (6.0.24-2ubuntu1.2) ...
dpkg: error processing tomcat6 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 tomcat6
E: Sub-process /usr/bin/dpkg returned an error code (1)
..
root@foo:~# dpkg --configure -a -D2
Setting up tomcat6 (6.0.24-2ubuntu1.2) ...
D000002: fork/exec /var/lib/dpkg/info/tomcat6.postinst ( configure )
dpkg: error processing tomcat6 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 tomcat6
root@foo:~# sed -i -e s_addg_#addg_ /var/lib/dpkg/info/tomcat6.postinst
  (verified that the only affected line is addgroup)
root@foo:~# dpkg --configure -a
Setting up tomcat6 (6.0.24-2ubuntu1.2) ...
 * Starting Tomcat servlet engine tomcat6
Using CATALINA_BASE: /var/lib/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /tmp/tomcat6-tmp
Using JRE_HOME: /usr/lib/jvm/java-6-sun
Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
   ...done.

Disconnect (dismc) wrote :

Also:
foo@bar:~$ sudo addgroup --system tomcat6 --quiet ; echo $?
1

Thierry Carrez (ttx) wrote :

Hm, here is what I get if tomcat6 is already created:

$ sudo addgroup --system tomcat6 --quiet ; echo $?
0

Something else makes it fail, what does "sudo addgroup --system tomcat6 ; echo $?" return for you ?
Also , what version is this ? Lucid ? Maverick ?

Disconnect (dismc) wrote :

Lucid, up to date with security patches (and sun-java, not that it matters for this.)

I suspect the difference is ldap authentication vs local groups. (In fact, I just tested against a group that it is in both /etc/group and in ldap and it returned 0.)

That may make this an adduser bug..

Thierry Carrez (ttx) wrote :

In fact if the group exists but is not a system group (100-999), addgroup returns 1. I'll add a getent group tomcat6 check to check for group existence before running addgroup.

Changed in tomcat6 (Ubuntu):
status: Incomplete → Triaged
Changed in server-papercuts:
status: Incomplete → In Progress
Thierry Carrez (ttx) on 2010-08-25
Changed in tomcat6 (Ubuntu):
status: Triaged → In Progress
Thierry Carrez (ttx) on 2010-08-25
Changed in server-papercuts:
status: In Progress → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tomcat6 - 6.0.28-2ubuntu1

---------------
tomcat6 (6.0.28-2ubuntu1) maverick; urgency=low

  * Check for group existence to avoid postinst failure (LP: #611721)
 -- Thierry Carrez (ttx) <email address hidden> Wed, 25 Aug 2010 09:07:03 +0200

Changed in tomcat6 (Ubuntu):
status: In Progress → Fix Released
Thierry Carrez (ttx) on 2010-10-06
Changed in tomcat6 (Ubuntu Lucid):
status: New → Triaged
importance: Undecided → Medium
Thierry Carrez (ttx) on 2010-10-07
description: updated
Changed in tomcat6 (Ubuntu Lucid):
assignee: nobody → Thierry Carrez (ttx)
Thierry Carrez (ttx) wrote :

SRU fix uploaded to lucid-proposed, ready for review

Accepted tomcat6 into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in tomcat6 (Ubuntu Lucid):
status: Triaged → Fix Committed
tags: added: verification-needed
Thierry Carrez (ttx) wrote :

Verified fixed in -proposed.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tomcat6 - 6.0.24-2ubuntu1.4

---------------
tomcat6 (6.0.24-2ubuntu1.4) lucid-proposed; urgency=low

  * Check for group existence to avoid postinst failure (LP: #611721)
 -- Thierry Carrez (ttx) <email address hidden> Thu, 07 Oct 2010 14:06:00 +0100

Changed in tomcat6 (Ubuntu Lucid):
status: Fix Committed → Fix Released
Disconnect (dismc) wrote :

Worked great, thanks! :)

tags: added: testcase
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers