New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Apache is installed task failed #247

Closed
ravbaba opened this Issue Sep 19, 2015 · 19 comments

Comments

Projects
None yet
9 participants
@ravbaba
Copy link

ravbaba commented Sep 19, 2015

I get the error for the ansible task "Ensure Apache is installed":

failed: [drupalvm] => (item=apache2,apache2-utils) => {"failed": true, "item": "apache2,apache2-utils"} stderr: dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb (--unpack): error setting ownership of /var/www/html.dpkg-new': Operation not permitted
Errors were encountered while processing: /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)`

I am using:

  • ubuntu 15.04
  • ansible 1.9.3
  • vagrant 1.7.4
  • virtualbox 5.0.4
@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Sep 19, 2015

@ravbaba - It's likely your shared directory is not configured correctly; can you post the shared folders section, and the apache vhosts section, of your config.yml?

@ravbaba

This comment has been minimized.

Copy link
Author

ravbaba commented Sep 19, 2015

vagrant_synced_folders:
  - local_path: ~/Projects/drupalvm
    destination: /var/www
    id: drupal
    type: nfs
    create: true
apache_vhosts:
  - servername: "{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"

  - servername: "xhprof.drupalvm.dev"
    documentroot: "/usr/share/php/xhprof_html"

  - servername: "pimpmylog.drupalvm.dev"
    documentroot: "/usr/share/php/pimpmylog"
@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Sep 19, 2015

Ah, sorry, one more thing too - what's the drupal_core_path set to?

And I guess one more thing—are you using the geerlingguy.ubuntu1404 base box or something else?

@ravbaba

This comment has been minimized.

Copy link
Author

ravbaba commented Sep 19, 2015

drupal_core_path: "/var/www/drupal"

@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Sep 19, 2015

@ravbaba - Just for a quick test, can you remove the type: nfs line from the synced folder configuration, then do a vagrant reload --provision, and see if it works?

@ravbaba

This comment has been minimized.

Copy link
Author

ravbaba commented Sep 19, 2015

@geerlingguy - it works when I remove the line. It looks like nfs configuration on my ubuntu machine is not correct because it works on my mac with nfs.

@devekko

This comment has been minimized.

Copy link

devekko commented Oct 7, 2015

me too on trusty

@devekko

This comment has been minimized.

Copy link

devekko commented Oct 7, 2015

I think it might be something related to nfs etc/exports not being handled properly i.e. removed after a failed attempt, such as the ansible playbooks force requirements gotcha

@alb404

This comment has been minimized.

Copy link

alb404 commented Oct 28, 2015

Hi.
I had the same problem as ravbaba and fixed it by installing Guest Additions to Virtualbox.
See: http://askubuntu.com/questions/22743/how-do-i-install-guest-additions-in-a-virtualbox-vm (Installing Guest Additions from a Terminal)

@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Oct 28, 2015

Can everyone who's having this issue also look at @nateswart's blog post on the topic and see if it helps? https://nateofnine.com/2015/10/25/drupalvm-nfs-on-ubuntu/

@lilswif

This comment has been minimized.

Copy link

lilswif commented Nov 1, 2015

@geerlingguy followed the steps in the link you mentioned, and still having this problem.
Running the same setup as the opener of this issue.

Part of my error message:

msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"   install 'apache2' 'apache2-utils'' failed: perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:",
    LC_ALL = (unset),
    LC_TIME = "de_BE.UTF-8",
    LC_MONETARY = "de_BE.UTF-8",
    LC_CTYPE = "C",
    LC_ADDRESS = "de_BE.UTF-8",
    LC_TELEPHONE = "de_BE.UTF-8",
    LC_NAME = "de_BE.UTF-8",
    LC_MEASUREMENT = "de_BE.UTF-8",
    LC_IDENTIFICATION = "de_BE.UTF-8",
    LC_NUMERIC = "de_BE.UTF-8",
    LC_PAPER = "de_BE.UTF-8",
    LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb (--unpack):
 error setting ownership of `/var/www/html.dpkg-new': Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
@nateswart

This comment has been minimized.

Copy link

nateswart commented Nov 1, 2015

One thing I (finally) figured out is that if you have encryption turned on for your home folder NFS to the VM won't work. I realized I didn't call very much attention to it in that blog post so it's easy to miss.

@oxyc

This comment has been minimized.

Copy link
Collaborator

oxyc commented Nov 1, 2015

@lilswif is there a line that begins with AcceptEnv LANG in /etc/ssh/sshd_config? Looks like you're passing your locale to the VM while this should have been prevented in #186

Edit:
Just realised that task runs too late to be effective on the initial provisioning. @geerlingguy any ideas how to prevent it on the initial provisioning already? pre_tasks won't work as the variable is already present. Guess we could reset it... If we moved it here it would work if the user just re-ran vagrant provision at least.

@lilswif to get it working ASAP you can follow the suggestions @geerlingguy linked to in the other issue.

@lilswif

This comment has been minimized.

Copy link

lilswif commented Nov 3, 2015

still getting a error (see below) after trying:

  • changing the locale settings (did change the error tough, tnx @oxyc )
  • unencrypt my home folder
  • manually create /var/www/html folder
  • Setting the vagrant_synced_folders > destination argument to ie. /var/www/drupalvm
ailed: [drupalvm] => (item=apache2,apache2-utils) => {"failed": true, "item": "apache2,apache2-utils"}
stderr: dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb (--unpack):
 error setting ownership of `/var/www/html.dpkg-new': Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

stdout: Reading package lists...
Building dependency tree...
Reading state information...
apache2-utils is already the newest version.
The following packages were automatically installed and are no longer required:
  libyaml-0-2 python-crypto python-httplib2 python-jinja2 python-markupsafe
  python-paramiko python-pkg-resources python-support python-yaml sshpass
Use 'apt-get autoremove' to remove them.
Suggested packages:
  www-browser apache2-doc apache2-suexec-pristine apache2-suexec-custom
The following NEW packages will be installed:
  apache2
0 upgraded, 1 newly installed, 0 to remove and 35 not upgraded.
6 not fully installed or removed.
Need to get 0 B/144 kB of archives.
After this operation, 451 kB of additional disk space will be used.
(Reading database ... 63480 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb ...
Unpacking apache2 (2.4.16-4+deb.sury.org~trusty+4) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...

msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"   install 'apache2' 'apache2-utils'' failed: dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb (--unpack):
 error setting ownership of `/var/www/html.dpkg-new': Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/apache2_2.4.16-4+deb.sury.org~trusty+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Nov 3, 2015

Does the fix suggested in #85 (comment) fix the issue for anyone in this thread?

@kporras07

This comment has been minimized.

Copy link

kporras07 commented Nov 3, 2015

provisioning without nfs:true line works for me. Then, I add back that line and everything works ok.

@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Nov 8, 2015

In that case, it looks like the problem is basically that the html folder needs to be created for Apache to work correctly, but it is not. I'm testing things on some Linux flavors this week, and ran into this problem myself. It looks like the same fix for #85 worked here:

  1. (On your host) Create the folder html inside the synced folder directory (by default ~/Sites/drupalvm).
  2. Run vagrant provision again.

I'm going to look into a better way to make sure this issue doesn't occur on a fresh install, though. One other solution is to set your synced folder directory to something like ~/Sites/drupalvm/example or something like that (I think, haven't tested personally).

@jygastaud

This comment has been minimized.

Copy link

jygastaud commented Nov 11, 2015

@geerlingguy You're right, html folder is needed and automaticaly created by Apache.

Using a subfolder inside /var/www solved that issue and no need to create /var/www/html.

Default should recommand something like that

vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # build_makefile: is 'true'.
  - local_path: ~/Sites/drupalvm
    destination: /var/www/drupalvm
    type: nfs
    create: true

@geerlingguy geerlingguy removed the docs label Nov 11, 2015

@geerlingguy

This comment has been minimized.

Copy link
Owner

geerlingguy commented Nov 11, 2015

Fixed via the above commit, which updates the included example.config.yml and makes it so the default site is generated inside a subdir of the /var/www directory instead of having the synced folder take over that directory completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment