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

Windows 10 VirtualBox synced folders don't like Composer #733

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

Windows 10 VirtualBox synced folders don't like Composer #733

geerlingguy opened this issue Jun 13, 2016 · 22 comments

Comments

@geerlingguy
Copy link
Owner

geerlingguy commented Jun 13, 2016

Windows 10, Vagrant 1.8.1, VirtualBox 5.0.20

I get the error:

Failed to download drupal/core from dist: Could not delete web/core/6154c8a03a58e79151b32c248b8ce96d

Full log of the failed task:

==> drupalvm: TASK [Generate Drupal project with composer package.] **************************
==> drupalvm: fatal: [localhost]: 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:08:23.956900", "end": "2016-06-13 20:09:37.197460", "failed": true, "rc": 1, "start": "2016-06-13 20:01:13.240560", "stderr": "Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Installing drupal-composer/drupal-project (8.x-dev 544ba79cd95cb4fca599cba586498aaf0faf2885)
  - Installing drupal-composer/drupal-project (8.x-dev 544ba79)
    Loading from cache

Created project in /var/www/drupalvm/drupal
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing drupal-composer/drupal-scaffold (2.0.1)

 Loading from cache

  - Installing cweagans/composer-patches (1.5.0)
    Loading from cache

...

  - Installing symfony/polyfill-apcu (v1.2.0)
    Loading from cache

  - Installing symfony/class-loader (v2.8.7)
    Loading from cache

  - Installing drupal/core (8.1.2)

    Downloading: Connecting...\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 0%
         \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 5%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 10%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 15%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 20%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 25%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 30%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 35%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 40%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 45%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 50%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b
    Downloading: 55%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 60%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 65%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 70%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 75%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 80%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 85%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 90%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 95%\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b    Downloading: 100%
    Failed to download drupal/core from dist: Could not delete web/core/6154c8a03a58e79151b32c248b8ce96d: 
    Now trying to download from source
  - Installing drupal/core (8.1.2)



  [RuntimeException]                                            
  Could not delete web/core/6154c8a03a58e79151b32c248b8ce96d:   



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] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]", "stdout": "", "stdout_lines": [], "warnings": []}

See upstream/related:

I'm not sure if I'm hitting the Composer timeout (the task does hang for a long time), or if it's a symlink/similar issue. I don't hit this on Fedora or Mac OS X, so it seems to be a Windows/VirtualBox thing.

@geerlingguy
Copy link
Owner Author

geerlingguy commented Jun 13, 2016

Testing with a composer.json build instead of drupal-project, following these instructions—basically set the following variables in config.yml after copying the example composer file to drupal.composer.json:

vagrant_synced_folder_default_type: smb
vagrant_synced_folders:
  - local_path: .
    destination: /var/www/drupalvm
    type: smb

build_composer_project: false
build_composer: true
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"

I had to launch either cmder or cygwin64 as administrator to be able to vagrant up with SMB, but that was required to avoid the issue mentioned in the following comment.

@geerlingguy
Copy link
Owner Author

Now I'm hitting ansible/ansible#9526

@geerlingguy
Copy link
Owner Author

I'm going to try setting vagrant_synced_folder_default_type to smb to see if that helps. This also requires me to run Cmder/Cygwin64 as administrator, so not ideal, but just testing to see if it works out.

@geerlingguy
Copy link
Owner Author

Now I'm hitting a bug in our composer.json :)

@geerlingguy
Copy link
Owner Author

geerlingguy commented Jun 13, 2016

Getting the same issue, but Could not delete docroot/core/cifs8b2c now, at the end of the "Run composer install." task :P

Looks like for Windows, we might need to recommend the makefile approach for now (or any setup that doesn't require Drupal VM building a composer-based codebase itself inside a shared directory), until I can figure out a more stable way of doing Composer stuff in a shared directory.

@geerlingguy
Copy link
Owner Author

Testing with the following config (after creating drupal.make.yml from the example):

build_makefile: true
build_composer: false
build_composer_project: false
drupal_core_path: "/var/www/drupalvm/drupal"

@geerlingguy
Copy link
Owner Author

The makefile configuration seems to have worked. drupalvm.dev is up and running.

@geerlingguy geerlingguy changed the title Windows 10 VirtualBox and default configuration results in composer error Windows 10 VirtualBox synced folders don't like Composer Jun 13, 2016
@geerlingguy
Copy link
Owner Author

Better title ^^

@geerlingguy
Copy link
Owner Author

I'm back to the default configuration. Going to try to see if there's a way to make Composer happy on Windows inside a VirtualBox synced folder.

@oxyc
Copy link
Collaborator

oxyc commented Jun 15, 2016

Does it work if you change the location of vendor to somewhere outside of the shared folder? This should speed up the I/O performance and would tell us if that's the issue.

{
    ...
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "vendor-dir": "/home/vagrant/vendor"
    },
    ....
}

@geerlingguy
Copy link
Owner Author

This looks highly related to #741 as well (just tagging that reference).

@geerlingguy
Copy link
Owner Author

geerlingguy commented Jun 16, 2016

I'm testing using a longer composer timeout (as suggested here), and also for Windows VirtualBox compatibility, I've switched the task that moves composer.json into place (inside build-composer.yml) to two tasks; one to copy it into a non-shared-directory location, then a second to use mv to move the file (because of the upstream Ansible issue on VirtualBox synced dirs and the copy module).

# Use copy-and-move to prevent issues in Windows with VirtualBox.
- name: Copy composer.json into temporary location.
  copy:
    src: "{{ drupal_composer_path }}"
    dest: "/tmp/drupalvm-composer.json"
  when: drupal_composer_path and not drupal_site_exists
  become: no

- name: Move composer.json into place.
  command: "mv /tmp/drupalvm-composer.json {{ drupal_composer_install_dir }}/composer.json"
  when: drupal_composer_path and not drupal_site_exists
  become: no

@geerlingguy
Copy link
Owner Author

geerlingguy commented Jun 16, 2016

This seems to have worked (the longer timeout in drupal.composer.json):

            "docroot/profiles/contrib/{$name}": ["type:drupal-profile"],
            "docroot/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        }
    },
    "config": {
        "process-timeout": 1200
    }

I'm testing again to confirm it doesn't work without that tweak. If that fixes this plus other Linux distros/slower connections for the composer.json-based install, I'll add that in before I tag another bugfix release.

@geerlingguy
Copy link
Owner Author

geerlingguy commented Jun 16, 2016

Hmm... it worked without the timeout this time, so maybe it's just when things are slow. I'd still like to add some config to make it more reliable/stable of course...

See: http://stackoverflow.com/questions/18917768/why-composer-install-timeouts-after-300-seconds

@geerlingguy
Copy link
Owner Author

geerlingguy commented Jun 16, 2016

Now trying composer project with:

- name: Generate Drupal project with composer package.
  command: >
    {{ composer_path }} create-project
    {{ drupal_composer_project_package }} {{ drupal_composer_install_dir }}
    {{ drupal_composer_project_options|default('--prefer-dist --no-interaction') }}
  when: not drupal_site_exists
  become: no
  environment:
    COMPOSER_PROCESS_TIMEOUT: 1200

@geerlingguy
Copy link
Owner Author

And docs for process-timeout: https://getcomposer.org/doc/06-config.md#process-timeout

@geerlingguy
Copy link
Owner Author

It is crazy slow... but it's working. I can't imagine using VirtualBox native synced folders for daily use. Just the 'Install configured modules with drush' task is taking like 30 min :P

@geerlingguy
Copy link
Owner Author

Testing, and if it works (even if it's crazy-slow), I'll tag a bugfix release and hopefully solve this plus #741 in one shot.

@geerlingguy
Copy link
Owner Author

Works! And was way faster this time, even though I don't have vagrant-cachier installed on the laptop.

@ibuildit
Copy link

Increasing timeout works for me as well on drupalvm / windows 10

@armyofda12mnkeys
Copy link

Note: increasing timeout in my composer.json also worked for me

@webprogrammierer
Copy link

I did not find any solution for this problem.

Is there any?

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

No branches or pull requests

5 participants