vagrant version : 1.7.4
virtual box version : 5.0.10 r 104061
windows version : 7 Pro
When I try to mount a sharedfolder from C:/ in my VagrantFile :
config.vm.synced_folder "C:\\", "/c"
the up command launch this message :
==> default: Checking if box 'ubuntu/vivid64' is up to date...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["sharedfolder", "add", "d88ddc9e-5c85-41a3-84dd-96dcec90be20", "--name", "b", "--hostpath", "C:\\"]
Stderr: VBoxManage.exe: error: Shared folder path 'C:"' is not absolute
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component SharedFolderWrap, interface ISharedFolder, callee IUnknown
VBoxManage.exe: error: Context: "CreateSharedFolder(Bstr(name).raw(), Bstr(hostpath).raw(), fWritable, fAutoMount)" at line 1020 of file VBoxManageMisc.cpp
Even by adding some more \\ to the C:\\ it doesn't work. I've tried this too :
config.vm.provider "virtualbox" do |v|
v.customize ["sharedfolder", "add", :id, "--name", "c", "--hostpath", "C:\\\\" ]
end
It worked, but I had to mount the folder myself.
I have the same issue on latest version (1.8.0), look like a bug since it outputs this in debug mode:
SharedFolderPathMachineMapping1="\\?\D:""
(have an extra double quote ")
OK, I am able to make it works by this fix:
In C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.0\lib\vagrant\util\platform.rb, change this method
def windows_unc_path(path)
"\\\\?\\" + path.gsub("/", "\\")
end
to
def windows_unc_path(path)
path = path.gsub("/", "\\")
# Check if the path is drive only (e.g D:/), then return it as-is (e.g D:\\)
# since UNC format will cause Protocol error
if path =~ /^[a-zA-Z]:[\\]$/
return path + "\\"
end
"\\\\?\\" + path
end
Great fix @hiephm thanks I'll do this now.
Fixed
Hi @mitchellh ,
The current version of platform.rb in 1.8.1 seems to miss the 'critical' double slash operator that @hiephm suggested. Therefore, the error still occurs. If you add the double slashes, the error will disappear.
Current version:
def windows_unc_path(path)
path = path.gsub("/", "\\")
# If the path is just a drive letter, then return that as-is
return path if path =~ /^[a-zA-Z]:\\?$/
# Convert to UNC path
"\\\\?\\" + path.gsub("/", "\\")
end
Suggested version:
def windows_unc_path(path)
path = path.gsub("/", "\\")
# If the path is just a drive letter, then return that as-is
return path + "\\" if path =~ /^[a-zA-Z]:\\?$/
# Convert to UNC path
"\\\\?\\" + path.gsub("/", "\\")
end
Thanks in advance,
Peter
Hi @PeterMosmans
Would you like to submit a Pull Request?
@sethvargo No problem - give me a minute :smile:
Confirmed, I just updated to 1.8.1 and now I'm now getting this error when trying to re-provision a box that was working previously with a network shared folder.
Thanks for sharing the fix, I'll try it now!
Jan1torEarl is correct, this appears to still be an issue on 1.8.1 for Windows. @PeterMosmans solution worked for me.
@Jan1torEarl @auzmartist I can confirm this bug on 1.8.1 for Windows 10. @PeterMosmans solution worked for me. Please resolve this issue. Thanks.
I confirm this bug for 1.8.1 on Windows 7. @PeterMosmans solution worked for me.
I confirm this bug for 1.8.1 on WIndows 10 and @PeterMosmans solution worked for me.
@sethvargo can we get this in then?
@sethvargo we can also confirm that this is a bug in Windows 7 with Vagrant v1.8.1 and VirtualBox v4.3.36
I confirm this bug for 1.8.1 on WIndows 10. @PeterMosmans solution worked for me.
Unfortunately the bug is still present in 1.8.4 running on Windows 10 - @sethvargo @mitchellh could you please review and merge the pull request in #6765 ? Thanks in advance!
Peter
fix this already will you
@sethvargo this has been fixed over half a year ago, yet not merged, why?
@Stanzilla because I'm one person and I don't have access to a Windows machine to test the changes.
That's alright, we all have already tested the changes for ya.聽
@sethvargo If I can expedite the process by running testsuites on my machine and post the output - let me know...
I'm facing this problem.
Windows 10
Vagrant 1.8.1
VirtualBox: Version 5.0.12 r104815
Problem still ocurring.
Windows 7
Vagrant 1.8.4
@PeterMosmans solution fixed it
Problem occuring on
Windows 10
Vagrant: 1.8.4
Latest version, problem still here. Vagrant code changed but it's not returning path + ""
Hi @Head - the code has changed somewhat in the meantime (so my patch probably needs a little adjustment). However, have you tried implementing https://github.com/mitchellh/vagrant/issues/6598#issuecomment-167481979 ?
Cheers,
Peter
I just tried the #6598 comment fix but it did not help. On 1.8.5.
My config says
config.vm.synced_folder "D:\Dev", "C:\DevTest"
@sanj75 are you sure ? I created a new patch, based on the 1.8.5 release. As far as I can see the patch still works. @sethvargo @mitchellh It would be greatly appreciated if this patch makes it into the next version, as this is _still_ a bug. Thanks !
diff -Nur Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/platform.rb Vagrant-original/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/platform.rb
--- Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/platform.rb 2016-07-27 05:10:03.800905700 +0000
+++ Vagrant-original/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/platform.rb 2016-07-19 10:43:42.000000000 +0000
@@ -200,7 +200,7 @@
path = path.gsub("/", "\\")
# If the path is just a drive letter, then return that as-is
- return path + "\\" if path =~ /^[a-zA-Z]:\\?$/
+ return path if path =~ /^[a-zA-Z]:\\?$/
# Convert to UNC path
"\\\\?\\" + path.gsub("/", "\\")
Easiest solution: save the above code to a patch file in the Vagrant directory, and apply as patch -Np1 -i patchfile
Less easy solution: patch the file by hand by opening Vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/util/platform.rb and editing line 203
Sadly they don't care about Windows users :)
This should not be closed please. Vagrant 1.8.5 and Virtualbox 5.1.4 it still exist.
Vagrant file:
config.vm.synced_folder "C:", "/C_Drive"
config.vm.synced_folder "G:", "/G_Drive"
[C:\Usersjim\Virtual-VMs\vagrant-puppet>vagrant reload
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["sharedfolder", "add", "4e7654a2-9425-4f9e-af6a-c0708d6fab85", "--name", "C_Drive", "--hostpath", "C:"]
Stderr: VBoxManage.exe: error: Shared folder path 'C:"' is not absolute
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component SharedFolderWrap, interface ISharedFolder, callee IUnknown
VBoxManage.exe: error: Context: "CreateSharedFolder(Bstr(name).raw(), Bstr(hostpath).raw(), fWritable, fAutoMount)" at line 1020 of file VBoxManageMisc.cpp
C:\Usersjim\Virtual-VMs\vagrant-puppet>](url)
For all others that end up here, this was fixed in v1.8.6 which was released September 27th, 2016.
v1.8.1 (released December 24, 2015) "fixed" yet still incorrect:
return path if path =~ /^[a-zA-Z]:\\?$/
https://github.com/mitchellh/vagrant/blob/v1.8.1/lib/vagrant/util/platform.rb#L191
_...insert 8 months of frustrated Windows users here :grimacing:..._
v1.8.6 (released September 27th, 2016) corrected line:
return path + "\\" if path =~ /^[a-zA-Z]:\\?$/
https://github.com/mitchellh/vagrant/blob/v1.8.6/lib/vagrant/util/platform.rb#L203
Most helpful comment
This should not be closed please. Vagrant 1.8.5 and Virtualbox 5.1.4 it still exist.
Vagrant file:
config.vm.synced_folder "C:", "/C_Drive"
config.vm.synced_folder "G:", "/G_Drive"
[C:\Usersjim\Virtual-VMs\vagrant-puppet>vagrant reload
There was an error while executing
VBoxManage, a CLI used by Vagrantfor controlling VirtualBox. The command and stderr is shown below.
Command: ["sharedfolder", "add", "4e7654a2-9425-4f9e-af6a-c0708d6fab85", "--name", "C_Drive", "--hostpath", "C:"]
Stderr: VBoxManage.exe: error: Shared folder path 'C:"' is not absolute
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component SharedFolderWrap, interface ISharedFolder, callee IUnknown
VBoxManage.exe: error: Context: "CreateSharedFolder(Bstr(name).raw(), Bstr(hostpath).raw(), fWritable, fAutoMount)" at line 1020 of file VBoxManageMisc.cpp
C:\Usersjim\Virtual-VMs\vagrant-puppet>](url)