Cannot get infrastruce vm up. ssh times out

Hello TA,

I had installed virtual box and vagrant as part of M103.

As part of install i created c:\university\m103 and unziped the zip file that came as part of m103.

I thought since most of the steps in M310 for vagrant and virtaul box are similar, i just create new directory C:\university\m310 and unzipped the zip file coming with this M310 course under it.

I did follow below steps as mentioned and than brought up the vagrant env.

cd m310-vagrant-env vagrant plugin install vagrant-vbguest
$ vagrant up

After doing so i tried to test it. And while the database vm i am able to get the “hello” from ~\shared\test.txt. But i cannot ssh to infrastructure vm. it times out.

Below is what the cmd prompt.

vagrant@database:~ cat ~/shared/test.txt hello vagrant@database:~ exit
logout
Connection to 127.0.0.1 closed.

c:\university\m310\m310-vagrant-env>vagrant ssh infrastructure
ssh_exchange_identification: read: Connection reset

c:\university\m310\m310-vagrant-env>

Would appreciate your help in resolving this.

TA,

Samir

Hi @Samir_29862,

I’m not a TA or a MongoDB staff but I should be able to help :wink:

It’s recommended that you build it machine one by one by specifying the machine name. So let’s do it in these steps:

  1. Database:
    vagrant destroy database -f
    vagrant up database
  2. Infrastructure
    vagrant destroy infrastructure -f
    vagrant up infrastructure

The infrastructure build will most likely fail, but let’s see a screenshot of the last couple of lines of the run for both machines. Also, if the database completes successfully, test it by login into the box and run mongo --version.

Hello James Bond,

i assume tha tis what the 007_jb stands for :stuck_out_tongue:

Anyways i tried the first part for database vm and below (partial log) is what i got.

**===================================== **
database: Suggested packages:
database: lm-sensors snmp-mibs-downloader
database: The following NEW packages will be installed:
database: libperl5.18 libsensors4 libsnmp-base libsnmp30 mongodb-enterprise
database: mongodb-enterprise-mongos mongodb-enterprise-server mongodb-enterprise-shell
database: mongodb-enterprise-tools snmp
database: 0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
database: Need to get 54.2 MB of archives.
database: After this operation, 225 MB of additional disk space will be used.
database: WARNING: The following packages cannot be authenticated!
database: mongodb-enterprise-shell mongodb-enterprise-server mongodb-enterprise-mongos
database: mongodb-enterprise-tools mongodb-enterprise
database: E
database: :
database: There are problems and -y was used without --force-yes
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

c:\university\m310\m310-vagrant-env>
=====================================

When i ssh to database i am able to get in

======================================
c:\university\m310\m310-vagrant-env>vagrant ssh database
Welcome to Ubuntu 14.04.6 LTS (GNU/Linux 3.13.0-170-generic x86_64)

System information as of Sat Jan 4 03:04:25 UTC 2020

System load: 0.61 Processes: 83
Usage of /: 3.6% of 39.34GB Users logged in: 0
Memory usage: 12% IP address for eth0: 10.0.2.15
Swap usage: 0%

Graph this data and manage this system at:
https://landscape.canonical.com/

UA Infrastructure Extended Security Maintenance (ESM) is not enabled.

0 updates can be installed immediately.
0 of these updates are security updates.

Enable UA Infrastructure ESM to receive 64 additional security updates.
See https://ubuntu.com/advantage or run: sudo ua status

New release ‘16.04.6 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

vagrant@database:~$
======================================

Will try the infrastructure VM as well.

TA,

Samir

Indeed :sunglasses:

It was actually supposed to be the database machine that fails. I just couldn’t remember which one.

Here’s the fix for the database machine:

Thanks JB,

So i tried to apply same to infrastructure VM and yes it does timeout while ssh to it. Also i nthe (Partial).log below it does mention about changing boot_timeout in config.

I don’t think that has got anything to do with session time out.

==============================================
==> infrastructure: Waiting for machine to boot. This may take a few minutes…
infrastructure: SSH address: 127.0.0.1:2200
infrastructure: SSH username: vagrant
infrastructure: SSH auth method: private key
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.

c:\university\m310\m310-vagrant-env>vagrant ssh infrastructure
ssh_exchange_identification: read: Connection reset

c:\university\m310\m310-vagrant-env>
==============================================

Also i nthe above solution you metion of, just to clarify “Kanika” is not par tof the command right ?

You can modify this line under provision-database apt-get install -y mongodb-enterprise to apt-get install -y mongodb-enterprise --force-yes Kanika

TA,

Samir

Let’s focus on one box, database.

That’s right. You’ll find the line inside the provision-database file.

database one i feel is ok atleast iam able to get the output of test.txt, unless you are seeing some errors which i am not.

sure will make the necessary changes and re-run the destroy follow by up on database vm.

TA,

Samir

Is this after editing the line, destroying and up’ing the machine (and without any errors)? If it is, then you’re ok. Test using
mongo --version

so you are right if mongo needs to come up installed than it has not.

.also the database vm came up and able to ssh to it. mongo–version gvies folowing.

vagrant@database:~$ mongo --version
The program ‘mongo’ is currently not installed. To run ‘mongo’ please ask your administrator to install the package ‘mongodb-clients’

This all before i made changes to the file.

will be making changes in next 30-45 mins or so.

TA,

Samir.

Alrighty, let us know.

Hi JB,

So checked and i did not find ny line eitehr in vagrantfile or file named “provision-database” with string ‘apt-get’

I do not know where this change needs to be made. am assuming its under the file named provision-database.

May be i am confused now.

TA,

Samir

Hopefully my file is the same as yours so have a look once more:
image

yes it is, and sorry, it was my fault. i was searching up in notepad. so yes i found it.

TA,

Samir

Thanks JB,

YAHOOOOOOO !!!

I get following.

===================================
vagrant@database:~ cat ~/shared/test.txt hello vagrant@database:~ mongo --version
MongoDB shell version: 3.2.22
vagrant@database:~$
===================================

So the question remains about infrastructure VM. Am neither able to ssh to it nor able to up it (without the boot_timeout message).

Do you happen to have solution for it ?

TA,

Samir

Let’s destroy and up the machine again then show a full screenshot of the entire output.
vagrant destroy infrastructure -f
vagrant up infrastructure

Also indicate your machine OS, edition (i.e. pro, enterprise, home etc), and whether it’s 64 or 32 bit.

64 bit windows 10 home edition

am bringing up the infra VM

will reply with log for it soon after

Hello JB,

Below is the complete log what i see in cmd prompt.

=========================================
c:\university\m310\m310-vagrant-env>vagrant up infrastructure
Bringing machine ‘infrastructure’ up with ‘virtualbox’ provider…
==> infrastructure: Importing base box ‘centos/7’…
==> infrastructure: Matching MAC address for NAT networking…
==> infrastructure: Checking if box ‘centos/7’ version ‘1905.1’ is up to date…
==> infrastructure: Setting the name of the VM: m310-vagrant-env_infrastructure_1578114936124_14672
==> infrastructure: Fixed port collision for 22 => 2222. Now on port 2200.
==> infrastructure: Clearing any previously set network interfaces…
==> infrastructure: Preparing network interfaces based on configuration…
infrastructure: Adapter 1: nat
infrastructure: Adapter 2: hostonly
==> infrastructure: Forwarding ports…
infrastructure: 22 (guest) => 2200 (host) (adapter 1)
==> infrastructure: Running ‘pre-boot’ VM customizations…
==> infrastructure: Booting VM…
==> infrastructure: Waiting for machine to boot. This may take a few minutes…
infrastructure: SSH address: 127.0.0.1:2200
infrastructure: SSH username: vagrant
infrastructure: SSH auth method: private key
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.

c:\university\m310\m310-vagrant-env>
=========================================

It’s weird one because I just tested this on a Win 10 Pro machine + Firewall + Anti virus + Private WiFi connection and it worked fine.

There’s another poster having the same “ssh auth method” error as you but for a different vagrantfile, however, the main similarity is that they are both trying to boot up a centos distro. The database machine on the other hand is an Ubuntu machine hence why you’re not getting this error.

Let’s try adding the following to the vagrantfile:


Here’s a textual copy of the three code bits to add:

  • infrastructure.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", protocol: "tcp", auto_correct: true, id: "ssh"
  • , "--cableconnected1", "on"
  • v.gui = true

As usual, destroy and up.

Now, when you up the machine, VirtualBox will open a new window which will show you what’s going on… it’s like a GUI version of the OS. If it errors again, take a screenshot of that window (including the title bar) and show me.

thanks JB,

But i thought vagrant was intentionally trying for centos. as below is in the vagrant file which is part of zip donwloaded from M310 course. Below is what is see i nthe vragrant file forn infra VM…

config.vm.define :infrastructure do |infrastructure|
infrastructure.vm.box = "centos/7"
infrastructure.vm.network :private_network, ip: “192.168.31.200”
infrastructure.vm.hostname = “infrastructure.m310.mongodb.university”
infrastructure.vm.provision :shell, path: “provision-infrastructure”, args: ENV[‘ARGS’]
infrastructure.vm.synced_folder “shared/”, “/home/vagrant/shared”, create: true

if that is not how its supposed to be then that particular zip file needs to be fixed.

else quite a few students taking m310 course would face same issue.

BTW i will try what you suggested.