Question

Getting this error during vagrant up --provider=vmware_fusion:

[default] Waiting for HGFS kernel module to load... The HGFS kernel module was not found on the running virtual machine. This must be installed for shared folders to work properly. Please install the VMware tools within the guest and try again. Note that the VMware tools installation will succeed even if HGFS fails to properly install. Carefully read the output of the VMware tools installation to verify the HGFS kernel modules were installed properly.

Googling, I see that this is related to the problem

$ lsmod | grep -i '^vmhgfs' $

but I'm not clear what the solution is.

I've installed VMWare tools in my base vmx that is being built by packer:

$ vmware- vmware-checkvm vmware-uninstall-tools.pl vmware-config-tools.pl vmware-user vmware-hgfsclient vmware-vmblock-fuse vmware-rpctool vmware-xdg-detect-de vmware-toolbox-cmd vmware-xferlogs

I also enabled Shared Folders in the VMWare settings

Any ideas what I can do?

  • Some packer setting to enable HGFS?
  • Something to change in the base vmx?
Was it helpful?

Solution

Answered by @mitchellh on twitter

VMWare tools installation is silently failing during install because of missing gcc and linux headers. I didn't see the error because I was running sudo ./vmware-install.pl -d which doesn't stop on failure.

To fix the problem install prerequisites:

sudo apt-get install build-essential linux-headers-$(uname -r)

Then reinstall VMWare tools (without the -d flag to make sure everything works properly)

sudo ./vmware-install.pl

OTHER TIPS

Expanding on jeff's answer,

The vmware tools image is found in /Applications/VMware Fusion.app/Contents/Library/isoimages

Unzip the iso file and you should find the vmware tools tar file inside. Get it inside the instance.

You will need to uninstall the existing vmware tools first. Run this

sudo /usr/bin/vmware-uninstall-tools.pl

Then

sudo apt-get install build-essential linux-headers-$(uname -r)

And from the vmware tools package you extracted earlier, there should be a vmware-install.pl file. Run it

sudo ./vmware-install.pl

Reboot and your vmware tools should be working.

Found an elegant solution here, this needs to be added to the Vagrantfile:

# Ensure that VMWare Tools recompiles kernel modules when we update the linux images
$fix_vmware_tools_script = <<SCRIPT
sed -i.bak 's/answer AUTO_KMODS_ENABLED_ANSWER no/answer AUTO_KMODS_ENABLED_ANSWER yes/g' /etc/vmware-tools/locations
sed -i.bak 's/answer AUTO_KMODS_ENABLED no/answer AUTO_KMODS_ENABLED yes/g' /etc/vmware-tools/locations
SCRIPT

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # ...
  config.vm.provision :shell, :inline => $fix_vmware_tools_script
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top