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:  
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?

  • 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, 2012 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.
    – Hendré
    Dec 14, 2012 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.
    – Hendré
    Dec 14, 2012 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, 2012 at 10:54
  • i am smiling :)
    – Hendré
    Dec 14, 2012 at 13:34

3 Answers 3


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

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.

  • I don't see how this has anything to do with the question at hand. Could you maybe clarify?
    – Seth
    Mar 11, 2014 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 :) Mar 22, 2014 at 15:03

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

Not the answer you're looking for? Browse other questions tagged .