1

The apache2 package was broken on my debian server, so I started by uninstalling all apache2 related package. Now everything seems to be uninstalled properly.

dpkg -l | grep 'apache' doesn't return anything

However, I can't seem to be able to install apache2...

With apt-get:

sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 apache2 : Depends: apache2-mpm-worker (= 2.2.22-13+deb7u6) but it is not going to be installed or
                    apache2-mpm-prefork (= 2.2.22-13+deb7u6) but it is not going to be installed or
                    apache2-mpm-event (= 2.2.22-13+deb7u6) but it is not going to be installed or
                    apache2-mpm-itk (= 2.2.22-13+deb7u6) but it is not going to be installed
           Depends: apache2.2-common (= 2.2.22-13+deb7u6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

And with aptitude:

sudo apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 apache2 : Depends: apache2-mpm-worker (= 2.2.22-13+deb7u6) but it is not going to be installed or
                    apache2-mpm-prefork (= 2.2.22-13+deb7u6) but it is not going to be installed or
                    apache2-mpm-event (= 2.2.22-13+deb7u6) but it is not going to be installed or
                    apache2-mpm-itk (= 2.2.22-13+deb7u6) but it is not going to be installed
           Depends: apache2.2-common (= 2.2.22-13+deb7u6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@dora:~# sudo aptitude install apache2
The following NEW packages will be installed:
  apache2 apache2-mpm-worker{a} apache2-utils{a} apache2.2-bin{a} apache2.2-common{a} libaprutil1-dbd-sqlite3{ab} libaprutil1-ldap{ab} 
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 1 290 kB of archives. After unpacking 5 146 kB will be used.
The following packages have unmet dependencies:
 libaprutil1-dbd-sqlite3 : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed.
 libaprutil1-ldap : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     apache2 [Not Installed]                            
2)     apache2-mpm-worker [Not Installed]                 
3)     apache2.2-bin [Not Installed]                      
4)     apache2.2-common [Not Installed]                   
5)     libaprutil1-dbd-sqlite3 [Not Installed]            
6)     libaprutil1-ldap [Not Installed]                   



Accept this solution? [Y/n/q/?] Y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

How can I solve this issue and get Apache to work again?


Edit to answer Martin:

cat /etc/apt/sources.list
deb http://debian.mirrors.ovh.net/debian/ wheezy main
deb-src http://debian.mirrors.ovh.net/debian/ wheezy main

deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main

deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all

deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all

deb http://security.debian.org/ testing/updates main
deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main

deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.6
deb-src http://repo.mysql.com/apt/debian/ wheezy mysql-5.6

deb http://dl.google.com/linux/mod-pagespeed/deb/ stable main

And finally:

apt-cache policy libaprutil1
libaprutil1:
  Installed: 1.5.4-1+b1
  Candidate: 1.5.4-1+b1
  Version table:
 *** 1.5.4-1+b1 100
        100 /var/lib/dpkg/status
     1.4.1-3 500
        500 http://debian.mirrors.ovh.net/debian wheezy/main amd64 Packages
3

According to aptitude, an Apache dependency called libaprutil1 is installed in a newer version than what is avaible from the repositories:

The following packages have unmet dependencies: 
libaprutil1-dbd-sqlite3 : Depends: libaprutil1 (= 1.4.1-3) but
1.5.4-1+b1 is installed.  libaprutil1-ldap : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed.

You can try to figure out the source of this package with apt-cache policy:

apt-cache policy libaprutil1

libaprutil1=1.5.4-1+b1 seems to come from Debian sid... did you by any chance try to install Apache from the sid repositories? That doesn't seem to be a good idea... if you want a newer Apache version, I'd recommend to upgrade to Debian jessie.

Please append the output from apt-cache policy to your question (and while you're at it, also the output from cat /etc/apt/sources.list); it is possible that your sources.list contains URLs from both the wheezy and the sid repositories, which would be a bad thing.

You can try to remove the newer libaprutil1 package:

aptitude purge libaprutil1

And then try to install Apache again:

aptitude install apache2
  • Right now I don't care the Apache version as long as it's working... Added more info in the question. Let me know if you have any comment concerning the content of my sources.list – fkoessler Jun 16 '16 at 17:44
  • As I suspected - you're mixing packages from different Debian versions. deb http://security.debian.org/ testing/updates main is Debian 9.x stretch, but the rest of your sources.list is Debian 7.x wheezy. Using codenames like testing or stable is a very bad idea, and mixing Debian versions is even worse. I don't know how to repair this; I'd recommend to reinstall. – Martin von Wittich Jun 16 '16 at 18:02
3

libaprutil1 is the package causing issues (and most likely its dependency, libapr1). You need to:

  • remove the testing/security line from your /etc/apt/sources.list;
  • update the package caches:

    sudo apt-get update
    
  • remove libaprutil1 and libapr1:

    sudo aptitude remove libaprutil1 libapr1
    

    (and any package that depends on them)

  • then install apache2:

    sudo aptitude install apache2
    
  • At this point, I'd suspect that libaprutil1 isn't the only package isn't the only broken package... – Martin von Wittich Jun 16 '16 at 18:43
  • Looking at the dependency tree, libapr1 is presumably involved as well, but probably not much else. – Stephen Kitt Jun 16 '16 at 19:14
  • Purging liaprutil1 did the trick, I was then able to install the apache2 package. – fkoessler Jun 17 '16 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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