Versions
- Host: MacOS 11.4
- Guest: Windows Server 2016
- vagrant: 2.2.17
- vagrant-vmware-utility: 1.0.20
- vagrant-vmware-desktop: 3.0.0
- VMware tools: VMware-tools-11.3.0-18090558-x86_64.exe
- VMware Fusion: 12.1.2
I’ve built a custom Windows Server 2016 box using packer with two builders - vmware-iso and virtualbox. Synced folders work fine on the Virtualbox box.
On the VMware box, the default synced folder works as expected - mounting at c:\vagrant
. Any other synced folders, however do not work properly. A symlink gets created at the defined location, but the symlink’s target doesn’t exist. It appears that the vmware-desktop plugin expects the target to be somewhere else.
For example, given this Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "winserver2016"
config.vm.synced_folder "../../", 'c:\\Users\\vagrant\\dev'
end
A symlink gets created on the guest at c:\Users\vagrant\dev, but it points to \\vmware-host\Shared Folders\c:\Users\vagrant\dev
- a location that does not exist.
If I open \\vmware-host\Shared Folders
, the dev location is instead listed as c^%@%Users@%vagrant%@dev
. Is this a bug, or am I doing something wrong?
For now, I’ve worked around this by adding a script that replaces the symlink. This works, but isn’t ideal.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Workaround for vmware provider shared folder
$vmware_mount = <<-'VMWARE_MOUNT'
(Get-Item C:\Users\vagrant\dev).Delete()
New-Item -ItemType SymbolicLink -Path C:\Users\vagrant\dev -Target "\\vmware-host\Shared Folders\c^%@%Users@%Vagrant@%dev"
VMWARE_MOUNT
Vagrant.configure("2") do |config|
config.vm.box = "winserver2016"
config.vm.synced_folder "../../", 'c:\\Users\\vagrant\\dev'
config.vm.provider :vmware_desktop do |v, override|
override.vm.provision "shell", inline: $vmware_mount
end
end