Can't connect to my vagrant MongoDB-m103 machine

Hi, I have been doing M103 course and using vagrant vm setup throughout the course however since yesterday I cant ssh to the box, the box is up and running I have even did vagrant halt, vagrant reload many time it does not work.

It complains about ssh port assigned (2222) is being used already.

I have tried to update VagrantFile to use another port but still it tries to use 2222 and fails.

vagrant ssh

ssh_exchange_identification: read: Connection reset by peer

vagrant provision

==> mongod-m103: Running provisioner: shell…

An error occurred in the underlying SSH library that Vagrant uses.

The error message is shown below. In many cases, errors from this

library are caused by ssh-agent issues. Try disabling your SSH

agent or removing some keys and try again.

If the problem persists, please report a bug to the net-ssh project.

timeout during server version negotiating

Please help as I need to complete the labs in this course.

Thanks,
Ani

I found very few solutions working for this:

If you’re not able to use vagrant halt you can power down the box itself via VirtualBox, then run vagrant up --provision

Fixed it by uninstalling vagrant-notify plugin. Looks like related to this issue fideloper/Vaprobash#347

Please make sure that same instance which vagrant trying to use is not already running or is not used by any other party. killing all other processes fixed my problem.

Source: https://github.com/hashicorp/vagrant/issues/7965
https://github.com/hashicorp/vagrant/issues/6985

Kanika

nothing works. NO matter what I do. Anything else that you may suggest?

I re-installed virtualBox and ran vagrant up and here is the message I get:

vagrant up

Bringing machine ‘mongod-m103’ up with ‘virtualbox’ provider…

==> mongod-m103: Clearing any previously set network interfaces…

==> mongod-m103: Preparing network interfaces based on configuration…

mongod-m103: Adapter 1: nat

mongod-m103: Adapter 2: hostonly

==> mongod-m103: Forwarding ports…

mongod-m103: 22 (guest) => 2222 (host) (adapter 1)

There was an error while executing VBoxManage, a CLI used by Vagrant

for controlling VirtualBox. The command and stderr is shown below.

Command: [“modifyvm”, “bdcc0072-5647-49e4-9818-986c8b688749”, “–natpf1”, “ssh,tcp,127.0.0.1,2222,22”]

Stderr: VBoxManage: error: A NAT rule of this name already exists

VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component NATEngineWrap, interface INATEngine, callee nsISupports

VBoxManage: error: Context: “AddRedirect(Bstr(strName).raw(), proto, Bstr(strHostIp).raw(), RTStrToUInt16(strHostPort), Bstr(strGuestIp).raw(), RTStrToUInt16(strGuestPort))” at line 1863 of file VBoxManageModifyVM.cpp

Here is the link that might help you.

Nope, nothing helped, till I have run vagrant destroy then vagrant up --provision thus loosing all the db setup and configurations I had for the class M103. I have to restart from scratch.

Too bad no help was provided to fix the issue without destroying the box.

Thanks,
Ani