tuk
tuk

Reputation: 6852

Not able to install apache2 on Ubuntu 14.04

I am not able to install apache2 on Ubuntu 14.04.

On executing

sudo apt-get install apache2 getting the below error:-

The following packages have unmet dependencies:
 apache2 : Depends: apache2-bin (= 2.4.7-1ubuntu4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

As mentioned in the link I tried doing apt-get upgrade -f.

Also the output of dpkg --get-selections | grep -i ^apache2

apache2                     deinstall
apache2-doc                 install
apache2-utils                   install
apache2.2-common                deinstall

Output of apt-mark unhold apache2-bin apache2-bin was already not hold

Output of apt-cache depends apache2

apache2
  Depends: lsb-base
  Depends: procps
    procps:i386
  Depends: perl
  Depends: mime-support
  Depends: apache2-bin
  Depends: apache2-data
  Suggests: <www-browser>
    arora
    dillo
    dwb
    lynx-cur:i386
    lynx-cur
    netsurf
    netsurf-fb
    netsurf-gtk
    uzbl
    chimera2
    chromium-browser
    elinks
    epiphany-browser
    firefox
    google-chrome-beta
    google-chrome-stable
    google-chrome-unstable
    konqueror
    links
    links2
    midori
    netrik
    rekonq
    surf
    w3m:i386
    w3m
    xemacs21-mule
    xemacs21-mule-canna-wnn
    xemacs21-nomule
 Suggests: apache2-doc
 |Suggests: apache2-suexec-pristine
  Suggests: apache2-suexec-custom
  Suggests: ufw
  Suggests: apache2-utils
    apache2-utils:i386
  Recommends: ssl-cert
  Conflicts: apache2.2-common
  Conflicts: <apache2.2-common:i386>
  Replaces: apache2.2-common
  Replaces: <apache2.2-common:i386>
  Conflicts: apache2:i386

Output of apt-cache policy apache2 apache2-bin

apache2:
  Installed: (none)
  Candidate: 2.4.7-1ubuntu4
  Version table:
     2.4.16-4+deb.sury.org~precise+4 0
        100 /var/lib/dpkg/status
     2.4.7-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
apache2-bin:
  Installed: (none)
  Candidate: 2.4.7-1ubuntu4
  Version table:
     2.4.7-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Output of sudo aptitude -f install apache2

The following NEW packages will be installed:
  apache2 apache2-bin{a} apache2-data{a} libaprutil1-dbd-sqlite3{ab} libaprutil1-ldap{ab} 
0 packages upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 1,106 kB of archives. After unpacking 4,703 kB will be used.
The following packages have unmet dependencies:
 libaprutil1-dbd-sqlite3 : Depends: libaprutil1 (= 1.5.3-1) but 1.5.4-1+deb.sury.org~precise+1 is installed.
 libaprutil1-ldap : Depends: libaprutil1 (= 1.5.3-1) but 1.5.4-1+deb.sury.org~precise+1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     apache2 [Not Installed]                            
2)     apache2-bin [Not Installed]                        
3)     libaprutil1-dbd-sqlite3 [Not Installed]            
4)     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 1 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

Can some one help what is going wrong?

Upvotes: 6

Views: 14637

Answers (6)

Sakis
Sakis

Reputation: 911

It can happen when your system has dependencies with different versions than the required. In my case, i removed the dependencies and then installed.

sudo apt-get purge apache2-bin

and then:

sudo apt-get install apache2

Upvotes: 0

Diwas Pandey
Diwas Pandey

Reputation: 1

I have recently solved this issue.

----------------issue-----------------------
The following packages have unmet dependencies:
apache2 : Depends: apache2-bin (= 2.4.7-1ubuntu4) but 2.4.29-1ubuntu4.1 is to be installed
E: Unable to correct problems, you have held broken packages.
-------------------------------------------------------------------

First, remove the apache2-bin from the ubuntu as

sudo apt-get --purge remove apache2-bin 

now install apache-bin2

sudo apt install apache2

Upvotes: 0

Favian Ioel P
Favian Ioel P

Reputation: 312

I had the same problem and I solved it with this commands

sudo apt-get -f autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

than try again :

sudo apt-get install apache2

Upvotes: 2

Meetai.com
Meetai.com

Reputation: 6928

When asked, don't accept the given solution so that aptitude, next, offer an alternative where it will install apache-bin which is the unmet dependency as the error shows.

Upvotes: 0

vaim
vaim

Reputation: 246

I face the similar problem when upgrading Ubuntu 12.04.x to 14.04.x with custom PPA that used to upgrade PHP5 previously.

I trace into the problem and found the package that having problem which is libaprutil1.

I try the following and it fixes my issue

apt-get remove libaprutil1
apt-get autoremove
apt-get install apache2

Hope it helps !

Upvotes: 23

mwatzer
mwatzer

Reputation: 864

Hey i had the same problem about months ago!
Try this:

apt-get --purge remove apache2
apt-get autoremove
rm -rf /etc/apache2/
apt-get clean
apt-get update

After that you can try to install it again.

I hope this helps :-)

Upvotes: 1

Related Questions