1

I need to install apache2 on my ubuntu system. On running the command:

sudo apt-get install apache2

I get this error:

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 : PreDepends: dpkg (>= 1.17.14)
E: Unable to correct problems, you have held broken packages.

I checked out other similar questions and tried to do this:

sudo apt-get install -f
sudo dpkg --purge --force-depends "apache*"
sudo apt-get install apache2

But the second command says:

sudo dpkg --purge --force-depends "apache*"
dpkg: error: --purge needs a valid package name but 'apache*' is not: illegal package name in specifier 'apache*': character `*' not allowed (only letters, digits and characters `-+._')

I surfed more and some people say this might be due to php7 installed. I don't understand why that would be so and can't resolve this error. Please help

EDIT: Output of lsb_release -a; uname -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty
Linux myprecious 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I have that candidate and one more latest one:

2.4.12-2 0 500 ppa.launchpad.net/cybersec/chaos-ppa-v2/ubuntu trusty/main amd64 Packages
  • sudo apt-get purge apache2; sudo apt-get autoremove – A.B. Apr 10 '16 at 12:22
  • It says : Package 'apache2' is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 108 not upgraded. – lee huang Apr 10 '16 at 12:24
  • Edit your question and add the output of lsb_release -a; uname -a – A.B. Apr 10 '16 at 12:25
  • and the output of apt-cache policy apache2 – A.B. Apr 10 '16 at 12:26
  • Are you using any third-party package repositories, other than those that came with Ubuntu 14.04? It seems it tries to install a version of the apache2 package that has dependencies your system can't meet. Use apt-cache policy apache2 to see which version of apache2 from which repository you're trying to install. On 14.04, it should be something containing Candidate: 2.4.7-1ubuntu4.9 and 500 http://de.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages. – Henning Kockerbeck Apr 10 '16 at 12:28
3

The package apache2 in your enabled third-party repository needs the package dpkg in version 1.17.14 or higher. This version is not available for Trusty. For this reason, install the official apache2 package for Trusty, currently version 2.4.7-1ubuntu4.9.

And as you can see in the output of apt-cache policy

2.4.12-2 0 500 ppa.launchpad.net/cybersec/chaos-ppa-v2/ubuntu trusty/main amd64 Packages

your third-party PPA is https://launchpad.net/~cybersec/+archive/ubuntu/chaos-ppa-v2

Purge it with

sudo ppa-purge ppa:cybersec/chaos-ppa-v2

and install apache2

sudo apt-get install apache2
  • How do I install official package? Is there a separate command for that or do I download and install it? – lee huang Apr 10 '16 at 12:31
  • Answer updated. – A.B. Apr 10 '16 at 12:36
  • Thanks a lot. It worked. Have wasted my entire morning on it. Can you please tell (or point me to some documentation) how I can get to know that some error is ppa error; which ppa is causing it and so on. – lee huang Apr 10 '16 at 12:45
  • The line 2.4.12-2 0 500 ppa.launchpad.net/cybersec/chaos-ppa-v2/ubuntu trusty/main amd64 Packages in the output of apt-cache policy apache2 says all you need. – A.B. Apr 10 '16 at 12:47
  • This answer helped me. Now I was able to install apache2 :) – xdevs23 Apr 25 '16 at 16:22

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.