Unable to mount Shared folders using a custom box with the VMware provider

Hi Vagrant team, I’m trying to use vagrant with the vmware plugin and I’m encountering issues when using shared folders in the Vagrantfile. The shared folders does not seem to get mounted.

Version information:

  • macOS 11.2.3
  • Vagrant 2.2.16
  • VMware Fusion Player 12.1.2 (17964953)
  • Vagrant VMware Utility 1.0.20
  • Vagrant VMware Desktop Plugin 3.0.0

The Vagrantfile I’m using:

Vagrant.configure("2") do |config|
  config.vm.synced_folder "~/code", "/mnt/code"
  config.vm.define "nixos2009" do |nixos2009|
      nixos2009.vm.box = "manojkarthick/nixos-20.09-x86_64"
      nixos2009.vm.hostname = "nixos2009"
      config.vm.provider :vmware_desktop do |v|
          v.gui = false
          v.memory = 1024
          v.cpus = 1
          v.vmx["ethernet0.pcislotnumber"] = "33"
      end
  end
end

When I use vagrant up to bring up the VM, I’m getting the following error:

❯ vagrant up
Bringing machine 'nixos2009' up with 'vmware_desktop' provider...
==> nixos2009: Verifying vmnet devices are healthy...
==> nixos2009: Preparing network adapters...
==> nixos2009: Fixed port collision for 22 => 2222. Now on port 2200.
==> nixos2009: Starting the VMware VM...
==> nixos2009: Waiting for the VM to receive an address...
==> nixos2009: Forwarding ports...
    nixos2009: -- 22 => 2200
==> nixos2009: Waiting for machine to boot. This may take a few minutes...
    nixos2009: SSH address: 127.0.0.1:2200
    nixos2009: SSH username: vagrant
    nixos2009: SSH auth method: private key
==> nixos2009: Machine booted and ready!
==> nixos2009: Setting hostname...
==> nixos2009: Configuring network adapters within the VM...
==> nixos2009: Waiting for HGFS to become available...
==> nixos2009: Enabling and configuring shared folders...
An error occurred while executing `vmrun`, a utility for controlling
VMware machines. The command and output are below:

Command: ["enableSharedFolders", "/Users/manojkarthick/code/vms/nixos2009/.vagrant/machines/nixos2009/vmware_desktop/9a1d9c4c-9646-4358-858e-05d15182db9d/packer-vmware-iso.vmx", {:notify=>[:stdout, :stderr]}]

Stdout: Error: There was an error mounting the Shared Folders file system inside the guest operating system

Stderr:

I tried to use the vmware plugin with the hashicorp/bionic64 box and it seems to work without any issues.

I found an issue with a similar error on the github issue tracker, Vagrant fails with There was an error mounting the Shared Folders file system inside the guest operating system · Issue #10464 · hashicorp/vagrant · GitHub - but the shared folders seem to get mounted for the reporter though it reports an error when running vagrant up - but in my case the folders don’t get mounted.

I used the same process to build a virtualbox box and that doesn’t seem to have any issues mounting the folder. Any help would be greatly appreciated!

Hey there,
looks like this is an issue with the box. Using a different nixOS box but otherwise same setup produces no error. I used griff/nixos-stable-x86_64.

In order to use shared folders with VMWare, the guest needs to have the VMWare tools installed and a sufficiently up to date kernel.

1 Like

I just tried with the griff/nixos-stable-x86_64 and works for me as well. I will try to use that. Thanks a lot @soapy1 !