how to solve this SMB share folder when vagrant sync folder fail in this case? - vagrant

I have a vagrant in my Win10 PC.
Vagrant.configure("2") do |config|
config.vm.box = "generic/centos7"
config.vm.synced_folder "D:/Users/88888888/vagrant_proj/vagrant_data", "/vagrant_data"
config.vm.network "private_network", ip: "172.22.244.28"
end
When I vagrant up my vm, I get below error when sync folder:
MINGW64 ~/vagrant_proj/vagrant_vm/vmware_desktop_centos7
$ vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
default: Configuring the VM...
default: Setting VM Enhanced session transport type to disabled/default (VMBus)
Vagrant requires administrator access for pruning SMB shares and
may request access to complete removal of stale shares.
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
default: Timeout: 120 seconds
default: IP: 172.22.244.28
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 172.22.244.28:22
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Preparing SMB shared folders...
default: You will be asked for the username and password to use for the SMB
default: folders shortly. Please use the proper username/password of your
default: account.
default:
default: Username (user[#domain]): ABC\88888888
default: Password (will be hidden):
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
default: Password (will be hidden): Aircraft04!
Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> default: Mounting SMB shared folders...
default: D:/Users/88888888/vagrant_proj/vagrant_data => /vagrant_data
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 vers=2.0,credentials=/etc/smb_creds_vgt-2d3036366c24d0c86eee3d4f63f20f4f-adda498f781708cde2d8e46c475e9593,uid=1000,gid=1000,mfsymlinks,_netdev,nofail //10.0.129.112/vgt-2d3036366c24d0c86eee3d4f63f20f4f-adda498f781708cde2d8e46c475e9593 /vagrant_data
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)
how to solve this SMB share folder?
the version is below:
$ vagrant.exe --version
Vagrant 2.2.19
and I use the vagrant HyperV provider.

Related

Hashicorp Vagrant - How to authenticate against SMB if I have Microsoft Account on my windows host

I have a windows 10 host and I would like to set up Synced Folders for my vagrant box. In my Vagrantfile I have:
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/bionic64"
config.vm.synced_folder "./data", "/vagrant_data"
end
When I start up (or reload) my box, I get prompted for credentials:
PS D:\Vagrants\first> vagrant reload
==> default: Attempting graceful shutdown of VM...
default: Configuring the VM...
default: Setting VM Enhanced session transport type to disabled/default (VMBus)
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
default: Timeout: 120 seconds
default: IP: 172.27.23.149
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 172.27.23.149:22
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Preparing SMB shared folders...
default: You will be asked for the username and password to use for the SMB
default: folders shortly. Please use the proper username/password of your
default: account.
default:
default: Username (user[#domain]):
Either format I try to specify my microsoft credentials, it gets rejected. I tried both with and without windows PIN. Suppose my Microsoft account is username#outlook.com and password is mypass. Workgroup name on my windows machine is WORKGROUP.
I found a solution by:
disabling the Windows PIN and
as username using my "local" windows username (determined by windows environment variable %username% which also seems to equal to the folder named under C:\Users\USERNAME. Note that this is not the same as my Microsoft Account username) and
as password using my Microsoft Account password

Vagrant - Failed to mount folders in Linux Guest using Puphpet and SMB mounting

I'm trying to set up Vagrant on Windows 10.
I have Vagrant 2.0.1, Virtual Box 5.2.4 and Guest Additions 5.2.4.
I had issues whilst Virtual Box and Guest Additions were not the same versions, but now I've bought them inline with each other I still get an error.
I am running Git Bash as Administrator too. Here is the output from git bash.
The vagrantfile is generated through Puphpet and I didn't really change much within puphpet setup. I added SMB for the shared folders as it recommended this. I did not supply a username or password, and when prompted for both during vagrant up I just leave them both blank.
I've seen and read the other articles on SO and not had any luck with them.
$ vagrant up Bringing machine 'machine1' up with 'virtualbox' provider...
==> machine1: Importing base box 'bento/ubuntu-16.04'...
==> machine1: Matching MAC address for NAT networking...
==> machine1: Checking if box 'bento/ubuntu-16.04' is up to date...
==> machine1: Setting the name of the VM: Ubuntu_machine1_1517300867334_22288
==> machine1: Preparing SMB shared folders...
machine1: You will be asked for the username and password to use for the SMB
machine1: folders shortly. Please use the proper username/password of your
machine1: Windows account.
machine1:
machine1: Username:
machine1: Password (will be hidden): Error! Your console doesn't support hiding input. We'll ask for input again below, but we WILL NOT be able to hide input. If this is a problem for you, ctrl-C to exit and fix your stdin.
machine1: Password (will be hidden):
==> machine1: Clearing any previously set network interfaces...
==> machine1: Preparing network interfaces based on configuration...
machine1: Adapter 1: nat
machine1: Adapter 2: hostonly
==> machine1: Forwarding ports...
machine1: 22 (guest) => 5741 (host) (adapter 1)
machine1: 22 (guest) => 2222 (host) (adapter 1)
==> machine1: Running 'pre-boot' VM customizations...
==> machine1: Booting VM...
==> machine1: Waiting for machine to boot. This may take a few minutes...
machine1: SSH address: 127.0.0.1:2222
machine1: SSH username: vagrant
machine1: SSH auth method: private key
==> machine1: Machine booted and ready! [machine1] GuestAdditions 5.2.4 running --- OK.
==> machine1: Checking for guest additions in VM...
==> machine1: Setting hostname...
==> machine1: Configuring and enabling network interfaces...
==> machine1: Mounting SMB shared folders...
machine1: E:/Simon/Sites => /var/www 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:
PASSWORDHIDDENmPASSWORDHIDDENoPASSWORDHIDDENuPASSWORDHIDDENnPASSWORDHIDDENtPASSWORDHIDDEN PASSWORDHIDDEN-PASSWORDHIDDENtPASSWORDHIDDEN PASSWORDHIDDENcPASSWORDHIDDENiPASSWORDHIDDENfPASSWORDHIDDENsPASSWORDHIDDEN PASSWORDHIDDEN-PASSWORDHIDDENoPASSWORDHIDDEN PASSWORDHIDDENuPASSWORDHIDDENiPASSWORDHIDDENdPASSWORDHIDDEN=PASSWORDHIDDEN3PASSWORDHIDDEN3PASSWORDHIDDEN,PASSWORDHIDDENgPASSWORDHIDDENiPASSWORDHIDDENdPASSWORDHIDDEN=PASSWORDHIDDEN3PASSWORDHIDDEN3PASSWORDHIDDEN,PASSWORDHIDDENmPASSWORDHIDDENfPASSWORDHIDDENsPASSWORDHIDDENyPASSWORDHIDDENmPASSWORDHIDDENlPASSWORDHIDDENiPASSWORDHIDDENnPASSWORDHIDDENkPASSWORDHIDDENsPASSWORDHIDDEN,PASSWORDHIDDENdPASSWORDHIDDENiPASSWORDHIDDENrPASSWORDHIDDEN_PASSWORDHIDDENmPASSWORDHIDDENoPASSWORDHIDDENdPASSWORDHIDDENePASSWORDHIDDEN=PASSWORDHIDDEN0PASSWORDHIDDEN7PASSWORDHIDDEN7PASSWORDHIDDEN5PASSWORDHIDDEN,PASSWORDHIDDENfPASSWORDHIDDENiPASSWORDHIDDENlPASSWORDHIDDENePASSWORDHIDDEN_PASSWORDHIDDENmPASSWORDHIDDENoPASSWORDHIDDENdPASSWORDHIDDENePASSWORDHIDDEN=PASSWORDHIDDEN0PASSWORDHIDDEN6PASSWORDHIDDEN6PASSWORDHIDDEN4PASSWORDHIDDEN,PASSWORDHIDDENvPASSWORDHIDDENePASSWORDHIDDENrPASSWORDHIDDENsPASSWORDHIDDEN=PASSWORDHIDDEN3PASSWORDHIDDEN.PASSWORDHIDDEN0PASSWORDHIDDEN,PASSWORDHIDDENsPASSWORDHIDDENePASSWORDHIDDENcPASSWORDHIDDEN=PASSWORDHIDDENnPASSWORDHIDDENtPASSWORDHIDDENlPASSWORDHIDDENmPASSWORDHIDDEN,PASSWORDHIDDENcPASSWORDHIDDENrPASSWORDHIDDENePASSWORDHIDDENdPASSWORDHIDDENePASSWORDHIDDENnPASSWORDHIDDENtPASSWORDHIDDENiPASSWORDHIDDENaPASSWORDHIDDENlPASSWORDHIDDENsPASSWORDHIDDEN=PASSWORDHIDDEN/PASSWORDHIDDENePASSWORDHIDDENtPASSWORDHIDDENcPASSWORDHIDDEN/PASSWORDHIDDENsPASSWORDHIDDENmPASSWORDHIDDENbPASSWORDHIDDEN_PASSWORDHIDDENcPASSWORDHIDDENrPASSWORDHIDDENePASSWORDHIDDENdPASSWORDHIDDENsPASSWORDHIDDEN_PASSWORDHIDDENbPASSWORDHIDDEN6PASSWORDHIDDEN5PASSWORDHIDDEN0PASSWORDHIDDENcPASSWORDHIDDEN4PASSWORDHIDDEN2PASSWORDHIDDEN2PASSWORDHIDDENePASSWORDHIDDEN5PASSWORDHIDDEN5PASSWORDHIDDENbPASSWORDHIDDEN2PASSWORDHIDDENcPASSWORDHIDDENfPASSWORDHIDDEN1PASSWORDHIDDEN4PASSWORDHIDDENfPASSWORDHIDDENaPASSWORDHIDDEN0PASSWORDHIDDEN5PASSWORDHIDDENcPASSWORDHIDDEN1PASSWORDHIDDEN8PASSWORDHIDDEN6PASSWORDHIDDENfPASSWORDHIDDEN0PASSWORDHIDDEN3PASSWORDHIDDEN4PASSWORDHIDDEN7PASSWORDHIDDEN3PASSWORDHIDDENcPASSWORDHIDDEN PASSWORDHIDDEN/PASSWORDHIDDEN/PASSWORDHIDDEN1PASSWORDHIDDEN9PASSWORDHIDDEN2PASSWORDHIDDEN.PASSWORDHIDDEN1PASSWORDHIDDEN6PASSWORDHIDDEN8PASSWORDHIDDEN.PASSWORDHIDDEN1PASSWORDHIDDEN.PASSWORDHIDDEN7PASSWORDHIDDEN0PASSWORDHIDDEN/PASSWORDHIDDENbPASSWORDHIDDEN6PASSWORDHIDDEN5PASSWORDHIDDEN0PASSWORDHIDDENcPASSWORDHIDDEN4PASSWORDHIDDEN2PASSWORDHIDDEN2PASSWORDHIDDENePASSWORDHIDDEN5PASSWORDHIDDEN5PASSWORDHIDDENbPASSWORDHIDDEN2PASSWORDHIDDENcPASSWORDHIDDENfPASSWORDHIDDEN1PASSWORDHIDDEN4PASSWORDHIDDENfPASSWORDHIDDENaPASSWORDHIDDEN0PASSWORDHIDDEN5PASSWORDHIDDENcPASSWORDHIDDEN1PASSWORDHIDDEN8PASSWORDHIDDEN6PASSWORDHIDDENfPASSWORDHIDDEN0PASSWORDHIDDEN3PASSWORDHIDDEN4PASSWORDHIDDEN7PASSWORDHIDDEN3PASSWORDHIDDENcPASSWORDHIDDEN PASSWORDHIDDEN/PASSWORDHIDDENvPASSWORDHIDDENaPASSWORDHIDDENrPASSWORDHIDDEN/PASSWORDHIDDENwPASSWORDHIDDENwPASSWORDHIDDENwPASSWORDHIDDEN
The error output from the last command was:
mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Thanks!
So after reading closer, the username/password it asks for is your windows username and password. Now, that doesn't help in windows 10 if you have run through the setup process and created a Windows account online. If you have the same problems as me, make sure to check your account settings under account management, and "switch to local account" to create a local account for yourself. You'll be prompted to supply a password (needed, as PIN didn't work either). Log in to this user, and try again supplying your new credentials.
I hope this helps someone.

Vagrant + Hyper V IPV6 addresses Assigned

I have been having a lot of troubles with Vagrant 2.0.1 on Windows 10 with Hyper V.
When I do vagrant up I receive an ipv6 address. Which chef can't access and fails to provision the virtual:
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Configured startup memory is 2048
==> default: Configured cpus number is 2
==> default: Importing a Hyper-V instance
default: Cloning virtual hard drive...
default: Creating and registering the VM...
default: Setting VM Integration Services
default: Successfully imported a VM with name: vargrant-dev-source
==> default: Installing Chef cookbooks with Librarian-Chef...
==> default: Auto-generating node name for Chef...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
default: Timeout: 120 seconds
default: IP: fe80::215:5dff:fe02:f5a
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: fe80::215:5dff:fe02:f5a:22
default: SSH username: vagrant
default: SSH auth method: private key
... Eventually times out here ....
I used the following commands to set up a NATed switch:
New-VMSwitch –SwitchName “NATSwitch” –SwitchType Internal
New-NetIPAddress –IPAddress 172.21.21.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"
New-NetNat –Name MyNATnetwork –InternalIPInterfaceAddressPrefix 172.21.21.0/24
Interestingly everything works the first time I set up the VM switch and I get a valid IPV4 address and things are okay. But after I reboot the virtual machines will only ever get IPV6 addresses and I cant access existing ones created before the reboot.
My vagrant file:
Vagrant.configure("2") do |config|
config.vm.provider "hyperv"
config.vm.box = "maxx/ubuntu16"
config.vm.boot_timeout = 2000
config.vm.network "private_network", ip: "172.21.21.2"
... general config omitted.
end
I have tried both DHCP and static and both seem to fail. With static IP seemingly ignored completely.
Any ideas what I'm missing or doing wrong? (I am using a wifi connection if that is relevant)
I found a way around it by using internet connection sharing between my wifi and the virtual hyper v network. But currently, there is a bug in windows build 1607 where internet connection sharing needs to be restarted after every reboot.
A large thread here on the MS forums:
https://answers.microsoft.com/en-us/windows/forum/windows_10-networking/ics-internet-connection-sharing-dosent-work-in/a203c90f-1214-4e5e-ae90-9832ae5ceb55

Vagrant sync folder doesn't work on windows 10

I'm trying to sync folders from a windows 10 hosto to a ubuntu guest but I get this error:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 8080 (guest) => 8080 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.36
default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
default: /vagrant => C:/sync_workspace
default: /sync_workspace => C:/sync_workspace
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 vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`,nolock,vers=3 core /sync_workspace
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant`,nolock,vers=3 core /sync_workspace
The error output from the last command was:
stdin: is not a tty
unknown mount option `nolock'
valid options:
rw mount read write (default)
ro mount read only
uid =<arg> default file owner user id
gid =<arg> default file owner group id
ttl =<arg> time to live for dentry
iocharset =<arg> i/o charset (default utf8)
convertcp =<arg> convert share name from given charset to utf8
dmode =<arg> mode of all directories
fmode =<arg> mode of all regular files
umask =<arg> umask of directories and regular files
dmask =<arg> umask of directories
fmask =<arg> umask of regular files
Here is my Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.synced_folder "C:/Users/rafa/Documents/personal docs", "/vagrant_data/sync_workspace"
end
Host : Windows 10
Guest: Ubuntu
Vagrant: 1.8.1
VirtualBox : Version 5.0.20 r106931
Any Help?
Install the vagrant vaguest plugin and let it install the host's VirtualBox Guest Additions on the guest system and in your case it will update your guest addition
Also try apt-get update in your guest OS.

vboxsf error when passing owner,group and mount options parameters

Vagrant Version 1.6.3
Virtual Box 4.3.12
VBoxGuestAdditions-4.3.2
Host OS -> Windows 8
Guest OS -> CentOS 6.5
Vagrant synced_folder works fine when this is the content of Vagrentfile
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www"
But I am unable to change the permissions of files or directories in synced_folder (/var/www).
https://github.com/mitchellh/vagrant/issues/897
To solve this problem I made following changes in Vagrentfile
https://serverfault.com/questions/398414/vagrant-set-default-share-permissions
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www",
:owner=> 'shiva',
:group=> 'shiva',
:mount_options=> ['dmode=>777', 'fmode=>666']
(where 'shiva' is the user which I created, I deleted the default user 'vagrant')
Now the problem is when I try to do vagrant up ,it shows this error
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: shiva
default: SSH auth method: password
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /var/www => C:/Users/Shiva/CentOSDevEnv_v1_1
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 vboxsf -o uid=`id -u shiva`,gid=`getent group shiva | cut -d: -
f3`,dmode=>777,fmode=>666 var_www /var/www
mount -t vboxsf -o uid=`id -u shiva`,gid=`id -g shiva`,dmode=>777,fmode=
>666 var_www /var/www
I already go through this link
https://github.com/mitchellh/vagrant/issues/3341
I don't know ruby syntax (Vagrantfile syntax).
I am really stuck here, please help.
The error was in my Vagrantfile syntax, my bad :(
This is the correct syntax
:mount_options=> ['dmode=777', 'fmode=666']
But it would be more helpful if vagrant can show the correct error information , something like
"Error in Vagrantfile syntax"
instead of
"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."

Resources