Homestead: Running vagrant up fails when mounting SMB shared folders. (Windows 10, Hyper-V)

Created on 23 Jan 2018  路  26Comments  路  Source: laravel/homestead

Versions

  • Vagrant: 2.0.1
  • Provider: Hyper-V
  • Homestead: 7.0.1 (CLI), 5.0.1 (Box)

Host operating system

Windows 10 Pro

Homestead.yaml

---
ip: "172.21.12.10"
memory: 2048
cpus: 1
provider: hyperv
mariadb: true

authorize: c:/Users/arbet/.ssh/id_rsa.pub

keys:
    - c:/Users/arbet/.ssh/id_rsa

folders:
    - map: c:/Users/arbet/Documents/Projects
      to: /home/vagrant/code

sites:
    - map: site.test
      to: /home/vagrant/code/site/public

databases:
    - homestead

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Vagrant destroy & up output

GitHub Gist

Expected behavior

It should boot up and create the whole virtual machine, mounting SMB shared folders and provisioning.

Actual behavior

It fails after it tries to mount SMB shared folders. I suspect it can be because of bad SMB username, because I am using a Microsoft account and I don't know what should be the proper SMB username. However the output also says mount error(112): Host is down

Steps to reproduce

  1. Enable HyperV on Windows 10 Pro
  2. Install Vagrant
  3. Add homestead Vagrant box
  4. Run vagrant up

References

No.

Most helpful comment

@tfenster I solved it by turning to Docker and Laradock. 馃挴

All 26 comments

Explicitly set the type to "smb" (under Folder)
You may also need to edit homstead.rb to set the smb version to 2.1 (search for vers= and change it to 2.1).

Now I am getting mount error(13). Can it be connected to the fact that I am using Microsoft Account? Because I tried several login options and non of them worked.

It could be the Microsoft account, but I honestly don't know. I would try creating a new user and testing it with a non Microsoft account to verify.

I use a microsoft account with my profile, and so long as I use the full email address it works correctly.

Revert the edit to homestead.rb, and edit the homestead.yaml:

folders:
- map: c:/Users/arbet/Documents/Projects
to: /home/vagrant/code
type: "smb"
mount_options: ['vers=2.1', 'mfsymlinks']

which I discovered after my previous post is the correct way.

If it fails to mount, check to see if the shares actually exist on your local machine. If they don't, you'll need to go upstream to vagrant. Post the vagrant up log again, specifically the mount command it tries

@DaWolfey i have the same issue as @KubqoA . After using your latest settings "vagrant up" seems to run succesfully. But if i use "vagrant ssh" , cd into the folder that i have binded my folder to and i then run "dir" i get the output: "reading directory '.': Input/output error".

Closing for inactivity / unable to confirm resolved. To anyone experiencing this issue I would review this comment for suggestions: https://github.com/laravel/homestead/issues/802#issuecomment-360251150

@KubqoA Did you manage to resolve this problem? I'm facing the same. Or maybe @svpernova09 could help?
Homestead.yaml :

folders:
    - map: c:/Users/kulikov/Desktop/homestead/projects
      to: /home/vagrant/code
      type: "smb"

sites:
    - map: coneqtv2.api
      to: /home/vagrant/code/site/public

And after command 'vagrant up' have an error:

```
homestead-7: Mounting SMB shared folders...
homestead-7: C:/Users/kulikov/Desktop/homestead/projects => /home/vagrant/code
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,vers=3.02,mfsymlinks,sec=ntlm,credentials=/etc/smb_creds_37d831712f5fd6dd4924a2dbfacb737c //10.0.75.1/37d831712f5fd6dd4924a2dbfacb737c /home/vagrant/code

The error output from the last command was:

mount error(5): Input/output error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
```

I also had this issue, but not with the main folder I was attempting to share, but rather with the /vagrant share that's used for provisioning.
I found that explicitly creating an entry for both the folder I wanted to share, that was using vers=3.02 just fine, and also specifying smb then worked. Otherwise it wasn't pulling in the mount options that are set in the homestead.rb into the end script which is mount_smb_shared_folder.rb as part of Vagrant itself.

folders:
    - map: f:/code
      to: /home/vagrant/code
      type: "smb"
    - map: f:/code/Homestead-hyperv
      to: /vagrant
      type: "smb"

@kulikov-e-s did you find a working solution?

@joachimvs unfortunately no

I am having this same issue (mount error 13) and believe it is due to bad user/login as I don't even know what account it is referring to. What makes you think its prompting for a Microsoft account? . @KubqoA

Well, I solved the problem firstly by creating a separate account named vagrant which had rights for my projects folder and that solved it. However, ultimately I switched to use virtualbox, mainly because of the fact that it doesn't require smb and it can have static ip

I was able to fix this by adding default mount to folders.
```
folders:
- map: "."
to: /vagrant
type: "smb"

I also had to map the homestead folder manually to /vagrant with "smb" to get things working. Couldn't find anything in the documentation to suggest an officially correct way to do it.

Same issue here, and none of the suggested worked :(
Anyone has other tips?

I got a similar problem to mounting shares. Anyone know what PATH that should be included for this?
``` homestead-7: You will be asked for the username and password to use for the SMB
homestead-7: folders shortly. Please use the proper username/password of your
homestead-7: account.
homestead-7:
homestead-7: Username: myusername
homestead-7: Password (will be hidden):

Vagrant requires administator access to create SMB shares and
may request access to complete setup of configured shares.
Exporting an SMB share failed! Details about the failure are shown
below. Please inspect the error message and correct any problems.

Host path:

Stderr: x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:19

  • D:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-2.0.2/plugi ...
  • ~~~

    • CategoryInfo : ObjectNotFound: (x86:String) [], CommandNotFoundException

    • FullyQualifiedErrorId : CommandNotFoundException

Stdout:
```

UPDATE:
I solved by sharing the WiFi connection with the default vEthernet. It works but the IP change at every vagrant up, so you have to update the host every time

@sXe79 Could you please elaborate more how you shared the connection and where to update the host? I am using laravel/homestead.

@fzee for the host I mean the file you use to map local web app, in windows is in "C:\Windows\System32\driversetc". At almost every vagrant up it change the IP so you have to update this file.
You can share the WiFi connection by right clicking on the network adapter -> properties -> Sharing connection.

Anyway, after the "Spring Creators Update" it works out of the box, no needs to share any connection

@jeliasson You can work around this problem by installing Vagrant in a path without a blank (e.g. c:\hashicorp\vagrant)

@tfenster I solved it by turning to Docker and Laradock. 馃挴

Just wanted to say I was having the same issue and it required 2 changes

  1. add type: "smb" to folders, for some reason it tries to mount using vbox commands otherwise
  2. laravel/homestead version 6.4.0 does not work, but updating the ...scripts/homestead.rb file to use 6.3.0 worked like a charm

Last, nothing to do with this error, but make sure you have an external virtual switch setup in hyper-v before doing a vagrant up

Hope this works for some of you

Unfortunately it doesn't work always, now I'm facing this strange behaviour that it succeed to mount folders only when also docker is running (docker virtual network). I guess the problem is always in network settings.
I did try to reset everything but it keep failing... some other advice?

I realise this has been closed for ages at this point but I had a similar devil of a time getting the mount to work using my local / microsoft account. I couldn't figure out the syntax. So i just made a new local user up with a strong password and added them to the admin group. Using those = no problems.

Hey, I am having this same issue. Got it to work once but don't remember what I did no luck.
Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
Exporting an SMB share failed! Details about the failure are shown
below. Please inspect the error message and correct any problems.

Host path:

Stderr:

Stdout:

Nevermind! To figure this out make sure that you have read and write permissions to that location. I used my documents folder and it works perfectly.

Was this page helpful?
0 / 5 - 0 ratings