Vagrant ssh command timeout at during SSH auth method : private key

After running command ‘vagrant up --provision’, im not getting any further than ‘SSH auth method: private key’ when i receive ‘timeout while waiting for machine to boot’ my assignment is due tomorrow and ive already spent half a day just to get the environment setup and running and cannot complete any more labs. im so totally frustrated with the complexity just to run a mongod instance. anyway how can i complete these labs and submit my assignment by tomorrow?

Hi @getemerson,

Can you please share the output of this command - vagrant up ?

If in case you are not able to set up the virtual machine on your system in time then you can enrol in the next offering which will begin on 25th February.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

ok some progress. i destroyed the vm with ‘vagrant destroy’ and ran ‘vagrant up --provision’ again, followed by ‘vagrant ssh’ and now have a vm prompt : ‘vagrant@m103’. running mongod from the vm gives me ‘mongod is currently not installed’ and aking me to install ‘mongod-server’. But its already installed for previous lessons. any suggestions?

Hi @getemerson,

It’s a good sign of progress but I’m not sure what other dependencies didn’t get downloaded in your vagrant environment other than MongoDB server.

Can you please elaborate on this please ? And also did you make any modification in the provision-mongod file ?

Thanks,
Shubham Ranjan
Curriculum Services Engineer

no, i havent made any changes to any files. i noticed that when i run ‘mongo’ from the vm i also get ‘not installed’ which it is as just run the mongo-enterprise shell to confirm. path issue in the vm? what file can i check?

MongoDB Enterprise was installed (plus compass etc) for previous lessons here. i noticed that there is no mongo data directory in the vm?

i really dont undertstand any of this to be frank and i feel im just groping in the dark and each time i find something else that isnt where its supposed to be.

is there a quicker more simple way to just reset everything and start over?

finding more anomalies:

vagrant@m103:~ cd m103-vagrant-env -bash: cd: m103-vagrant-env: No such file or directory vagrant@m103:~

but, i can still run ‘vagrant up’ even though the above directory does not exist. where does this get created?

more confusion.

You have already run two commands, vagrant up and vagrant ssh, that’s why you’re here :arrow_up:. You’re now inside the Linux VM and not your Windows host machine.

Double check that mongod installed correctly by running:
mongod --version

Double check that the /shared, /dataset and /vagrant folders are owned by vagrant by running:
ls -ld /{shared,dataset,vagrant}

this only runs from windows shell not the vm as i get mongod not installed

mongod --version
db version v4.2.3
git version: 6874650b362138df74be53d366bbefc321ea32d4
allocator: tcmalloc
modules: enterprise
build environment:
distmod: windows-64
distarch: x86_64
target_arch: x86_64

folder ownership. i can run this from the vm

vagrant@m103:~ ls -ld /{shared,dataset,vagrant} drwxrwxrwx 1 vagrant vagrant 0 Feb 24 08:44 /dataset drwxrwxrwx 1 vagrant vagrant 0 Feb 24 08:44 /shared drwxrwxrwx 1 vagrant vagrant 4096 Feb 24 12:39 /vagrant vagrant@m103:~

On the Windows terminal, run vagrant provision
Then ssh back into the VM, and run the mongod command again.

same:
vagrant@m103:~ mongod The program 'mongod' is currently not installed. To run 'mongod' please ask your administrator to install the package 'mongodb-server' vagrant@m103:~

is the vm looking inside itself for mongod? or using the installed version outside? which ever it cannot find it. it is installed though. but i cannot see any directories/files inside the vm related to mongo. if that helps i dont know.

vagrant runs the provision file which installs dependencies like MongoDB. Share a screenshot of the output of vagrant provision (including the command).

cannot find this either:
vagrant@m103:~ download_validators download_validators: command not found vagrant@m103:~

provisioning
C:\Users\memer\university\m103>vagrant provision
==> mongod-m103: Running provisioner: shell…
mongod-m103: Running: C:/Users/memer/AppData/Local/Temp/vagrant-shell20200224-12140-414476
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: ++ grep -v 127.0.0.1
mongod-m103: ++ cut -d: -f2
mongod-m103: ++ tail -1
mongod-m103: ++ awk ‘{ print $1}’
mongod-m103: + export CLIENT_IP_ADDR=192.168.103.100
mongod-m103: + CLIENT_IP_ADDR=192.168.103.100
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: + 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’
mongod-m103: Install MongoDB Enterprise Repository
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 keyserver.ubuntu.com --recv 0C49F3730359A14518585931BC711F9BA15703C6
mongod-m103: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.794GLZjmPu --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/ubuntu-advantage-esm-infra-trusty.gpg --keyserver keyserver.ubuntu.com --recv 0C49F3730359A14518585931BC711F9BA15703C6
mongod-m103: gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
mongod-m103: gpg: keyserver timed out
mongod-m103: gpg: keyserver receive failed: keyserver error
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.

to add: this does not get created either. how is this created in the m103 directory?
m103-vagrant-env

The installation failed hence the reason why MongoDB didn’t get installed.

Open the provision-mongod file > search for this “sudo apt-key adv” > share a screenshot of that line

1 Like

function update_repo(){
echo “Install MongoDB Enterprise Repository”

set to track mongodb development (rc)

echo “deb [ arch=amd64 ] http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.6 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo “Update Repositories”
sudo apt-get update -y
echo “Installing MongoDB Enterprise Dependencies”
sudo apt-get install -y libgssapi-krb5-2 libsasl2-2 libssl1.0.0 libstdc++6 snmp
}

Try substituting this line:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 0C49F3730359A14518585931BC711F9BA15703C6

with one of these two lines:

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

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

Save the file and run vagrant provision again.

BRILLIANT SUPPORT

mongod running

Last login: Mon Feb 24 14:59:42 2020 from 10.0.2.2
vagrant@m103:~$ mongod
2020-02-24T15:52:04.678+0000 I CONTROL [initandlisten] MongoDB starting : pid=6132 port=27017 dbpath=/data/db 64-bit host=m103
2020-02-24T15:52:04.679+0000 I CONTROL [initandlisten] db version v3.6.17
2020-02-24T15:52:04.679+0000 I CONTROL [initandlisten] git version: 3d6953c361213c5bfab23e51ab274ce592edafe6
2020-02-24T15:52:04.679+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2020-02-24T15:52:04.679+0000 I CONTROL [initandlisten] allocator: tcmalloc
2020-02-24T15:52:04.680+0000 I CONTROL [initandlisten] modules: enterprise
2020-02-24T15:52:04.680+0000 I CONTROL [initandlisten] build environment:
2020-02-24T15:52:04.680+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2020-02-24T15:52:04.680+0000 I CONTROL [initandlisten] distarch: x86_64
2020-02-24T15:52:04.681+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-02-24T15:52:04.681+0000 I CONTROL [initandlisten] options: {}
2020-02-24T15:52:04.681+0000 I STORAGE [initandlisten]
2020-02-24T15:52:04.682+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-02-24T15:52:04.682+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2020-02-24T15:52:04.682+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=488M,cache_overflow=(file_max=0M),session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),compatibility=(release=“3.0”,require_max=“3.0”),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2020-02-24T15:52:05.251+0000 I STORAGE [initandlisten] WiredTiger message [1582559525:251091][6132:0x7fbb6198cac0], txn-recover: Set global recovery timestamp: 0
2020-02-24T15:52:05.272+0000 I CONTROL [initandlisten]
2020-02-24T15:52:05.272+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-02-24T15:52:05.272+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-02-24T15:52:05.273+0000 I CONTROL [initandlisten]
2020-02-24T15:52:05.273+0000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2020-02-24T15:52:05.273+0000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2020-02-24T15:52:05.273+0000 I CONTROL [initandlisten] ** Start the server with --bind_ip to specify which IP
2020-02-24T15:52:05.273+0000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2020-02-24T15:52:05.273+0000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2020-02-24T15:52:05.274+0000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2020-02-24T15:52:05.274+0000 I CONTROL [initandlisten]
2020-02-24T15:52:05.275+0000 I STORAGE [initandlisten] createCollection: admin.system.version with provided UUID: 1284a131-1675-4d30-a819-93b8339eaa3b
2020-02-24T15:52:05.285+0000 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.6
2020-02-24T15:52:05.286+0000 I STORAGE [initandlisten] createCollection: local.startup_log with generated UUID: ccdad2e7-ff17-49c9-bc2f-26b027ef4afa
2020-02-24T15:52:05.294+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory ‘/data/db/diagnostic.data’
2020-02-24T15:52:05.295+0000 I NETWORK [initandlisten] listening via socket bound to 127.0.0.1
2020-02-24T15:52:05.295+0000 I NETWORK [initandlisten] listening via socket bound to /tmp/mongodb-27017.sock
2020-02-24T15:52:05.295+0000 I NETWORK [initandlisten] waiting for connections on port 27017
2020-02-24T15:52:05.296+0000 I STORAGE [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: b1ab54e3-acd9-4217-a9e0-920374d857a8
2020-02-24T15:52:05.310+0000 I INDEX [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: “lsidTTLIndex”, ns: “config.system.sessions”, expireAfterSeconds: 1800 }
2020-02-24T15:52:05.310+0000 I INDEX [LogicalSessionCacheRefresh] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2020-02-24T15:52:05.312+0000 I INDEX [LogicalSessionCacheRefresh] build index done. scanned 0 total records. 0 secs

thank you for your valuable time, expertise and patience

Good to hear! :+1:

Just fyi:
It’s only those with the leaf icon and/or the “MongoDB” title that are MongoDB staff. Anyone else is either someone who completed the course or is a current course taker.
The official Curriculum Services Engineer for this course is @Shubham_Ranjan.
image