hashicorp/vagrant

Windows UNC path is crashing with \\\\?\\ prefix

kloining opened this issue ยท 30 comments

Vagrant 1.9.2
Virtualbox 5.1.16
Windows 10

With Virtualbox 5.1.16 the windows UNC path for
shared folder is registered as \?\C:\Users\username\git\repository.
Mounting /vagrant fails with The folder ... not found.

lib/vagrant/util/platform.rb
By changing
"\\?\" + path.gsub("/", "\")
to
path.gsub("/", "\")
everything started to work again.

I'm having the same issue and from what I can understand it is because of the update of Virtualbox to 5.1.16

Ran into the same issue; installed 5.1.14 which works fine for the moment.

Also having this problem with the same configuration. I can also confirm that reverting to 5.1.14 makes everything work again.

just update virtualbox to 5,1.16 and got same issue here..
@kloining 's solution is just work

It is the same for me including the workaround fixing the issue for now.

Note: The Guest Additions version does not matter in my setup using the box ubuntu/xenial64, updating does not solve the issue. The question related to this answer at stackoverflow may offer some additional information. At least it describes what has been tried without success.

it's the same thing that happened 2 years ago #5933

Closing this as it is an upstream issue and downgrading resolves the issue. Thanks for the report and confirmation that downgrade does resolve the issue. Cheers!

@chrisroberts is there a link to the upstream bug somewhere?

@l8nite Right now there is a thread running here:

https://forums.virtualbox.org/viewtopic.php?f=6&t=82165

There is a claim in that thread that VirtualBox does not support UNC paths for shared folders, but it seems that the claim is conflating remote share paths with local long paths.

At this point, Vagrant is blaming VirtualBox, and VirtualBox is blaming Vagrant.

Here's what we know:

  • Upgrading from VirtualBox 5.1.14 to 5.1.16 causes this problem. Downgrading resolves it.
  • While NFS mounts also seem to fail, VirtualBox's native "Shared Folder" mounts fail, too (and perhaps cause the subsequent NFS mounting failures).
  • The issue seems to affect Windows hosts only. We have confirmed reports from Windows 7 and Windows 10 thus far (that I've seen, anyway).
  • Consistent with the above item, and per the OP, the issue seems related to the \\?\ "extended-length" path notation that is explained in detail at https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx . This notation works perfectly well in VirtualBox 5.1.14.
  • Updating the Guest Additions and by extension rebuilding the kernel modules in the guest OS does not change the behavior.
  • The guest OS seems to be irrelevant; we have reports of failures in both RedHat and Ubuntu guest OSes.
  • The same thing happened two years ago, reportedly. And upgrading VirtualBox fixed it (points finger at VirtualBox).

i got the save problem.
VirtualBox Downgrade VirtualBox 5.1.16 to 5.1.14

Time to switch to Hyper-V & Docker?!

I do not agree @chrisroberts that this should be closed as an "upstream issue", when more and more users are going to upgrade VirtualBox the coming days. This problem is just going to be bigger and bigger, until either VirtualBox reverts their changes in the closest future - or Vagrant makes the needed change.

If VirtualBox doesn't do the change quite soon, Vagrant will have to adapt.

Edit: If the referenced NFS mount bug is meant to cover this bug as well, never mind the comment about closing the ticket.

I don't understand why Vagrant developers don't remove ugly "\\?\" prefix to fix the bug in their product?!

Virtualbox 5.1.16 perfectly mount shared folders with correct path (without "\\?\" prefix).

https://www.virtualbox.org/manual/ch04.html#sharedfolders
VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"

Vagrant tries to mount it with "\\?\C:\test"

@lystor Disclaimer: I'm not a Vagrant developer.

My best guess is that the \\?\ notation is intended to avoid problems that arise due to the Windows path length limitations that exist in older Windows API methods. I provided a link to the relevant documentation a couple of posts back, which explains this notation's purpose.

If you've ever used a package manager (npm for JS, Composer for PHP, etc.) with network-mounted filesystems, you may have noticed that filesystem operations sometimes fail due to the excessive path lengths that result from deeply-nested repository structures, which often contain extremely long file and directory names.

Perhaps the Vagrant developers sought to mitigate some of the problems associated with the age-old limitations on Windows path lengths by taking advantage of this \\?\ syntax.

That said, I agree with you and the OP that Vagrant may have no choice but to implement some form of workaround in the interest of not bringing the VirtualBox users to a grinding halt over this issue.

Hi there everyone. Just wanted to drop a couple notes here.

First, the \\?\ path prefix is the Windows defined method for specifying long path names. There is currently work underway within the Vagrant internals to automatically modify all path usage to this style to prevent bugs that occur when long paths are generated due to directory depths combined with long path names. While the path may "look" ugly, this is how long paths should be handled on Windows. You can find more information about that in @cbj4074's comment here: #8352 (comment)

Second, this has been confirmed as a regression in VirtualBox. The relevant ticket which has been re-opened is here: https://www.virtualbox.org/ticket/14651

If you are using VirtualBox on Windows and running into this problem, it will be easiest to downgrade to 5.1.14 until the regression is fixed.

Thanks for all the reports and apologies for the inconvenience. Cheers!

Great report @chrisroberts.
The reopened ticket on VirtualBox confirms this is an issue in VirtualBox, which is a totally different status than in the first referenced thread at VB (where Vagrant got all the blame). Is it possible to make this issue show as visible under issues, even though it's closed? This thread will probably help quite a few people.

@kloining The first referenced thread on the VirtualBox forums acknowledges that it is a regression at the bottom of the thread.

Was having the same issue. Can confirm that uninstalling VirtualBox-5.1.16 and reinstalling 5.1.14 solved my issue.

lib/vagrant/util/platform.rb where is it ? can you please enter the complete path please ฤฑ just couldnt find it to change :/ @kloining

This issue is resolved in VirtualBox preview build 5.1.17 revision 113984

This issue looks like to be fixed in the new Virtualbox version 5.1.18.

Confirmed it is fixed in 5.1.18

stopped working again with Virtualbox version 5.1.20.

5.1.22 just came out on Friday. Has anyone tested yet? (I'm on a Mac, but most of my team is on Windows, and a colleague got bitten on 5.1.20 last week, then downgraded to 5.1.18 to get working again.)

Also, the VirtualBox ticket doesn't seem to have been reopened for regression for 5.1.20 (it's still marked fixed in 5.1.18), so VirtualBox probably doesn't know there's a problem.

I am running VirtualBox 5.1.22 with Vagrant 1.9.5, and once the correct VM Tools are installed on the guest, this appears to work as expected.

I'm Using Windows 10 and Vagrant version 1.9.5

Recently I've downloaded Docker Toolbox, as a part of the installation they asked me to upgrade to Virtualbox from version 4.3.40 to 5.1.20, so I did.
Mounting shared folders did not work sense then with Vagrant, so I had to downgrade my virtualbox unfurtonetly to 4.3.40 and it all back to work again.
So I can confirm this issue

Hello, I am totally not anywhere near your realm of being when it comes to programing. However I am compelled to help myself, especially since there is no one around to assist me. So I am hoping some one will be able to assist me. I am adding email accounts to my iMac. when I try to add a <www.homestead.com> email account it ask me for a (path prefix) I am howling for assistance. Yes, I looked up what it means....it's all greek to me. Can someone assist me with obtaining a (path prefix) so I can add my email account. I am using (pop@homestead.com). HELP, HELP!

SnowQueenWolf

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.