Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I get the following error when installing Tomcat7:

Setting up tomcat7 (7.0.26-1ubuntu1.1) ...  
chmod: cannot access `/etc/tomcat7/tomcat-users.xml': No such file or directory  
dpkg: error processing tomcat7 (--configure):  
 subprocess installed post-installation script returned error exit status 1  
No apport report written because MaxReports is reached already  

 >Errors were encountered while processing:  
 tomcat7  
E: Sub-process /usr/bin/dpkg returned an error code (1)

And I get this error when I try to apt-get remove Tomcat7:

Removing tomcat7 ...  
 * tomcat7 is not installed  
invoke-rc.d: initscript tomcat7, action "stop" failed.

How do I fix this to install Tomcat 7 correctly?

share|improve this question

closed as off-topic by Braiam, Seth Mar 15 at 0:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This describes a problem that can't be reproduced that seemingly went away on its own or was only relevant to a very specific period of time. It's off-topic as it's unlikely to help future readers." – Braiam, Seth
If this question can be reworded to fit the rules in the help center, please edit the question.

4  
Try to run a apt-get purge tomcat7 and reinstall it. See if it helps. I just wonder why you would like to use the deb package from official repository, for Tomcat, I'd rather download the binary and extract it (chown) and run as a normal user. If you want it to start during boot, there are plenty of options out there. –  Terry Wang Dec 14 '12 at 5:47
    
Running apt-get purge tomcat7 did not work. Whoever when I removed all the tomcat7 optional tomcat7 packages like tomcat7-admin, it finally worked. –  Hendre Dec 14 '12 at 10:17
    
Terry, I like the way the packaged version is installed on the file system. My tomcat configurations files are under /etc and my log files under /var/log etc. What I do not like about the package is it's dependency on OpenJDK, I prefer using the Oracle JDK. –  Hendre Dec 14 '12 at 10:19
1  
I understand your concern. To install Oracle JDK, there is an easy script on github, please check this out: askubuntu.com/questions/213583/… –  Terry Wang Dec 14 '12 at 10:54
    
i am smiling :) –  Hendre Dec 14 '12 at 13:34

3 Answers 3

I had error stated that tomcat7 is aready newer version. Steps :

  1. Uninstall tomcat7 using command sudo apt-get autoremove tomcat7.
  2. This uninstalls tomcat7 completely.
  3. Now install it using sudo apt-get install tomcat7.

It worked well with me, give it a try.

share|improve this answer
    
I don't see how this has anything to do with the question at hand. Could you maybe clarify? –  Seth Mar 11 at 22:28
    
@Seth : The question is tomcat7 installation fails using apt-get method, so I suggested the possible solution that I have tried and got desired result. If I have miss-understood this question, kindly let me know :) –  Pranav Karnik Mar 22 at 15:03

I had the exact the same problem.

I had to run this command (see below) to see what all tomcat related libraries are there and remove ALL the tomcat related libraries:

To see what all tomcat related libraries are there:

dpkg -l | grep -i tomcat

To remove a tomcat library:

dpkg -P <library-name>

Then, I reinstalled tomcat7 using the command:

sudo apt-get install tomcat7

[ During installation, it spit out messages saying it is going to install some of the other libraries related to tomcat7 - I chose - yes ].

It installed tomcat7 and started it.

Then, I stopped and restarted tomcat7 using these commands:

/etc/init.d/tomcat7 stop
/etc/init.d/tomcat7 start
share|improve this answer

Run the following commands:

sudo apt-get purge libtomcat7-java tomcat6 tomcat6-admin tomcat6-docs tomcat6-examples tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples tomcat7-user

sudo apt-get install tomcat7
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.