Remote connection disconnect

When I am starting vagrant, both VM (database and infrastructure) are having the same error:

~/m310/m310-vagrant-env$ vagrant reload database
==> database: Attempting graceful shutdown of VM…
database: Guest communication could not be established! This is usually because
database: SSH is not running, the authentication information was changed,
database: or some other networking issue. Vagrant will force halt, if
database: capable.
==> database: Forcing shutdown of VM…
==> database: Checking if box ‘ubuntu/trusty64’ is up to date…
==> database: Clearing any previously set forwarded ports…
==> database: Clearing any previously set network interfaces…
==> database: Preparing network interfaces based on configuration…
database: Adapter 1: nat
database: Adapter 2: hostonly
==> database: Forwarding ports…
database: 22 (guest) => 2222 (host) (adapter 1)
==> database: Running ‘pre-boot’ VM customizations…
==> database: Booting VM…
==> database: Waiting for machine to boot. This may take a few minutes…
database: SSH address: 127.0.0.1:2222
database: SSH username: vagrant
database: SSH auth method: private key
database: Warning: Remote connection disconnect. Retrying…
database: Warning: Connection reset. Retrying…
database: Warning: Remote connection disconnect. Retrying…
database: Warning: Connection reset. Retrying…
database: Warning: Remote connection disconnect. Retrying…
database: Warning: Remote connection disconnect. Retrying…

The VM are up but doesn´t work:
:~/m310/m310-vagrant-env$ vagrant status
Current machine states:

database running (virtualbox)
infrastructure running (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run vagrant status NAME.

:~/m310/m310-vagrant-env$ vagrant provision database
==> database: 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.

could not get identity count
:~/m310/m310-vagrant-env$ vagrant provision infrastructure
==> infrastructure: 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.

could not get identity count

Your status shows VMs are running
What is the issue you are facing?
Did you try vagrant ssh
vagrant ssh infrastructure
vagrant ssh database

1 Like

What is the output when you run vagrant ssh?

Kanika

Hi Kanika,

I can connect with these VMs by SSH but I can not find the directory shared. When I am bringing up them. I installed the plugin too.

I receive the following error message:

database: Warning: Remote connection disconnect. Retrying...
database: Warning: Remote connection disconnect. Retrying...

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured (“config.vm.boot_timeout” value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you’re using a custom box, make sure that networking is properly
working and you’re able to connect to the machine. It is a common
problem that networking isn’t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout (“config.vm.boot_timeout”) value.

So, if you are inside vagrant box, you can find shared directory here:

You can create files in directory m310/m310-vagrant-env/shared and they will appear in vagrant box under /home/vagrant/shared directory.

Kanika

Hi Kanika,

The directory was not mounted. See bellow.

vagrant@vagrant-ubuntu-trusty-64:~ ls -la total 32 drwxr-xr-x 4 vagrant vagrant 4096 Nov 17 18:02 . drwxr-xr-x 4 root root 4096 Nov 17 17:33 .. -rw------- 1 vagrant vagrant 52 Nov 19 09:48 .bash_history -rw-r--r-- 1 vagrant vagrant 220 Apr 9 2014 .bash_logout -rw-r--r-- 1 vagrant vagrant 3637 Apr 9 2014 .bashrc drwx------ 2 vagrant vagrant 4096 Nov 17 18:02 .cache -rw-r--r-- 1 vagrant vagrant 675 Apr 9 2014 .profile drwx------ 2 vagrant vagrant 4096 Nov 20 10:26 .ssh vagrant@vagrant-ubuntu-trusty-64:~ pwd
/home/vagrant

Hi @Francisco_Manoel_da_Silva_27618,

I got the issue. Seems like the setup is incomplete/corrupted.

  1. You may try to provision the vagrant which I see failed because of SSH error. Found these links for the issue:
    https://github.com/dlech/KeeAgent/issues/130
    https://stackoverflow.com/questions/39103958/chef-error-netsshauthenticationagenterror-could-not-get-identity-count

  2. If above does not work, I would recommend destroying vagrant and try up again:

    m310-vagrant-env$ vagrant destroy
    m310-vagrant-env$ vagrant up --provision
    m310-vagrant-env$ vagrant ssh
    

Kanika

Hi Kanika,

I destroyed and recreate the VMs. I also did the following change in provision-database file:
apt-get update -y --force-yes
apt-get install -y --force-yes mongodb-enterprise
apt-get install -y --force-yes krb5-user libsasl2-modules-gssapi-mit
apt-get install -y --force-yes sasl2-bin

It is OK now. Thank you for your support!

1 Like