hashbangcode / vlad

Vlad - Vagrant LAMP Ansible Drupal
173 stars 53 forks source link

Apache restart fails on Ubuntu 12 #325

Closed dixhuit closed 7 years ago

dixhuit commented 8 years ago

Straight off the back of #317 we now seem to be experiencing some issues restarting Apache on Ubuntu 12 (current dev branch only):

NOTIFIED: [restart apache2] ***************************************************
failed: [192.168.100.100] => {"failed": true}
msg: Output of config test was:
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/authz_default.load: Cannot load /usr/lib/apache2/modules/mod_authz_default.so into server: /usr/lib/apache2/modules/mod_authz_default.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
zxaos commented 8 years ago

So interestingly, if I manually uninstall all apache packages and try to provision again, it yells about unmet dependencies:

The following packages have unmet dependencies:
 apache2-mpm-prefork : Depends: apache2.2-common (= 2.2.22-1ubuntu1.10) but it is not going to be installed
                       Depends: apache2.2-bin (= 2.2.22-1ubuntu1.10) but it is not going to be installed

The base apache2 package it's trying to install (from debian_apache.yml ) is actually 2.4.16 for me.

However. My guess is that that's because I ran an apt-get update after shelling in, which would explain why it may have provisioned correctly the first time.

zxaos commented 8 years ago

Ok, this appears to be related to the apache2 package being provided by the ondrej php5 ppa, but not including other package requirements and configuration for it.

So we get apache2.4, but apache2.2 support modules, including the defunct-in-2.4 authz_default, which breaks everything.

root@vlad:/etc/apt/sources.list.d# apt-cache policy apache2
apache2:
  Installed: (none)
  Candidate: 2.4.16-4+deb.sury.org~precise+4
  Version table:
     2.4.16-4+deb.sury.org~precise+4 0
        500 http://ppa.launchpad.net/ondrej/php5/ubuntu/ precise/main amd64 Packages
     2.2.22-1ubuntu1.10 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     2.2.22-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Edit: Pinning the package to ubuntu's version doesn't work either. It lets apache install as expected, but then fails in the PHP package, where it is expecting the new version of authz.

failed: [192.168.100.183] => {"failed": true}
msg: Output of config test was:
AH00526: Syntax error on line 9 of /etc/apache2/mods-enabled/php5.conf:
Invalid command 'Require', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
richierampage commented 8 years ago

I'm getting this on master branch too on fresh vm with VMware provider and Ubuntu12. I then vagrant destroyed, removed .vagrant directory, tried again, same error. Weird, I haven't even checked out dev version.

Any ideas why master is affected by this? I can't figure it out!

 apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: 
 Syntax error on line 1 of /etc/apache2/mods-enabled/authz_default.load: 
 Cannot load /usr/lib/apache2/modules/mod_authz_default.so into server: 
zxaos commented 8 years ago

VMWare setups were using bento/ubuntu-12.04 a while before this got merged, #317 just brought everything else to the same base boxes.

Which probably means this was a previously exiting issue that had not been reported.

We're loading apache from the ondrej ppa. I'm wondering if maybe we need to either tweak the role order so that apache 2.4 installs from ondrej before PHP is installed? My current theory is that it's just the old default config files from the 2.2 install that are causing problems and that clean installing 2.4 might not have the issue. Unfortunately I can't investigate at this moment.

richierampage commented 8 years ago

Thanks for your response zxaos, makes sense. I'll post here if I get any way to fixing it.

zxaos commented 8 years ago

Updates on the actual issue

Updates on this issue: The mpm-prefork issue is due to upstream no longer having an apache2-mpm-prefork package - it was transitional and is now gone. apache2-utils should be sufficient.

@danbohea and @philipnorton42 : we have a chicken and egg situation here. The PHP role requires apache2 to already be installed, but if we're using the php5 PPA it bumps apache from 2.2 to 2.4, causing the configuration to break as we're seeing here, because that PPA includes apache 2.4 and assumes you're using it. Which is a correct assumption on 14.04, which is why it's not exhibiting the problem.

It might be simplest to just universally bump apache to 2.4 on 12.04 hosts, because then we're avoiding the situation entirely but I don't know what the policy is on sticking close to the versions that come out of the releases directly. It would definitely mean adding another PPA.

The alternative seems like it would be to add some additional detection code in the apache role that duplicates some of the php role's logic so I can make a decision about which version of apache to install, and in that case you'd only be installing the PPA when you're running php 5.4 or higher.

Discussion of support lifetimes

A related point is a discussion of how far back you want to support various versions. PHP 5.3 and 5.4 are already unsupported, and that php 5.5 has already fallen into the security-fixes-only category, which is itself ending in six months. There's probably a related discussion to be had about distros too, with Ubuntu 12.04 still has another year and a bit left at least, but 16.04 arriving this quarter.

Thoughts?

dixhuit commented 8 years ago

@zxaos Fantastic work! Thanks for explaining that so clearly.

For the time being, my preference would be to borrow from the PHP's role's logic as suggested in order to only install the PPA if required. Sticking close to versions associated with releases is important where possible, so long as it doesn't create a huge maintenance problem for us.

On the broader topic of support lifetimes, I'm tempted to suggest that Vlad only attempt to support up to 2 Ubuntu LTS releases at any one time and that as soon as we deem 16.04 viable in terms of all of Vlad's other moving parts we introduce it and in turn drop 12.04. The only practical basis for this suggestion is maintenance/support: we only have so much time between us and that has to be a driving factor. Perhaps one day we'll have more active contributors and/or Vlad's codebase will be able to more easily cope with more distro releases but for the time being 2 sounds like plenty :)

@philipnorton42?

zxaos commented 8 years ago

Ok, so if we want to introduce some dependent configuration between those two roles, my gut reaction would be to break the PHP version detection code and PPA configuration out of the PHP role and create a support role that both debian_apache and debian_php depend on to minimize duplication.

Additionally, I'll need to examine behaviour related to changing the PHP version after VM creation, since we'll need to find purge apache configuration files if upgrading from 2.2 to 2.4.

dixhuit commented 8 years ago

I'm starting to wonder whether we should just drop support for Ubuntu 12 now.

The case from my perspective:

Thoughts?

zxaos commented 8 years ago

I self-interestedly vote for closing this since it's assigned to me :wink:

I think the time's better spent getting 16.04 stuff working now that the beta builds are out.

ArjitaMitra commented 8 years ago

so have you resolved the problem ? I am facing same issue. I tried to upgrade php 5.3 to php 5.5 . My php version is PHP 5.5.32 and apache version is 2.4.16. My localhost,virtualhost nothing works anymore. Whenever I am trying to restart apache I am getting error -

dixhuit commented 8 years ago

@ArjitaMitra It's very likely that we're just going to remove Ubuntu 12 support. If you wish to run PHP 5.5 I suggest you use Ubuntu 14 (which is the default OS in Vlad anyway).

philipnorton42 commented 7 years ago

This is now no longer "likely" it's a certainty :) Ubuntu12 support has been removed in favour of adding in ubuntu16. I also didn't want to add lots of complex overrides and conditionals to the playbooks.