Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 41742 - unmerging of tomcat-4.1.14-r1 fails with error after upgrade to tomcat-5.0.18
Summary: unmerging of tomcat-4.1.14-r1 fails with error after upgrade to tomcat-5.0.18
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-15 22:07 UTC by E Smith
Modified: 2004-02-24 13:16 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description E Smith 2004-02-15 22:07:54 UTC
When tomcat-4.1.14-r1 is getting unmerged after updating tomcat to tomcat-5.0.18 the build fails complaining about trying to remove user tomcat. Also starting /etc/init.d/tomcat fails with this error

root@earth  # /etc/init.d/tomcat start
 * Starting Tomcat...
Unable to cd to "/home/tomcat"                                            [ !! ]

Reproducible: Always
Steps to Reproduce:
1.emerge -uD tomcat
2.
3.

Actual Results:  
--- !empty dir /opt/tomcat
--- !empty dir /opt
--- !empty dir /etc
--- !targe sym /opt/tomcat/logs
--- !targe sym /opt/tomcat/common/package.env
--- !targe sym /opt/tomcat/common/lib
--- !targe sym /opt/tomcat/common/endorsed
 * >>> Removing user for Tomcat
 
!!! ERROR: net-www/tomcat-4.1.24-r1 failed.
!!! Function pkg_postrm, Line 138, Exitcode 1
!!! Error removing Tomcat user
 
!!! FAILED postrm: 1


Expected Results:  
expected tomcat to be successfully updated to tomcat-5.0.18
Comment 1 Ian Tindale 2004-02-16 04:06:00 UTC
I've just experienced this. Also, it complains even when trying to emerge unmerge all the tomcat mess. I've removed the tomcat user and group, put them back (id 265 in my case) and still it's stuck. Deleted the contents of whatever I was doing in tomcat (restricted to the webdav app in my case) and still no go.
-- 
Ian Tindale
Comment 2 Peter Gantner (a.k.a. nephros) 2004-02-16 04:41:08 UTC
I kind of fixed that by doing

emerge tomcat (installs 5.0.18, fails at 4.1.24-t1 unmerge)
vim /var/db/pkg/net-www/tomcat-4.1.24-r1/tomcat-4.1.24-r1.ebuild
( comment out or delete pkg_postrm() )
emerge -P tomcat

actually I got these:
--- !targe sym /opt/tomcat/common/endorsed
shell-init: could not get current directory: getcwd: cannot access parent direc
tories: No such file or directory
shell-init: could not get current directory: getcwd: cannot access parent direc
tories: No such file or directory
 * Caching service dependencies...
chdir: could not get current directory: getcwd: cannot access parent directorie
s: No such file or directory                                               [ ok
 ]

BUT I assume these are because I was in /var/db/pkg/net-www/tomcat-4.1.24-r1/ while pruning and have nothing to do with this really. Not sure though, and I can't reproduce it now that my 4.1.24 install is gone ;)
Comment 3 Chris Aniszczyk (RETIRED) gentoo-dev 2004-02-16 09:31:03 UTC
I wish I could reproduce this one, but I can't since the old ebuild fails anyway since tomcat is moved. 

What happens when you do a 
emerge -C tomcat
emerge tomcat

It seems the pruning of the users is what is doing it. I'm going to set it up so you have to uninstall the previous version of tomcat in order to install the new one first unless there's objections and people require more than one tomcat.
Comment 4 N Addy 2004-02-16 10:07:58 UTC
emerge -C tomcat also fails with the same message.  I made sure there was a valid tomcat entry in passwd, shadow, and group.  Then ran an emerge -C and got the following:

--- !targe sym /opt/tomcat/common/endorsed
 * >>> Removing user for Tomcat
!!! ERROR: net-www/tomcat-4.1.24-r1 failed.
!!! Function pkg_postrm, Line 138, Exitcode 1
!!! Error removing Tomcat user
!!! FAILED postrm: 1

The funny thing is that tomcat is successfully removed from passwd and shadow (but not from group as expected).  Nothing is actually removed from /opt/tomcat.  

When doing an emerge -C with NO tomcat entries in passwd, shadow, or group I get the following:

 * >>> Removing user for Tomcat
userdel: user tomcat does not exist
!!! ERROR: net-www/tomcat-4.1.24-r1 failed.
!!! Function pkg_postrm, Line 138, Exitcode 6
!!! Error removing Tomcat user
!!! FAILED postrm: 1

Again, the /opt/tomcat dir remains intact.
Comment 5 E Smith 2004-02-16 13:36:59 UTC
strange thing is after then unmerge and the error 

!!! ERROR: net-www/tomcat-4.1.24-r1 failed.
!!! Function pkg_postrm, Line 138, Exitcode 1
!!! Error removing Tomcat user
 
!!! FAILED postrm: 1
root@earth hobo # id tomcat
id: tomcat: No such user
root@earth hobo #

though the group remains

root@earth hobo # useradd tomcat
useradd: group tomcat exists - if you want to add this user to that group, use -g.
root@earth hobo # useradd tomcat -g tomcat
root@earth hobo # id tomcat
uid=1004(tomcat) gid=265(tomcat) groups=265(tomcat)

trying an emerge tomcat or an emerge unmerge or emerge -C tomcat still fails with the same error
Comment 6 N Addy 2004-02-16 20:02:36 UTC
tomcat is now stuck in the "emerge clean" queue.  Autoclean attempts (unsuccessfully) to unmerge tomcat after every "emerge -u foo".

Any way to force an unmerge?
Comment 7 jak 2004-02-17 01:01:07 UTC
I had some permission problems before changed following line in ebuild

"chown -R tomcat.tomcat ${S}"
to
"chown -R tomcat:tomcat ${S}"

Now ebuild 5.0.18 seems to be working in my G3 ibook...
Comment 8 N Addy 2004-02-17 21:42:01 UTC
I made the chown edit and successfully installed 5.0.18 but the autoclean still fails.  The install (i.e. update) adds the tomcat user but the autoclean removes it again.  The /opt/tomcat tree defaults to owner 265 (the default uid from the install).

# ll /opt/tomcat
total 6
drwxr-x---    9 265      tomcat        240 Feb 17 23:33 .
drwxr-xr-x   15 root     root          456 Feb  8 15:16 ..
drwxr-xr-x    2 265      tomcat        680 Feb 17 23:33 bin
drwxr-xr-x    3 265      tomcat        128 Feb 17 23:33 common
drwxr-xr-x    2 265      tomcat        288 Nov 28 18:19 conf
lrwxrwxrwx    1 root     root           15 Feb 17 23:33 logs -> /var/log/tomcat
drwxr-xr-x    4 265      tomcat         96 Feb 17 23:33 server
drwxr-xr-x    2 265      tomcat         72 Feb 17 23:33 temp
drwxr-xr-x    7 265      tomcat        200 Feb 17 23:33 webapps
drwxr-xr-x    3 265      tomcat        104 Feb 17 23:33 work
Comment 9 James 2004-02-19 09:42:45 UTC
I fixed mine in an ugly manner.

Steps:
1. Edit /var/db/pkg/net-www/tomcat-4.1.24-r1 and comment out the pkg_postrm() function

2. userdel tomcat && groupdel tomcat

3. emerge clean
Comment 10 Stefan Kirsch 2004-02-19 10:21:33 UTC
As the tomcat ebuild uses a variable INSTALLING to check if it should remove the user and group, I was able to cleanly unmerge by doing a 

INSTALLING=yes emerge -C tomcat

Afterwards you can of course manually delete user and group tomcat.
Comment 11 Chris Aniszczyk (RETIRED) gentoo-dev 2004-02-19 10:28:31 UTC
Bear with me guys, I'm re-doing the tomcat ebuilds this weekend. You will have problems with the old ebuilds, I'm sorry for this. You can follow Stefan's advice for now to remove the old versions of tomcat and update them with the new. I'm shooting for sometime this weekend to have r1's for the tomcat ebuilds, including building them from source. 

Sorry for the delay.
Comment 12 Chris Aniszczyk (RETIRED) gentoo-dev 2004-02-24 13:16:27 UTC
Issue is resolved in the newer tomcats.