Lets not talk about how much time I wasted on this.
If you are using Vagrant with Hyper-V and are on 2.2.15 (the latest at the moment) you will probably receive an angry error when Vagrant attempts to mount SMB shared folders like the one I received below (see after the angry for a workaround):
Traceback (most recent call last):
93: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'
92: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/machine.rb:201:in `action'
91: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/machine.rb:201:in `call'
90: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/environment.rb:614:in `lock'
89: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/machine.rb:215:in `block in action'
88: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/machine.rb:246:in `action_raw'
87: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `run'
86: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/util/busy.rb:19:in `busy'
85: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `block in run'
84: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builder.rb:149:in `call'
83: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
82: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/delayed.rb:19:in `call'
81: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
80: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/check_enabled.rb:18:in `call'
79: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
78: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/check_access.rb:19:in `call'
77: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
76: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
75: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
74: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
73: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
72: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/call.rb:53:in `call'
71: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `run'
70: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/util/busy.rb:19:in `busy'
69: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `block in run'
68: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builder.rb:149:in `call'
67: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
66: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
65: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
64: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/import.rb:78:in `call'
63: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
62: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/call.rb:53:in `call'
61: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `run'
60: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/util/busy.rb:19:in `busy'
59: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `block in run'
58: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builder.rb:149:in `call'
57: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
56: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
55: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
54: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/call.rb:53:in `call'
53: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `run'
52: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/util/busy.rb:19:in `busy'
51: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `block in run'
50: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builder.rb:149:in `call'
49: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
48: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
47: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
46: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/call.rb:53:in `call'
45: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `run'
44: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/util/busy.rb:19:in `busy'
43: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/runner.rb:89:in `block in run'
42: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builder.rb:149:in `call'
41: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
40: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
39: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
38: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/provision.rb:80:in `call'
37: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
36: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/configure.rb:108:in `call'
35: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
34: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/set_name.rb:38:in `call'
33: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
32: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/net_set_vlan.rb:15:in `call'
31: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
30: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/net_set_mac.rb:15:in `call'
29: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
28: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/cleanup_disks.rb:30:in `call'
27: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
26: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/disk.rb:30:in `call'
25: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
24: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/synced_folders/nfs/action_cleanup.rb:14:in `call'
23: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
22: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
21: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
20: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/start_instance.rb:12:in `call'
19: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
18: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/providers/hyperv/action/wait_for_ip_address.rb:52:in `call'
17: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
16: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/wait_for_communicator.rb:71:in `call'
15: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
14: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/delayed.rb:19:in `call'
13: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/warden.rb:48:in `call'
12: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/synced_folders.rb:90:in `call'
11: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/synced_folders.rb:90:in `each'
10: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/action/builtin/synced_folders.rb:93:in `block in call'
9: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/synced_folders/smb/synced_folder.rb:142:in `enable'
8: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/synced_folders/smb/synced_folder.rb:142:in `each'
7: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/synced_folders/smb/synced_folder.rb:153:in `block in enable'
6: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/guest.rb:43:in `capability'
5: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/capability_host.rb:111:in `capability'
4: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/capability_host.rb:111:in `call'
3: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/guests/linux/cap/mount_smb_shared_folder.rb:23:in `mount_smb_shared_folder'
2: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/capability_host.rb:111:in `capability'
1: from C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/lib/vagrant/capability_host.rb:111:in `call'
C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/synced_folders/smb/cap/mount_options.rb:48:in `mount_name': wrong number of arguments (given 2, expected 3) (ArgumentError)
Thankfully, some other unfortunate souls have also run into this problem and provided guidance in issue #12277 and commit #12281. To fix it requires editing a single line of code in
C:\HashiCorp\Vagrant\embedded\gems\2.2.15\gems\vagrant-2.2.15\plugins\guests\linux\cap\mount_smb_shared_folder.rb
You may need to customize the first part of that path (C:\HashiCorp\Vagrant\
) if you installed Vagrant somewhere other than the default on your system.
You’ll need to edit Line 23 of this file (I recommend Notepad++) from
mount_device = options[:plugin].capability(:mount_name, options)
to
mount_device = options[:plugin].capability(:mount_name, name, options)
I’d recommend reloading (vagrant reload
) the machine and things should go a bit more smoothly.
The patch above has already been merged in commit #12281 so expect this issue to go away when Vagrant 2.2.16 comes our way.
FYI: This issue will occur when mounting SMB shares using Vagrant/Hyper-V with any machine (that I’m aware of) but I was particularly struggling with Varying Vagrant Vagrants (VVV) for WordPress (see issue #2446).
Why I’m using Vagrant and a Virtual Machine rather than a Docker container is a story for another day…