Vagrant: Use, at minimum, SMBv2 when mounting Windows host synced folders.

Created on 9 Sep 2017  ·  3Comments  ·  Source: hashicorp/vagrant

Microsoft is removing support for SMBv1 from Windows.

Currently, though Vagrant will only attempt a mount with SMBv1, as this is the default behavior with mount -t cifs. Going forward, on newer versions of Windows, this will always fail by default.

The fix is to specify a minimum protocol version of 2.0 when mounting. SMBv2 is supported in Windows Vista Service Pack 1, and Windows Server 2008 or higher. If backwards compatibility with earlier versions of Windows is important, Vagrant could attempt mounting with protocol version 2.0 first, dropping back to 1.0 if support is not present.

Vagrant version

Vagrant 2.0.0

Host operating system

Windows 10 - Version 1703 (OS Build 16251.0)

Guest operating system

Debian Stretch (generic/debian9)

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "generic/debian9"
  config.vm.synced_folder ".", "/vagrant"
  # Note: A successful mount can be achieved by specifying:
  # config.vm.synced_folder ".", "/vagrant", mount_options: ["vers=2.0"]
end

Debug output

https://gist.github.com/rhencke/5e58e291607d0f0bf6544342ba349cb8

(For comparison, here is a log showing how a successful mount can be achieved with the additional mount options described above: https://gist.github.com/rhencke/11f8dff86d719e9386941dd653e8a117 )

Expected behavior

The mount was successfully achieved when running mount -t cifs.

Actual behavior

The mount failed when running mount -t cifs, claiming mount error(112): Host is down. However, the actual error is due to use of an unsupported protocol.

Steps to reproduce

  1. On a Windows 10 computer, version 1703 (OS Build 16251.0):
    a. Enable Hyper-V
    b. Install Vagrant 2.0.0
  2. Create a Vagrantfile, containing the example mentioned previously
  3. vagrant up

References

This issue seems strongly related:

hoswindows synced-foldersmb

Most helpful comment

Got into the same issue for which a solution is as simple as adding smb version in the mount options. See provided example:

config.vm.synced_folder '.', '/vagrant', disabled: false, type: "smb", smb_host: <hostname/ip>, mount_options: ['vers=3.0']

All 3 comments

Got into the same issue for which a solution is as simple as adding smb version in the mount options. See provided example:

config.vm.synced_folder '.', '/vagrant', disabled: false, type: "smb", smb_host: <hostname/ip>, mount_options: ['vers=3.0']

Thanks @ghousseyn, your solution of adding vers=3.0 made things working for us. We no longer see the random Host is down issue.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janw-me picture janw-me  ·  3Comments

cbednarski picture cbednarski  ·  3Comments

DreadPirateShawn picture DreadPirateShawn  ·  3Comments

OtezVikentiy picture OtezVikentiy  ·  3Comments

bbaassssiiee picture bbaassssiiee  ·  3Comments