My vagrant VM environment does not complete the process of the "provision-mongod" file

Hello, my name is roysbert salinas and I’m having problems with the Vagrant workspace, the following happens, I’m following the indications that are described in the course for installation and configuration and everything goes well until I get to the command “vagrant up” . At least the first time, this command starts the VM, executes the “provision-mongod” file and the process fails when it executes line 57.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

this is what the terminal shows me:

 mongod-m103: + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.typyci1DU2 --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: gpg:
    mongod-m103: requesting key A15703C6 from hkp server keyserver.ubuntu.com
    mongod-m103: ?: keyserver.ubuntu.com: Host not found
    mongod-m103: gpgkeys: HTTP fetch error 7: couldn't connect: Success
    mongod-m103: gpg: no valid OpenPGP data found.
    mongod-m103: gpg: Total number processed: 0
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.

It seems a connectivity problem, but the reality is that it is not so because I made tests and from the VM I have access to the internet. Ej, ping keyserver.ubuntu.com

PING keyserver.ubuntu.com (91.189.89.49) 56(84) bytes of data.
64 bytes from boquila.canonical.com (91.189.89.49): icmp_seq=2 ttl=51 time=189 ms
64 bytes from boquila.canonical.com (91.189.89.49): icmp_seq=3 ttl=51 time=236 ms
64 bytes from boquila.canonical.com (91.189.89.49): icmp_seq=4 ttl=51 time=291 ms
64 bytes from boquila.canonical.com (91.189.89.49): icmp_seq=5 ttl=51 time=292 ms
^C
--- keyserver.ubuntu.com ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4008ms
rtt min/avg/max/mdev = 189.441/252.368/292.357/42.861 ms
vagrant@m103:~$

Out of curiosity I tried to follow the course with a VM configured by me, supporting me from the “provision-mongod” file and with any material I get on the web. I did well because it manages to install mongo enterprise in Ubuntu Server 18.04 LTS and get the course material, but I can not get very far because the labs require that you use the instance of vagrant that you provide to facilitate the evaluation.

Comment this for the command mentioned above, if it works for ubuntu 18.04 or not for ubuntu 14.04.

Now, to be able to advance with the course, it is possible that you can provide me with a link with which I can download a complete VM (exported by you) and import it into my VirtualBox.

If you suspect what the problem is and need some information, let me know.
Thank you very much in advance, greetings.

1 Like

It seems that the VM in question cannot resolve the hostname for the Ubuntu keyserver. It’s not your host OS that’s the problem, but the VM configuration. Oddly. Because the Vagrant config file should set things up in such a way that the VM uses your host’s network connection. And thus, DNS resolution should work just fine. Odd.

Tess_Sluijter, Thank you very much for answering.

I do not agree, as mentioned, I did connectivity tests and the “ping” command resolves to the keyserver.ubuntu.com dns (91.189.89.49).

But did you do that from inside the Vagrant VM? I don’t reckon you did, because the VM was still being provisioned.

Tess_Sluijter , Thank you very much for answering.

Yes, when I execute the command “vagrant up”, the process of downloading the VM starts, then the virtual machine starts and when it is already running, it starts the “provision-mongod” file, it fails on line 57 as usual previously, but the VM is running so I can enter by SSH and do the tests that I mentioned, such as ping and the execution of some commands manually, so the certainty that the command on line 57 fails me.

Captura2

PD: My English is not very good so I’m supporting a translator, sorry for any errors or inconsistencies that may exist.

1 Like

Hi Roysbert_00072,

When you do vagrant ssh, and you see:

vagrant@m103:~$ 

It means you are already in vagrant. Try re-provision the vagrant. If you don’t see the validators.

Exit the vagrant. And run:

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant> vagrant up --provision

Then, try to do ssh again.

Kanika

kanikasingla , Thank you very much for answering.

I also tried this and that is why I indicated that the process described in the “provision-mongod” file does not complete or fails me.

I went back to execute the command and this is what the terminal shows me.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant up --provision
Bringing machine 'mongod-m103' up with 'virtualbox' provider...
==> mongod-m103: Running provisioner: shell...
    mongod-m103: Running: C:/Users/Roysbert/AppData/Local/Temp/vagrant-shell20181119-3832-1ab4hhg
    mongod-m103: + config
    mongod-m103: + sudo su
    mongod-m103: + echo -e never
    mongod-m103: + echo -e never
    mongod-m103: + echo manual
    mongod-m103: + sudo tee /etc/init/mongod.override
    mongod-m103: manual
    mongod-m103: + ip_config
    mongod-m103: ++ ifconfig
    mongod-m103: ++ grep 'inet addr:'
    mongod-m103: ++ awk '{ print $1}'
    mongod-m103: ++ grep -v 127.0.0.1
    mongod-m103: ++ cut -d: -f2
    mongod-m103: ++ tail -1
    mongod-m103: + export CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: + CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: ++ hostname
    mongod-m103: + export CLIENT_FQDN=m103
    mongod-m103: + CLIENT_FQDN=m103
    mongod-m103: ++ tr '[:upper:]' '[:lower:]'
    mongod-m103: ++ hostname
    mongod-m103: ++ cut -d. -f 1
    mongod-m103: + export CLIENT_NAME=m103
    mongod-m103: + CLIENT_NAME=m103
    mongod-m103: + echo 'Configuring /etc/hosts ...'
    mongod-m103: Configuring /etc/hosts ...
    mongod-m103: + echo '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 '
    mongod-m103: + echo '::1       localhost localhost.localdomain localhost6 localhost6.localdomain6'
    mongod-m103: + echo 'fe00::0 ip6-localnet'
    mongod-m103: + echo 'ff00::0 ip6-mcastprefix'
    mongod-m103: + echo 'ff02::1 ip6-allnodes'
    mongod-m103: + echo 'ff02::2 ip6-allrouters'
    mongod-m103: + echo 'ff02::3 ip6-allhosts'
    mongod-m103: + echo '192.168.103.100    m103 m103'
    mongod-m103: + update_repo
    mongod-m103: + echo 'Install MongoDB Enterprise Repository'
    mongod-m103: Install MongoDB Enterprise Repository
    mongod-m103: + sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
    mongod-m103: + echo 'deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse'
    mongod-m103: deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse
    mongod-m103: + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.Vzx1zSVP6R --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: gpg:
    mongod-m103: requesting key A15703C6 from hkp server keyserver.ubuntu.com
    mongod-m103: ?:
    mongod-m103: keyserver.ubuntu.com: Host not found
    mongod-m103: gpgkeys: HTTP fetch error 7: couldn't connect: Success
    mongod-m103: gpg: no valid OpenPGP data found.
    mongod-m103: gpg: Total number processed: 0
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:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>

image

So I thought that if my problem is the preparation of the environment, maybe if someone worked, that person could compress their virtual machine, share it with me (Google Drive, FTP Server, etc.) and allow it to download, I should work with just import it.

I could offer access to an FTP server where I can load the virtual machine if necessary.

1 Like

Meanwhile, can you try removing this virtual box and re-download and try to start up again?

Destroy vagrant:

 vagrant halt
 vagrant destroy

Then re-download and try up your vagrant again.

kanikasingla , Thank you very much for answering.

I followed the steps you indicated but I get the impression that the “vagrant up” command is using a copy of the virtual machine that I already downloaded (since it did not show me any download process). Is there a way to locate this copy, erase it and make sure it does the download process again?

Annex the output of the terminal after executing the commands.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>
C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant halt
==> mongod-m103: Attempting graceful shutdown of VM...

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant destroy
    mongod-m103: Are you sure you want to destroy the 'mongod-m103' VM? [y/N] y
==> mongod-m103: Destroying VM and associated drives...

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant up
Bringing machine 'mongod-m103' up with 'virtualbox' provider...
==> mongod-m103: Importing base box 'ubuntu/trusty64'...
==> mongod-m103: Matching MAC address for NAT networking...
==> mongod-m103: Setting the name of the VM: mongod-m103
==> mongod-m103: Clearing any previously set forwarded ports...
==> 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)
==> mongod-m103: Running 'pre-boot' VM customizations...
==> mongod-m103: Booting VM...
==> mongod-m103: Waiting for machine to boot. This may take a few minutes...
    mongod-m103: SSH address: 127.0.0.1:2222
    mongod-m103: SSH username: vagrant
    mongod-m103: SSH auth method: private key
    mongod-m103: Warning: Connection aborted. Retrying...
    mongod-m103: Warning: Connection reset. Retrying...
    mongod-m103:
    mongod-m103: Vagrant insecure key detected. Vagrant will automatically replace
    mongod-m103: this with a newly generated keypair for better security.
    mongod-m103:
    mongod-m103: Inserting generated public key within guest...
    mongod-m103: Removing insecure key from the guest if it's present...
    mongod-m103: Key inserted! Disconnecting and reconnecting using new SSH key...
==> mongod-m103: Machine booted and ready!
==> mongod-m103: Checking for guest additions in VM...
    mongod-m103: The guest additions on this VM do not match the installed version of
    mongod-m103: VirtualBox! In most cases this is fine, but in rare cases it can
    mongod-m103: prevent things such as shared folders from working properly. If you see
    mongod-m103: shared folder errors, please make sure the guest additions within the
    mongod-m103: virtual machine match the version of VirtualBox you have installed on
    mongod-m103: your host and reload your VM.
    mongod-m103:
    mongod-m103: Guest Additions Version: 4.3.36
    mongod-m103: VirtualBox Version: 5.2
==> mongod-m103: Setting hostname...
==> mongod-m103: Configuring and enabling network interfaces...
==> mongod-m103: Mounting shared folders...
    mongod-m103: /shared => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant/shared
    mongod-m103: /vagrant => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant
    mongod-m103: /dataset => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant/dataset
==> mongod-m103: Running provisioner: shell...
    mongod-m103: Running: C:/Users/Roysbert/AppData/Local/Temp/vagrant-shell20181119-14956-1mvx8gw
    mongod-m103: + config
    mongod-m103: + sudo su
    mongod-m103: + echo -e never
    mongod-m103: + echo -e never
    mongod-m103: + echo manual
    mongod-m103: + sudo tee /etc/init/mongod.override
    mongod-m103: manual
    mongod-m103: + ip_config
    mongod-m103: ++ cut -d: -f2
    mongod-m103: ++ ifconfig
    mongod-m103: ++ grep 'inet addr:'
    mongod-m103: ++ grep -v 127.0.0.1
    mongod-m103: ++ awk '{ print $1}'
    mongod-m103: ++ tail -1
    mongod-m103: + export CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: + CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: ++ hostname
    mongod-m103: + export CLIENT_FQDN=m103
    mongod-m103: + CLIENT_FQDN=m103
    mongod-m103: ++ hostname
    mongod-m103: ++ tr '[:upper:]' '[:lower:]'
    mongod-m103: ++ cut -d. -f 1
    mongod-m103: + export CLIENT_NAME=m103
    mongod-m103: + CLIENT_NAME=m103
    mongod-m103: Configuring /etc/hosts ...
    mongod-m103: Install MongoDB Enterprise Repository
    mongod-m103: + echo 'Configuring /etc/hosts ...'
    mongod-m103: + echo '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 '
    mongod-m103: + echo '::1       localhost localhost.localdomain localhost6 localhost6.localdomain6'
    mongod-m103: + echo 'fe00::0 ip6-localnet'
    mongod-m103: + echo 'ff00::0 ip6-mcastprefix'
    mongod-m103: + echo 'ff02::1 ip6-allnodes'
    mongod-m103: + echo 'ff02::2 ip6-allrouters'
    mongod-m103: + echo 'ff02::3 ip6-allhosts'
    mongod-m103: + echo '192.168.103.100    m103 m103'
    mongod-m103: + update_repo
    mongod-m103: + echo 'Install MongoDB Enterprise Repository'
    mongod-m103: + sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
    mongod-m103: + echo 'deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse'
    mongod-m103: deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse
    mongod-m103: + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.gSjoBq8JFq --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: gpg:
    mongod-m103: requesting key A15703C6 from hkp server keyserver.ubuntu.com
    mongod-m103: ?:
    mongod-m103: keyserver.ubuntu.com: Host not found
    mongod-m103: gpgkeys: HTTP fetch error 7: couldn't connect: Success
    mongod-m103: gpg:
    mongod-m103: no valid OpenPGP data found.
    mongod-m103: gpg:
    mongod-m103: Total number processed: 0
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:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>

I found where vagrant stores the virtual machines.
Windows: (%userprofile%\.vagrant.d\boxes)

I’ll erase it and make it download again

As I comment, I followed the steps that Alicia indicates, this time if I download the virtual machine again, but I got the same result, it fails to execute the “provision-mongod” file, so the configuration of the environment is incomplete.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>
C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant halt
==> mongod-m103: Attempting graceful shutdown of VM...

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant destroy
    mongod-m103: Are you sure you want to destroy the 'mongod-m103' VM? [y/N] y
==> mongod-m103: Destroying VM and associated drives...

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant up
Bringing machine 'mongod-m103' up with 'virtualbox' provider...
==> mongod-m103: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    mongod-m103: Box Provider: virtualbox
    mongod-m103: Box Version: >= 0
==> mongod-m103: Loading metadata for box 'ubuntu/trusty64'
    mongod-m103: URL: https://vagrantcloud.com/ubuntu/trusty64
==> mongod-m103: Adding box 'ubuntu/trusty64' (v20181103.0.0) for provider: virtualbox
    mongod-m103: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20181103.0.0/providers/virtualbox.box
    mongod-m103: Download redirected to host: cloud-images.ubuntu.com
    mongod-m103:
==> mongod-m103: Successfully added box 'ubuntu/trusty64' (v20181103.0.0) for 'virtualbox'!
==> mongod-m103: Importing base box 'ubuntu/trusty64'...
==> mongod-m103: Matching MAC address for NAT networking...
==> mongod-m103: Setting the name of the VM: mongod-m103
==> mongod-m103: Clearing any previously set forwarded ports...
==> 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)
==> mongod-m103: Running 'pre-boot' VM customizations...
==> mongod-m103: Booting VM...
==> mongod-m103: Waiting for machine to boot. This may take a few minutes...
    mongod-m103: SSH address: 127.0.0.1:2222
    mongod-m103: SSH username: vagrant
    mongod-m103: SSH auth method: private key
    mongod-m103: Warning: Connection aborted. Retrying...
    mongod-m103:
    mongod-m103: Vagrant insecure key detected. Vagrant will automatically replace
    mongod-m103: this with a newly generated keypair for better security.
    mongod-m103:
    mongod-m103: Inserting generated public key within guest...
    mongod-m103: Removing insecure key from the guest if it's present...
    mongod-m103: Key inserted! Disconnecting and reconnecting using new SSH key...
==> mongod-m103: Machine booted and ready!
==> mongod-m103: Checking for guest additions in VM...
    mongod-m103: The guest additions on this VM do not match the installed version of
    mongod-m103: VirtualBox! In most cases this is fine, but in rare cases it can
    mongod-m103: prevent things such as shared folders from working properly. If you see
    mongod-m103: shared folder errors, please make sure the guest additions within the
    mongod-m103: virtual machine match the version of VirtualBox you have installed on
    mongod-m103: your host and reload your VM.
    mongod-m103:
    mongod-m103: Guest Additions Version: 4.3.36
    mongod-m103: VirtualBox Version: 5.2
==> mongod-m103: Setting hostname...
==> mongod-m103: Configuring and enabling network interfaces...
==> mongod-m103: Mounting shared folders...
    mongod-m103: /shared => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant/shared
    mongod-m103: /vagrant => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant
    mongod-m103: /dataset => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant/dataset
==> mongod-m103: Running provisioner: shell...
    mongod-m103: Running: C:/Users/Roysbert/AppData/Local/Temp/vagrant-shell20181119-7444-13d26zm
    mongod-m103: + config
    mongod-m103: + sudo su
    mongod-m103: + echo -e never
    mongod-m103: + echo -e never
    mongod-m103: + echo manual
    mongod-m103: + sudo tee /etc/init/mongod.override
    mongod-m103: manual
    mongod-m103: + ip_config
    mongod-m103: ++ ifconfig
    mongod-m103: ++ grep -v 127.0.0.1
    mongod-m103: ++ awk '{ print $1}'
    mongod-m103: ++ grep 'inet addr:'
    mongod-m103: ++ cut -d: -f2
    mongod-m103: ++ tail -1
    mongod-m103: + export CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: + CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: ++ hostname
    mongod-m103: + export CLIENT_FQDN=m103
    mongod-m103: + CLIENT_FQDN=m103
    mongod-m103: ++ tr '[:upper:]' '[:lower:]'
    mongod-m103: ++ cut -d. -f 1
    mongod-m103: ++ hostname
    mongod-m103: + export CLIENT_NAME=m103
    mongod-m103: + CLIENT_NAME=m103
    mongod-m103: Configuring /etc/hosts ...
    mongod-m103: Install MongoDB Enterprise Repository
    mongod-m103: + echo 'Configuring /etc/hosts ...'
    mongod-m103: + echo '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 '
    mongod-m103: + echo '::1       localhost localhost.localdomain localhost6 localhost6.localdomain6'
    mongod-m103: + echo 'fe00::0 ip6-localnet'
    mongod-m103: + echo 'ff00::0 ip6-mcastprefix'
    mongod-m103: + echo 'ff02::1 ip6-allnodes'
    mongod-m103: + echo 'ff02::2 ip6-allrouters'
    mongod-m103: + echo 'ff02::3 ip6-allhosts'
    mongod-m103: + echo '192.168.103.100    m103 m103'
    mongod-m103: + update_repo
    mongod-m103: + echo 'Install MongoDB Enterprise Repository'
    mongod-m103: + echo 'deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse'
    mongod-m103: + sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
    mongod-m103: deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse
    mongod-m103: + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.Yw1FZK6lKF --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: gpg:
    mongod-m103: requesting key A15703C6 from hkp server keyserver.ubuntu.com
    mongod-m103: ?:
    mongod-m103: keyserver.ubuntu.com: Host not found
    mongod-m103: gpgkeys: HTTP fetch error 7: couldn't connect: Success
    mongod-m103: gpg:
    mongod-m103: no valid OpenPGP data found.
    mongod-m103: gpg:
    mongod-m103: Total number processed: 0
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:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>
1 Like

I am not sure how to solve this issue! Let me check.

Kanika

2 Likes

Hi @Roysbert_00072,

Please try:

vagrant provision 

Even if it throws error, try up your vagrant after this:

  vagrant up
  vagrant ssh

Let me know if you can’t get into vagrant and what output does vagrant ssh shows.

Kanika

@Kanika , Thank you very much for answering.

I managed to enter the virtual machine, but it does not complete the installation process indicated in the file (provision-mongod), I do not have the validators or the course material.

Annex the output of the terminal after executing the commands.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant halt
==> mongod-m103: Attempting graceful shutdown of VM...

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant provision
==> mongod-m103: VM is not currently running. Please, first bring it up with `vagrant up` then run this command.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant up
Bringing machine 'mongod-m103' up with 'virtualbox' provider...
==> mongod-m103: Clearing any previously set forwarded ports...
==> 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)
==> mongod-m103: Running 'pre-boot' VM customizations...
==> mongod-m103: Booting VM...
==> mongod-m103: Waiting for machine to boot. This may take a few minutes...
    mongod-m103: SSH address: 127.0.0.1:2222
    mongod-m103: SSH username: vagrant
    mongod-m103: SSH auth method: private key
    mongod-m103: Warning: Connection reset. Retrying...
    mongod-m103: Warning: Connection aborted. Retrying...
==> mongod-m103: Machine booted and ready!
==> mongod-m103: Checking for guest additions in VM...
    mongod-m103: The guest additions on this VM do not match the installed version of
    mongod-m103: VirtualBox! In most cases this is fine, but in rare cases it can
    mongod-m103: prevent things such as shared folders from working properly. If you see
    mongod-m103: shared folder errors, please make sure the guest additions within the
    mongod-m103: virtual machine match the version of VirtualBox you have installed on
    mongod-m103: your host and reload your VM.
    mongod-m103:
    mongod-m103: Guest Additions Version: 4.3.36
    mongod-m103: VirtualBox Version: 5.2
==> mongod-m103: Setting hostname...
==> mongod-m103: Configuring and enabling network interfaces...
==> mongod-m103: Mounting shared folders...
    mongod-m103: /shared => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant/shared
    mongod-m103: /vagrant => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant
    mongod-m103: /dataset => C:/Users/Roysbert/Documents/Projects/Learning/MongoDB/Vagrant/dataset
==> mongod-m103: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> mongod-m103: flag to force provisioning. Provisioners marked to run always will still run.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant provision
==> mongod-m103: Running provisioner: shell...
    mongod-m103: Running: C:/Users/Roysbert/AppData/Local/Temp/vagrant-shell20181119-14352-i14hwq
    mongod-m103: + config
    mongod-m103: + sudo su
    mongod-m103: + echo -e never
    mongod-m103: + echo -e never
    mongod-m103: + echo manual
    mongod-m103: + sudo tee /etc/init/mongod.override
    mongod-m103: manual
    mongod-m103: + ip_config
    mongod-m103: ++ ifconfig
    mongod-m103: ++ grep -v 127.0.0.1
    mongod-m103: ++ grep 'inet addr:'
    mongod-m103: ++ awk '{ print $1}'
    mongod-m103: ++ cut -d: -f2
    mongod-m103: ++ tail -1
    mongod-m103: + export CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: + CLIENT_IP_ADDR=192.168.103.100
    mongod-m103: ++ hostname
    mongod-m103: + export CLIENT_FQDN=m103
    mongod-m103: + CLIENT_FQDN=m103
    mongod-m103: ++ hostname
    mongod-m103: ++ cut -d. -f 1
    mongod-m103: ++ tr '[:upper:]' '[:lower:]'
    mongod-m103: + export CLIENT_NAME=m103
    mongod-m103: + CLIENT_NAME=m103
    mongod-m103: + echo 'Configuring /etc/hosts ...'
    mongod-m103: Configuring /etc/hosts ...
    mongod-m103: + echo '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 '
    mongod-m103: + echo '::1       localhost localhost.localdomain localhost6 localhost6.localdomain6'
    mongod-m103: + echo 'fe00::0 ip6-localnet'
    mongod-m103: + echo 'ff00::0 ip6-mcastprefix'
    mongod-m103: + echo 'ff02::1 ip6-allnodes'
    mongod-m103: + echo 'ff02::2 ip6-allrouters'
    mongod-m103: + echo 'ff02::3 ip6-allhosts'
    mongod-m103: + echo '192.168.103.100    m103 m103'
    mongod-m103: + update_repo
    mongod-m103: + echo 'Install MongoDB Enterprise Repository'
    mongod-m103: Install MongoDB Enterprise Repository
    mongod-m103: + sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
    mongod-m103: + echo 'deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse'
    mongod-m103: deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse
    mongod-m103: + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.Gk0d1cmf5O --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    mongod-m103: gpg:
    mongod-m103: requesting key A15703C6 from hkp server keyserver.ubuntu.com
    mongod-m103: ?:
    mongod-m103: keyserver.ubuntu.com: Host not found
    mongod-m103: gpgkeys: HTTP fetch error 7: couldn't connect: Success
    mongod-m103: gpg:
    mongod-m103: no valid OpenPGP data found.
    mongod-m103: gpg:
    mongod-m103: Total number processed: 0
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:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant up
Bringing machine 'mongod-m103' up with 'virtualbox' provider...
==> mongod-m103: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> mongod-m103: flag to force provisioning. Provisioners marked to run always will still run.

C:\Users\Roysbert\Documents\Projects\Learning\MongoDB\Vagrant>vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-161-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Mon Nov 19 12:12:51 UTC 2018

  System load:  0.94              Processes:           89
  Usage of /:   3.6% of 39.34GB   Users logged in:     0
  Memory usage: 6%                IP address for eth0: 10.0.2.15
  Swap usage:   0%                IP address for eth1: 192.168.103.100

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

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

New release '16.04.5 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


vagrant@m103:~$ echo "income but the installation is not complete..."
income but the installation is not complete...
vagrant@m103:~$ echo "I do not have the validators or the course material."
I do not have the validators or the course material.
vagrant@m103:~$ sudo ls /var/m103/validation
ls: cannot access /var/m103/validation: No such file or directory
vagrant@m103:~$
1 Like

I think my biggest problem is that the virtual machine does not finish the process of installing mongodb (or even manages to start …), the validators and course material can be obtained using the links that appear in the file "provision -mongod ", this I already did, install a virtual machine with ubuntu server 18.04, I installed ssh, mongodb and downloaded the material, but when I tried to use the validator (validate_lab_launch_mongod) it did not work and I have the impression that it has to do with how do I have mongodb configured on that machine?

That’s why I wanted someone to pass me a virtual machine with the complete installation and do the lab again to download errors from the environment.

I am not sure how or if we can do that!

I am in the process of sharing the validation files with you. Just need some time.

Kanika

1 Like

xD, ok I’m not pressing, sorry if my words convey anger or something similar, the truth is that it is not.

If I feel somewhat frustrated that I can not solve the problem myself.

Thank you all for your support.

1 Like

Hi Roysbert_00072,

Here is the link to download validation files: m103_validation

  1. Download and extract the files

  2. Copy the files in the /shared directory of vagrant box.

  3. ssh into vagrant using vagrant ssh

  4. You will find the validation files in /shared

    vagrant@m103:~$ ls -l /shared

Let me know if you need more information!

Kanika

1 Like

As an aside, could you for fun try the following inside the Vagrant VM?

curl http://keyserver.ubuntu.com

This should return a bunch of HTML and CSS, for the Ubuntu keyserver. If that works, try running:

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 0A5174AF

The key ID is just an example from here.

I completely forgot to ask you: are you on your home network, or at the office? Because if you’re at the office, it could very well be that your proxy server or outgoing firewall blocks HKP protocol over port 80.

@Kanika , Thank you very much for answering.

Thank you very much, but as I told you my biggest problem is that the virtual machine is not installing mongodb because it can not execute this command:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6