drupal-vm icon indicating copy to clipboard operation
drupal-vm copied to clipboard

`undefined method` if using empty string/native synced folder with Vagrant 1.8.6

Open cdmo opened this issue 10 years ago • 23 comments

Getting an undefined method error when using vagrant 1.8.6. I had a new developer join the team this week and she discovered it first. Then I upgraded from 1.8.5 to 1.8.6 and I hit the same error.

Any ideas where this is coming from?

Using CentOS7, Drupal 7, native shares... this is my config.yml: https://gist.github.com/cdmo/d22d6f9ebfd62f8df9f6263613d893a1

==> drupalvm: Mounting shared folders...
    drupalvm: /vagrant => /Users/cmorris/projects/ul-drupalvm
    drupalvm: /var/www/drupalvm => /Users/cmorris/Sites/ul
==> drupalvm: Forcing shutdown of VM...
==> drupalvm: Destroying VM and associated drives...
/opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb:64:in `mount_virtualbox_shared_folder': undefined method `+' for nil:NilClass (NoMethodError)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/capability_host.rb:111:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/capability_host.rb:111:in `capability'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/guest.rb:43:in `capability'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/synced_folder.rb:51:in `block in enable'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/synced_folder.rb:35:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/synced_folder.rb:35:in `enable'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/synced_folders.rb:93:in `block in call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/synced_folders.rb:90:in `each'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/synced_folders.rb:90:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/cmorris/.vagrant.d/gems/gems/vagrant-bindfs-0.4.9/lib/vagrant-bindfs/bind.rb:14:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/prepare_nfs_valid_ids.rb:12:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:49:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/prepare_forwarded_port_collision_params.rb:30:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/env_set.rb:19:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/provision.rb:80:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/cmorris/.vagrant.d/gems/gems/vagrant-bindfs-0.4.9/lib/vagrant-bindfs/bind.rb:14:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/clear_forwarded_ports.rb:15:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/set_name.rb:50:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/clean_machine_folder.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/box_check_outdated.rb:78:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/match_mac_address.rb:19:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/discard_state.rb:15:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/import.rb:44:in `clone'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/import.rb:11:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb:32:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/prepare_clone.rb:15:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/import_master.rb:36:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/customize.rb:40:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /Users/cmorris/.vagrant.d/gems/gems/vagrant-auto_network-1.0.2/lib/auto_network/action/request.rb:24:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/machine.rb:225:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/machine.rb:200:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/environment.rb:567:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/machine.rb:186:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/machine.rb:186:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

cdmo avatar Oct 04 '16 14:10 cdmo

This sounds like it is an upstream issue with Vagrant (issue queue: https://github.com/mitchellh/vagrant/issues). I haven't updated to 1.8.6 yet, but will soon, and I'll see if I get the same error.

geerlingguy avatar Oct 04 '16 15:10 geerlingguy

Think it might be the blank "type:"?

1.8.6 has been OK so far here.

joestewart avatar Oct 04 '16 15:10 joestewart

@joestewart - That could be it; @cdmo how do you have your shares/synced directories defined in config.yml?

geerlingguy avatar Oct 04 '16 15:10 geerlingguy

I was just reading over the documentation and noticed this same potential issue and changed it to "", but still getting the same result. Tried a few different settings changes too, like using ubuntu, version of Drupal, etc. But still keep getting the error every time I use native. nfs is a no go for me, so I can't check that. But... I did just try the rsync method and that didn't crash out. So, maybe just a bug with native shares? Thanks.

cdmo avatar Oct 04 '16 15:10 cdmo

I ran into this problem yesterday after upgrading Vagrant & VirtualBox.

Could you please detail which ruby version you use, and how it was implemented on the system (even if it's the default setup). I use RVM and switching ruby versions fixed it for me.

You could also try reinstalling ruby if you're using the system default ruby.

fubarhouse avatar Oct 05 '16 22:10 fubarhouse

> which rvm
/Users/cmorris/.rvm/bin/rvm
> ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

To solve this right now, I just uninstalled Vagrant and reinstalled 1.8.5 and everything is working as expected for native shares. Thanks.

cdmo avatar Oct 06 '16 12:10 cdmo

Same issue here, Windows 10, Vagrant 1.8.6, VirtualBox 5.0.28 My fileshare type is NFS

Tried updating Ruby from 2.2 to latest 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32

Downgraded vagrant back to 1.8.5 and its working

You can view repo at: https://github.com/Stony-Brook-University/doitsbu/tree/master/vendor/geerlingguy/drupal-vm

sbubaron avatar Oct 21 '16 15:10 sbubaron

I have the same issue. Any possible solution other than downgrading?

jelo77 avatar Nov 01 '16 23:11 jelo77

Right now, use either "nfs", "rsync", or "smb". I haven't had time to debug why the empty string is causing the error with Vagrant 1.8.6 :(

geerlingguy avatar Nov 02 '16 02:11 geerlingguy

nfs isn't available on non-enterprise Windows rsync is one-way only and didn't work for me smb requires login/password

life is hell :(

Razunter avatar Nov 07 '16 12:11 Razunter

I'm fairly certain we could figure out a syntax fix for this that's not too difficult, it just hasn't been as high priority as keeping everything else running (latest Vagrant/VirtualBox updates threw a bunch of curveballs, and I'm still catching up there). If someone knows a little Ruby, it's probably a little syntax issue or something like double vs single quotes, who knows.

geerlingguy avatar Nov 07 '16 14:11 geerlingguy

To use virtualbox native shares you can also set type: "virtualbox".

oxyc avatar Nov 07 '16 16:11 oxyc

I'm pretty sure this is the cause https://github.com/mitchellh/vagrant/pull/7720/files#diff-97d643b35101562477f4b556a379415fL30.

guests/linux: Fixes for user and group ID lookups for virtualbox shared folders [GH-7616, GH-7662, GH-7720]

We should revert https://github.com/geerlingguy/drupal-vm/commit/5904e8e64af46a763b3585b96dae5792914a4414.

oxyc avatar Nov 07 '16 16:11 oxyc

TL;DR;

Vagrant 1.8.4 caused an issue when mount_options was an empty array. In 1.8.3 the option was passed to a shell command as an argument wrapped in quotes. As of 1.8.4 the quotes were removed thus causing an invalid shell syntax, ala mount -o something-else rather than mount -o '' something-else. We fixed this by using nil instead of [].

As of 1.8.6 they changed the logic again and now nil is the problem.

mount_options = options.fetch(:mount_options, []) # evaluates to mount_options = nil
mount_options += ["uid=#{mount_uid}", "gid=#{mount_gid}"]

oxyc avatar Nov 07 '16 16:11 oxyc

Could you test if the PR above works?

oxyc avatar Nov 07 '16 16:11 oxyc

@jelo77 / @Razunter / @sbubaron / @fubarhouse / @cdmo - Can you test the above PR? It looks to me like it should fix the issue, just want to confirm before merging. Then I'll be happy to tag a new bugfix release for Drupal VM so people can feel more comfy upgrading Vagrant too :)

geerlingguy avatar Nov 07 '16 17:11 geerlingguy

@geerlingguy it works. Tested with empty values.

Razunter avatar Nov 07 '16 17:11 Razunter

That indeed fixed this problem, but then the installer dies on the firewall ("Could not find the requested service 'firewall':"). Ansible failed to complete successfully. @Razunter did you not have this issue?

jelo77 avatar Nov 07 '16 18:11 jelo77

@jelo77 no, machine just started without issues.

Razunter avatar Nov 07 '16 18:11 Razunter

@jelo77 - That was related to https://github.com/geerlingguy/ansible-role-firewall/issues/17 (separate issue). Thanks for confirming the shared folder fix, I'll merge it and tag a bugfix release!

geerlingguy avatar Nov 07 '16 18:11 geerlingguy