VBox-VM with Vagrant stopped working

I’ve been having a problem with a Vagrant machine since today. I have the current version 7 of VBox and the current Vagrant version 2.3.2 installed. The normal VMs all run fine. One of two Vagrant machines also runs normally, only one causes problems when starting. After vagrant up I get the following error message, with which I couldn’t get any further even after hours of research on the net:

Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Checking if box ‘debian/contrib-jessie64’ version ‘8.11.1’ is up to date…
==> default: Clearing any previously set forwarded ports…
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: [“modifyvm”, “556374d1-b36d-4f85-ae45-a455cd2739c3”, “–natpf1”, “delete”, “”, “–natpf1”, “delete”, “ssh”, “–natpf1”, “delete”, “”, “–natpf1”, “delete”, “ssh”, “–natpf1”, “delete”, “”, “–natpf1”, “delete”, “ssh”, “–natpf1”, “delete”, “”, “–natpf1”, “delete”, “ssh”, “–natpf1”, “delete”, “”, “–natpf1”, “delete”, “ssh”]

Stderr: VBoxManage.exe: error: Code E_INVALIDARG (0x80070057) (extended info not available)
VBoxManage.exe: error: Context: “RemoveRedirect(Bstr(ValueUnion.psz).raw())” at line 2108 of file VBoxManageModifyVM.cpp

Does anyone have an idea where the problem could lie? I had the VM running normally last week and haven’t changed anything since then. The VM can be started normally in the VBox interface, just not with the help of vagrant.

I ran into the very same issue … have you been able to progress any further with your investigation ?
The VM still starts from the VB gui, I can vagrant ssh if VM is started manually
but vagrant up keeps failing.

Vagrant 2.3.4, VBox: 7.0.0

I’m able to successfully remove the “ssh” portf-forward with the following command :
VBoxManage.exe modifyvm $VM_NAME --natpf1 delete ssh

However, vagrant tries to delete it with the following command
Command: [“modifyvm”, “de8…- …-…-…-…af7”, “–natpf1”, “delete”, “ssh”, “–natpf1”, “delete”, “ssh”]

Note that for some reason , “–natpf1”, “delete”, “ssh” gets duplicated … I guess the 1st attempt succeed but the second delete fails because the 1st one already removed it.
Any help would be appreciated

I made a deep dive in the code and for VB 7, the list of forwarded port are extracted from the VM.vbox Config file and not from the “showvminfo” output

Now, I make use of VB snapshots to keep track of my VM states. In the VM.vbox config file, each snapshot contains a section.

        <NAT localhost-reachable="true">
          <DNS use-proxy="true"/>
          <Forwarding name="ssh" proto="1" hostip="" hostport="2222" guestport="22"/>

As a result read_forwarded_port() returns the same forwarded port multiple times (one for each VB snapshot section)

read_forwarded_port() output:
DEBUG virtualbox_7_0: - [1, “ssh”, 2222, 22, “”]
DEBUG virtualbox_7_0: - [1, “ssh”, 2222, 22, “”]

If I go and remove the forwarded ports from the snapshot section in the .vbox config file, then vagrant up works.
read_forwarded_port() output:
DEBUG virtualbox_7_0: - [1, “ssh”, 2222, 22, “”]

Note the comment here vagrant/version_7_0.rb at 8549450cff40a55ec193540a5387a09caee309b4 · hashicorp/vagrant · GitHub

The read_forwarded_port() routine needs to be revisited to account for VB VM that makes use of Snapshots not to have the same forwarded port reported multiple times.

My workaround
Change definition of read_forwarded_ports() in C:\HashiCorp\Vagrant\embedded\gems\2.3.4\gems\vagrant-2.3.4\plugins\providers\virtualbox\driver\version_7_0.rb

   def read_forwarded_ports(uuid=nil, active_only=false)
      return super

Note: This workaround might not work with initial release of VB 7.0
I guess I need to file a bug.

I hope this help.