0

I've installed ppa:ondrej/php5 (in order to use latest PHP 5.5) in Ubuntu 14.04 LTS, but it also includes apache2 package, which causes me unable to install apache2-mpm-worker:

$ sudo apt-get install apache2-mpm-worker
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-mpm-worker : Depends: apache2 (= 2.4.12-1+deb.sury.org~trusty+5) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

And when you use apt-cache policy to check, you will find out apache2 has been replaced by PPA:

$ apt-cache policy apache2
apache2:
  Installed: (none)
  Candidate: 2.4.16-3+deb.sury.org~trusty+1
  Version table:
     2.4.16-3+deb.sury.org~trusty+1 0
        500 http://ppa.launchpad.net/ondrej/php5/ubuntu/ trusty/main amd64 Packages
     2.4.7-1ubuntu4.5 0
        500 http://tw.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     2.4.7-1ubuntu4 0
        500 http://tw.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

So I setup apt pin in /etc/apt/preferences to its lower priority:

#
Package: apache2
Pin: origin "ppa.launchpad.net"
Pin-Priority: 1

But not working:

$ apt-cache policy apache2
apache2:
  Installed: (none)
  Candidate: 2.4.16-3+deb.sury.org~trusty+1
  Package pin: 2.4.16-3+deb.sury.org~trusty+1
  Version table:
     2.4.16-3+deb.sury.org~trusty+1 1
        500 http://ppa.launchpad.net/ondrej/php5/ubuntu/ trusty/main amd64 Packages
     2.4.7-1ubuntu4.5 1
        500 http://tw.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
     2.4.7-1ubuntu4 1
        500 http://tw.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Same results with release o=LP-PPA-ondrej-php5 and version 2.4.16-*. I would like to know how to do apt pin correctly ?

1 Answer 1

2

I think the package you want to install is obsoleted and left on the PPA repository. This is the first problem there.

The source package can generate multiple binary packages at once. For example, the source package of apache2 consists of multiple packages including apache2, apache2-bin, apache2-dbg, apache2-dev, apache2-mpm-worker, apache2-mpm-prefork, apache2-mpm-event... and so forth. It's reasonable for they all share the same version number to depends each other.

In your case, you want to install the apache2-mpm-worker 2.4.12-1 package, but it is missing apache2 (2.4.12-1). Why? Because the upstream has removed all the transitional packages including apache2-mpm-worker.

apache2 (2.4.12-2) unstable; urgency=medium

  [ Jean-Michel Nirgal Vourgère ]
  * d/control:
    + Update Vcs-Browser.
  * d/copyright:
    + Change d/debhelper/dh_apache2 to dh_apache2.in.
    + Drop paragraph about inexistant itk patches.

  [ Stefan Fritsch ]
  * Remove all the transitional packages:
    apache2-mpm-worker, apache2-mpm-prefork, apache2-mpm-event,
    apache2-mpm-itk, apache2.2-bin, apache2.2-common,
    libapache2-mod-proxy-html, libapache2-mod-macro, apache2-suexec
    This also fixes the dependency problems caused by a recent version
    of debhelper (see #784803).

The newest version of apache2 (2.4.16-3) has already built on PPA repository. You can't have two different versions in one repository, so apache2_2.4.12-1 is superseded by apache2_2.4.16-3. This is a known limitation of apt; since PPA is an apt repository, it has this limitation too.

Therefore, package apache2_2.4.12-1, the dependencies of apache2-mpm-worker_2.4.12 is missing. This is why that your installation was broken according to your description.

The following packages have unmet dependencies:
 apache2-mpm-worker : Depends: apache2 (= 2.4.12-1+deb.sury.org~trusty+5) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I think you already have apache2_2.4.16-3 installed. The following steps is the new approach to change MPM to worker:

$ a2enmod mpm_worker

Considering conflict mpm_event for mpm_worker:

Considering conflict mpm_prefork for mpm_worker:

ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!

$ a2dismod mpm_prefork

Could not remove /etc/apache2/mods-enabled/mpm_prefork.load: Permission denied

$ sudo a2dismod mpm_prefork

Module mpm_prefork disabled.

To activate the new configuration, you need to run:

service apache2 restart

$ sudo a2enmod mpm_worker

Considering conflict mpm_event for mpm_worker:

Considering conflict mpm_prefork for mpm_worker:

Enabling module mpm_worker.

To activate the new configuration, you need to run:

service apache2 restart

$ sudo service apache2 restart
  • Restarting web server apache2 ...done.

$ apache2ctl status

Can't create config directory (/.w3m)!Apache Server Status for localhost (via 127.0.0.1)

Server Version: Apache/2.4.16 (Ubuntu)
Server MPM: worker
Server Built: 2015-08-18T00:00:00

-------------------------------------------------------------------------------

Current Time: Thursday, 20-Aug-2015 07:20:23 UTC
Restart Time: Thursday, 20-Aug-2015 07:19:38 UTC
Parent Server Config. Generation: 1
Parent Server MPM Generation: 0
Server uptime: 44 seconds
Server load: 0.00 0.01 0.05
Total accesses: 0 - Total Traffic: 0 kB
CPU Usage: u0 s0 cu0 cs0
0 requests/sec - 0 B/second -
1 requests currently being processed, 49 idle workers

_____W____________________________________________..............
................................................................
......................

Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process

Back to the problem of apt preferences. Your configuration seems good to me, but it doesn't work as expected. This is the interesting part to me. After doing some digging, it changes my mind for my past experience of apt. It could be some lack of feature or buggy for pinning particular package.

1

You must log in to answer this question.

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