Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Fix composer create-project setup 'mkdir permission denied' #726

Closed
geerlingguy opened this issue Jun 13, 2016 · 36 comments
Closed

Fix composer create-project setup 'mkdir permission denied' #726

geerlingguy opened this issue Jun 13, 2016 · 36 comments
Labels
Milestone

Comments

@geerlingguy
Copy link
Owner

Whenever I vagrant up now, I get the following failure:

TASK [Generate Drupal project with composer package.] **************************
fatal: [drupalvm]: FAILED! => {"changed": true, "cmd": ["/usr/bin/composer", "create-project", "drupal-composer/drupal-project:8.x-dev", "/var/www/drupalvm/drupal", "--prefer-dist", "--stability", "dev", "--no-interaction"], "delta": "0:00:03.428069", "end": "2016-06-13 03:02:25.872337", "failed": true, "rc": 1, "start": "2016-06-13 03:02:22.444268", "stderr": "    1/1:\thttp://packagist.org/p/provider-latest$99c8aeb55e32bf987ca6e026182602dfcbcdca16142de9811c4725a77febf131.json\n    Finished: success: 1, skipped: 0, failure: 0, total: 1\nInstalling drupal-composer/drupal-project (8.x-dev 544ba79cd95cb4fca599cba586498aaf0faf2885)\n\n                              \n  [ErrorException]            \n  mkdir(): Permission denied  \n                              \n\ncreate-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]", "stdout": "", "stdout_lines": [], "warnings": []}

So, it looks like we need to set the directory permissions correctly on the composer install dir when using composer create-project.

@geerlingguy geerlingguy added this to the 3.1.1 milestone Jun 13, 2016
@geerlingguy
Copy link
Owner Author

Testing a fix.

@geerlingguy
Copy link
Owner Author

Now on another Mac I'm getting:

TASK [Ensure drupal_composer_install_dir directory has proper permissions.] ****
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "gid": 20, "group": "dialout", "mode": "0755", "msg": "chown failed", "owner": "502", "path": "/var/www/drupalvm/drupal", "size": 68, "state": "directory", "uid": 502}

@oxyc
Copy link
Collaborator

oxyc commented Jun 14, 2016

Is it failing because of the non-existent user? can we just bypass the file module and use chown directly?

@geerlingguy
Copy link
Owner Author

Maybe so. But the strange thing is, I haven't seen others encounter the root problem before, only me. So maybe it's just a local environment issue?

@oxyc
Copy link
Collaborator

oxyc commented Jun 14, 2016

Seems to be the case, not even chown can fix it.

sudo chown -v vagrant:vagrant logdump2
chown: changing ownership of ‘logdump2’: Operation not permitted
failed to change ownership of ‘logdump2’ from 501:dialout to vagrant:vagrant

@ghost
Copy link

ghost commented Jun 14, 2016

FYI, I'm trying a BLT install on a Linux host and am seeing an issue with ownership that I haven't characterized yet but given this discussion thought I'd note.

@geerlingguy
Copy link
Owner Author

I'm rebuilding a couple times with fresh installs, completely emptying the parent directory, to see if I can reproduce this issue.

@geerlingguy
Copy link
Owner Author

I can't get this to happen again... I'm thinking I close this out and if someone else hits something similar, we'll deal with it in that issue.

@oxyc
Copy link
Collaborator

oxyc commented Jun 14, 2016

@geerlingguy before you reverted I think this could be reproduced by having the directory, but not having the site installed yet. As root user doesn't have any special permissions on nfs mounts the chown failed. Oddly enough chown doesn't fail as the vagrant user, it says the command was successful but I guess because it's NFS the permission change doesn't actually occur.

@mooru
Copy link

mooru commented Jun 15, 2016

I am also having a challenge here after trying twice. I am using the defaults. TASK [Generate Drupal project with composer package.] **************************
fatal: [drupalvm]: FAILED! => {"changed": true, "cmd": ["/usr/bin/composer", "create-project", "drupal-composer/drupal-project:8.x-dev", "/var/www/drupalvm/drupal", "--prefer-dist", "--stability", "dev", "--no-interaction"], "delta": "0:00:32.038698", "end": "2016-06-15 15:59:25.129540", "failed": true, "rc": 1, "start": "2016-06-15 15:58:53.090842", "stderr": " 1/5:\thttp://packagist.org/p/provider-latest$ed0232f1ca13d72f89d7b48ce0b0c2ffc48d369e7a06f36abc5c27cd9529bfa9.json\n 2/5:\thttp://packagist.org/p/provider-2015-10$948b93eddc391d378dce8f0a52fc9f9423a8e061268c278f2b1c6b164d99c52d.json\n 3/5:\thttp://packagist.org/p/provider-2016-04$f20c2218ca0a6e1e0db93522ff09f1f9461d77cded39aca000b343ac759a3e3f.json\n 4/5:\thttp://packagist.org/p/provider-2015$9a6d5a9bea3be17c64e0357e2ad2e4eb2e058e06518478ef4b8c3d27fdcebda7.json\n 5/5:\thttp://packagist.org/p/provider-2016-01$ac4713597cd91d168a299dd3479fcceed12e6ad1531f4c92833423adad855e23.json\n Finished: success: 5, skipped: 0, failure: 0, total: 5\nInstalling drupal-composer/drupal-project (8.x-dev 544ba79cd95cb4fca599cba586498aaf0faf2885)\n\n \n [ErrorException] \n mkdir(): Permission denied \n \n\ncreate-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [] [] []", "stdout": "", "stdout_lines": [], "warnings": []}
to retry, use: --limit @/Users/martinoru/Sites/drupal8/provisioning/playbook.retry

PLAY RECAP *********************************************************************
drupalvm : ok=159 changed=3 unreachable=0 failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

@mooru
Copy link

mooru commented Jun 15, 2016

working well now

@vinmassaro
Copy link

I am also unable to complete the default install of drupalvm. Composer/vagrant versions:

$ composer --version
Composer version 1.2-dev (5a3d60c0cf0302a54b812f26fd23a0db67488e3e) 2016-06-11 14:48:44
$ vagrant --version
Vagrant 1.8.1

After vagrant up, it always fails on:

TASK [Ensure drupal_composer_install_dir directory has proper permissions.] ****
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "gid": 20, "group": "dialout", "mode": "0755", "msg": "chown failed", "owner": "501", "path": "/var/www/drupalvm/drupal", "size": 68, "state": "directory", "uid": 501}

@mooru
Copy link

mooru commented Jun 16, 2016

The mistake i was making was cloning the example.drupal.composer.json and example.drupal.make.yml. when i only use the drupal.make.yml that was when it worked

On 16 Jun 2016, at 3:05 PM, Vincent Massaro notifications@github.com wrote:

I am also unable to complete the default install of drupalvm. Composer/vagrant versions:

$ composer --version
Composer version 1.2-dev (5a3d60c0cf0302a54b812f26fd23a0db67488e3e) 2016-06-11 14:48:44
$ vagrant --version
Vagrant 1.8.1
After vagrant up, it always fails on:

TASK [Ensure drupal_composer_install_dir directory has proper permissions.] ****
fatal: [drupalvm]: FAILED! => {"changed": false, "failed": true, "gid": 20, "group": "dialout", "mode": "0755", "msg": "chown failed", "owner": "501", "path": "/var/www/drupalvm/drupal", "size": 68, "state": "directory", "uid": 501}

You are receiving this because you commented.
Reply to this email directly, view it on GitHub #726 (comment), or mute the thread https://github.com/notifications/unsubscribe/ACIeotthGdvj9tSf3XPCCLsTGJx8D43fks5qMVg2gaJpZM4Iz97e.

@rpsu
Copy link

rpsu commented Jun 17, 2016

What are the versions you are using, especially the ansible version?
we seem to have issues as well with mkdir -permissions, but among ~20 developers only a few have that issue.

2.0.0.2 via Homebrew does work
2.1.0 via pip seems to have this permission issue

@geerlingguy
Copy link
Owner Author

@vinmassaro - the most recent Drupal VM updates should fix the problem you saw. And @rpsu - same thing, please try using 3.1.2 and see if that resolves the issue.

@mooru
Copy link

mooru commented Jun 17, 2016

I am using ansible 2.1.0.0 from home-brew

On 17 Jun 2016, at 12:07 PM, Perttu Ehn notifications@github.com wrote:

What are the versions you are using, especially the ansible version?
we seem to have issues as well with mkdir -permissions, but among ~20 developers only a few have that issue.

2.0.0.2 via Homebrew does work
2.1.0 via pip seems to have this permission issue


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #726 (comment), or mute the thread https://github.com/notifications/unsubscribe/ACIeol-6fe5nrMpXMGd-05XxCssW5kurks5qMn_VgaJpZM4Iz97e.

@bhasselbeck
Copy link

bhasselbeck commented Jun 21, 2016

When I git clone git@github.com:geerlingguy/drupal-vm.git and then quick start with a vagrant up, I get a mkdir(): file permission error on commit 407b94 during the [Generate Drupal project with composer package.] task.

When I vagrant ssh into the box, and I cd /var/www/drupalvm and do a drush dl drupal I get this error:

vagrant@drupalvm:~$ cd /var/www/drupalvm
vagrant@drupalvm:/var/www/drupalvm$ ls -al
total 8
drwxr-xr-x 2 root root 4096 Jun 21 03:09 .
drwxr-xr-x 4 root root 4096 Jun 21 03:12 ..
vagrant@drupalvm:/var/www/drupalvm$ drush dl drupal
 [error]  Directory /var/www/drupalvm exists, but is not writable. Please check directory permissions.
 [error]  Project drupal (8.1.3) could not be downloaded to /var/www/drupalvm/drupal-8.1.3.
vagrant@drupalvm:/var/www/drupalvm$ whoami
vagrant

It seems that the issue is who owns the directory when the composer install occurs. I'm using standard default config, any ideas?

@geerlingguy
Copy link
Owner Author

@bhasselbeck - If you delete the drupal folder entirely on your host machine (should be inside the cloned Drupal VM directory if you're using default config), then do vagrant reload --provision, does it fail the 2nd time?

@bhasselbeck
Copy link

@geerlingguy I was able to get it to work by switching to rsync mode in vagrant_synced_folders and doing an install.

However, starting fresh, I've cloned the repo and did a vagrant up with the default nfs settings. It failed again with nfs on the [Generate Drupal project with composer package.] task. The synced folder settings are:

vagrant_synced_folders:
  - local_path: .
    destination: /var/www/drupalvm
    type: nfs
    create: true

After the failure, I checked, there isn't a drupal directory in the local_path (which is the drupal-vm path) on my host machine. In the order of events, I'm not sure anything without proper permissions can write to /var/www/drupalvm because it's owned by root, so the drupal directory couldn't have been created yet.

@bhasselbeck
Copy link

It's entirely possible my users / permissions on this machine are wonked...

@malcomio
Copy link

I also faced this issue with drupalvm 3.1.2, and ansible 2.1.0.0 on OS X Yosemite 10.10.5

I was able to get the site installed by doing this:

vagrant ssh
sudo chown -v vagrant:vagrant /var/www/drupalvm
exit
vagrant provision

but the NFS share still isn't working as expected

@geerlingguy
Copy link
Owner Author

@bhasselbeck and @malcomio - Are both of you running Vagrant 1.8.4 as well? Maybe it's a version thing :/

@malcomio
Copy link

yes, I needed to upgrade to vagrant 1.8.4 in order to get drupalvm 3 running

since upgrading, NFS shares aren't working on my other vagrant boxes either, which I need to investigate further...

@geerlingguy
Copy link
Owner Author

@malcomio could be from fdd347e

@bhasselbeck
Copy link

@geerlingguy I upgraded vagrant as well before going through the install.

$ vagrant --version
Vagrant 1.8.4

Let me revert back before the commit fdd347e and test again.

@bhasselbeck
Copy link

Reverted back, and the same issue occurs.

@bhasselbeck
Copy link

@malcomio following your convention on your workaround above. However, how is NFS still not working as expected for you?

@vinmassaro
Copy link

@geerlingguy: still seeing this issue with latest drupalvm (master). The workaround from @malcomio is working for me as well.

@geerlingguy
Copy link
Owner Author

@vinmassaro - This fix (4ffd60d) did basically the same thing internally, but would fail in some cases.

Maybe we could add it back in, but add a failed_when: false so it could fail gracefully?

@attheshow
Copy link

Same issue. Vagrant 1.8.1. Fix from malcomio worked for me too.

geerlingguy added a commit that referenced this issue Jun 29, 2016
@geerlingguy
Copy link
Owner Author

I've added failed_when: false to the original fix for this issue, so this should hopefully not break in some situations where it did before. I'll be releasing another small point release to hopefully fix the issue for anyone else still running into it.

@bhasselbeck
Copy link

@geerlingguy @vinmassaro I've confirmed that when I update VirtualBox to Version 5.0.24 r108355, the issue goes away.

@geerlingguy
Copy link
Owner Author

I'll be updating my VirtualBox Vagrant box images soon (maybe today/tomorrow) with 5.0.24 so the base boxes are set up for that version as well; though if you just upgrade your VirtualBox version (with or without the guestsupdater plugin), I think that should take care of it for anyone still having issues with Vagrant 1.8.4 and Drupal VM 3.1.3 (released today).

@attheshow
Copy link

Seems to be working well with upgraded VirtualBox, Vagrant, and Drupal VM 3.1.3.

@ghost
Copy link

ghost commented Oct 9, 2018

Same Problem on Debian

$ composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2
Installing magento/project-community-edition (2.2.6)

[ErrorException]
mkdir(): Permission denied

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [] [] []

@knows1
Copy link

knows1 commented Nov 20, 2018

Same Problem

  **[ErrorException]
  mkdir(): Permission denied


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]**

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants