1

While installing Apache2 I am getting the following output:

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-bin (= 2.4.7-1ubuntu4.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Out put of apt-cache policy apache2 apache2-bin

apache2:
  Installed: (none)
  Candidate: 2.4.7-1ubuntu4.4
  Version table:
     2.4.7-1ubuntu4.4 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
apache2-bin:
  Installed: (none)
  Candidate: 2.4.7-1ubuntu4.4
  Version table:
     2.4.7-1ubuntu4.4 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages

How can I fix this?

I have tried the commands suggested by you. Output of apt-get upgrade -f

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic-lts-utopic linux-headers-generic-lts-utopic
  linux-image-generic-lts-utopic
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

No output for this command dpkg --get-selections | grep -i ^apache2

Output of code : apt-mark unhold apache2-bin

apache2-bin was already not hold.

Output of code: apt-cache depends apache2-bin

apache2-bin
  Depends: <libapr1>
  Depends: <libaprutil1>
 |Depends: <libaprutil1-dbd-sqlite3>
 |Depends: <libaprutil1-dbd-mysql>
 |Depends: <libaprutil1-dbd-odbc>
 |Depends: <libaprutil1-dbd-pgsql>
  Depends: <libaprutil1-dbd-freetds>
  Depends: <libaprutil1-ldap>
  Depends: libc6
  Depends: libldap-2.4-2
  Depends: libpcre3
  Depends: libssl1.0.0
  Depends: libxml2
  Depends: zlib1g
  Depends: perl
  Suggests: <www-browser>
    chromium-browser
    firefox
    konqueror
  Suggests: apache2-doc
 |Suggests: apache2-suexec-pristine
  Suggests: apache2-suexec-custom
  Conflicts: apache2.2-bin
  Conflicts: apache2.2-bin:i386
  Conflicts: <apache2.2-common>
  Conflicts: <apache2.2-common:i386>
  Breaks: libapache2-mod-macro
  Breaks: libapache2-mod-macro:i386
  Breaks: libapache2-mod-proxy-html
  Breaks: libapache2-mod-proxy-html:i386
  Replaces: apache2-mpm-event
  Replaces: apache2-mpm-event:i386
  Replaces: apache2-mpm-itk
  Replaces: apache2-mpm-itk:i386
  Replaces: apache2-mpm-prefork
  Replaces: apache2-mpm-prefork:i386
  Replaces: apache2-mpm-worker
  Replaces: apache2-mpm-worker:i386
  Replaces: apache2.2-bin
  Replaces: apache2.2-bin:i386
  Replaces: <apache2.2-common>
  Replaces: <apache2.2-common:i386>
  Replaces: libapache2-mod-macro
  Replaces: libapache2-mod-macro:i386
  Replaces: libapache2-mod-proxy-html
  Replaces: libapache2-mod-proxy-html:i386
  Conflicts: apache2-bin:i386

But it is not resolved.

bummi
  • 394
  • 3
  • 9
  • 14

1 Answers1

0

As you maybe know, you can pin packages to their current versions. That's done by giving the package the status "hold". For example, if you have installed version 1.1 of some package and set this package to status "hold", it won't get updated, even when version 1.2 or later become available.

In your case it seems there are one or more packages set to "hold". That prohibits apt-get from resolving some dependencies when you try to install apache2. Say, for example, you pinned apache2-bin at a version earlier than 2.4.7-1ubuntu4.4. Then you try to install apache2 in version 2.4.7-1ubuntu4.4. apache2 2.4.7-1ubuntu4.4 depends on apache2-bin 2.4.7-1ubuntu4.4, so apt-get tries to resolve this dependency by installing apache2-bin 2.4.7-1ubuntu4.4 as well. But it can't do so, because apache2-bin is on status "hold" for a previous version. So, apt-get tells you "Unable to correct problems, you have held broken packages."

That's just one of the possible scenarios, but it should give you an idea where your problem probably lies.

There are two ways you can try: One possibility is, have apt-get have a try at the problem. This should get you some solution, but not necessary the one you're looking for. The command to have apt-get try and fix the mess would be

apt-get upgrade -f

The -f is for "fix broken" or rather, "try to fix the broken things".

The other possibility is to look for the pinned package yourself and "un-pin" it. That's more work, but I'd be more comfortable with it compared to telling to apt-get "just do something to make it right" ;)

You can get the stati of all installed packages with

dpkg --get-selections

To filter those of interest, you can just grep for the names, say

dpkg --get-selections | grep -i ^apache2

That should give you something like

apache2                     install
apache2-bin                 install
apache2-data                install
apache2-doc                 install

I'd assume one or more of the packages related to Apache are "on hold". You can change the status of a package by

# set a package to status "hold"
apt-mark hold somepackage
# for example
apt-mark hold apache2-bin

# remove status "hold" from a package
apt-mark unhold somepackage
# for example
apt-mark unhold apache2-bin

The package that's "holding things up" may be apache2-bin itself, or another package that apache2-bin depends on. You can check which packages a package depends on by

apt-cache depends somepackage

for example

apt-cache depends apache2-bin