hashicorp / vagrant-vmware-desktop

Official provider for VMware desktop products: Fusion, Player, and Workstation.
Mozilla Public License 2.0
268 stars 39 forks source link

Vagrant is blocking ports it doesn't need #95

Open fasmat opened 2 years ago

fasmat commented 2 years ago

Vagrant version

Vagrant 2.2.19 (installed via homebrew) vagrant-vmware-utility 1.0.21 (installed via homebrew) VMware Fusion 12.2.1 (installed via homebrew) vagrant-vmware-desktop 3.0.1, global

Host operating system

Big Sur (11.6.2)

Guest operating system

n/a

Vagrantfile

n/a

Debug output

n/a

Expected behavior

When no VM is running vagrant should not listen on any ports.

Actual behavior

vagrant global-status:

id       name   provider       state       directory                                                   
-------------------------------------------------------------------------------------------------------
d6b997c  lin-vm vmware_desktop not running /Users/fasmat/workspace/testvm

The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date (use "vagrant global-status --prune" to prune invalid
entries). To interact with any of the machines, you can go to that
directory and run Vagrant, or you can use the ID directly with
Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"

sudo lsof -i -P | grep LISTEN | grep vagrant:

vagrant-v 89537           root   12u  IPv6 0x207c21b20f830ead      0t0    TCP *:3000 (LISTEN)
vagrant-v 89537           root   13u  IPv6 0x207c21b20f83084d      0t0    TCP *:5432 (LISTEN)
vagrant-v 89537           root   14u  IPv6 0x207c21b22311fead      0t0    TCP *:2222 (LISTEN)
vagrant-v 89537           root   15u  IPv4 0x207c21b21b3da19d      0t0    TCP localhost:9922 (LISTEN)

Steps to reproduce

  1. Create a vagrant VM that has port forwarding defined.
  2. Start then stop the VM
  3. Ports will now be blocked, even if you kill vagrant-vmware-utility
fasmat commented 2 years ago

A workaround I found was to delete nat.json and portforwarding.json in /opt/vagrant-vmware-desktop/settings/ and then killing vagrant-vmware-utility.

ghost commented 3 months ago

Been having the same issue, even when rebooting my mac vagrant is still shown as hogging those ports