After:
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
Temporarily disabling my Anti-Virus software (Avast)
Starting my command line program in Admin mode (eg. "Run as Administrator"),
Starting up Vagrant (2.2.3) with a Hyper-V instance:
$ vagrant up
using the following sample Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.provider "hyperv"
config.vm.network "public_network"
config.vm.synced_folder ".", "/vagrant", type: "smb"
config.vm.provider "hyperv" do |h|
h.enable_virtualization_extensions = true
h.linked_clone = true
end
end
Selecting External Virtual Switch
for the switch to attach to the Hyper-V instance
,
Entering my Windows (Admin) user's username and password when prompted by Vagrant during the startup of the Hyper-V instance
I got the following error:
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t cifs -o uid=1000,gid=1000,sec=ntlm,credentials=/etc/smb_creds_e706...e431 //10.124.157.30/e706...e431 /vagrant
The error output from the last command was:
mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
How to fix?
Vagrant comes with support out of the box for Hyper-V, a native hypervisor written by Microsoft. Hyper-V is available by default for almost all Windows 8.1 and later installs. The Hyper-V provider is compatible with Windows 8.1 and later only.
Vagrant automatically syncs files to and from the guest machine. This way you can edit files locally and run them in your virtual development environment. By default, Vagrant shares your project directory (the one containing the Vagrantfile) to the /vagrant directory in your guest machine.
NFS is a faster way of sharing your project's files between host and guests that sync the files instantly. To use NFS with Vagrant, nfs-utils package needs to be installed and nfs-server needs to be running. If it is not, run: $ sudo dnf install nfs-utils && sudo systemctl enable nfs-server.
Only after I went into:
Settings > Apps & Features > Programs and Features > Turn Windows features on or off
and enabled:
SMB Direct
(Remote Direct Memory Access (RDMA) support for the SMB 3.x file sharing protocol)
did Vagrant start up the Hyper-V instance, with my shared folders, successfully.
I haven't gone back to try skipping some of the actions that I did (eg. temporarily disabling Anti-Virus software), but was successful doing all of the above.
After not being able to find this clearly documented ANYWHERE (not on Vagrant's site, Hyper-V site, Stackoverflow, tons of Google searches) and struggling with this issue for countless hours, I just wanted to share this to save others the pain that I went through. Hope this helps!
I finally found something that worked for me and wanted to share. I'm on a domain joined computer with Windows 10 Pro 1909. I have this in my Vagrant file:
config.vm.synced_folder "C:/projects", "/projects", type: "smb", mount_options: ["domain=mydomain", "user=myusername", "vers=3.0"]
During "vagrant up" it still prompts for credentials so that it can create/prune the file shares. At this prompt I enter the user name in this format: mydomain\myusername
It now successfully mounts my local drive in the VM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With