Unable to locate package mongodb-enterprise

Hi I am getting the follwoing error during vm provisioning:

mongod-m103: + echo 'Install MongoDB Enterprise'
mongod-m103: Install MongoDB Enterprise
mongod-m103: + sudo apt-get install --force-yes -y mongodb-enterprise
mongod-m103: Reading package lists...
mongod-m103: Building dependency tree...
mongod-m103: Reading state information...
mongod-m103: E
mongod-m103: :
mongod-m103: Unable to locate package mongodb-enterprise

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.

i am on windows 10, virtual box 6.0, vagrant 2.2.6

regards
Sailesh

Hi @sailesh_57749,

Can you please replace the following line in provision-mongod file:

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

with the following line:

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

Once you have done this, please try to reprovision the box and let us know how it goes.

Please get back if the issue still persists.

Thanks,
Muskan

i tried this already…still fails

i think it is failing @ sudo apt-get install --force-yes -y mongodb-enterprise

Hi @sailesh_57749,

Are you working on your work system? Make sure your network allows incoming connections or maybe the firewall is enabled.

Try opening http://repo.mongodb.com link from your system, if you are unable to open, you might need to ask IT team or try from different machine.

Let me know if this helps!

Thanks,
Muskan

no firewall issue. i was able to open that link.

following is my provision file:

#!/usr/bin/env bash

Bash script for provisioning the MongoDB instances

set -e
set -x

function ip_config(){
export CLIENT_IP_ADDR=ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}' | tail -1
export CLIENT_FQDN=hostname
export CLIENT_NAME=hostname | cut -d. -f 1 | tr '[:upper:]' '[:lower:]'
echo “Configuring /etc/hosts …”
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 " > /etc/hosts
echo “::1 localhost localhost.localdomain localhost6 localhost6.localdomain6” >> /etc/hosts
echo “fe00::0 ip6-localnet” >> /etc/hosts
echo “ff00::0 ip6-mcastprefix” >> /etc/hosts
echo “ff02::1 ip6-allnodes” >> /etc/hosts
echo “ff02::2 ip6-allrouters” >> /etc/hosts
echo “ff02::3 ip6-allhosts” >> /etc/hosts
echo “$CLIENT_IP_ADDR $CLIENT_FQDN $CLIENT_NAME” >> /etc/hosts
}

function install_mongod(){
echo “Install MongoDB Enterprise”

install MongoDB using apt-get so it installs with service support and has a

default configuration file in /etc/

have to force-yes -y to force install of unsigned packages (our 3.4 key does

not match, no 3.6 key in the docs) and to agree to install

sudo apt-get install --force-yes -y mongodb-enterprise
mkdir -p /var/log/mongodb/
sudo chown vagrant:vagrant -R /var/log/mongodb
sudo chown vagrant:vagrant -R /var/lib/mongodb
sudo echo "
security:
authorization: enabled" | sudo tee -a /etc/mongod.conf
echo “Done installing MongoDB Enterprise”
}

function user_setup(){
sudo sh -c “killall mongod; true”
sudo mkdir -p /data
sudo chmod -R 777 /data
mkdir -p /data/db
mkdir -p /home/vagrant/data
chmod -R 777 /home/vagrant/data
chown -R vagrant:vagrant /home/vagrant/data
mkdir -p /var/m103/validation
echo “Set LC_ALL=C to .profile”
sudo echo “export LC_ALL=C” >> /home/vagrant/.profile
sudo echo “PATH=$PATH:/var/m103/validation” >> /home/vagrant/.profile
}

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 hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

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

function config(){
sudo su

disable THP

echo -e “never” > /sys/kernel/mm/transparent_hugepage/enabled
echo -e “never” > /sys/kernel/mm/transparent_hugepage/defrag

disable mongod upstart service

echo ‘manual’ | sudo tee /etc/init/mongod.override
}

function download_dataset() {
echo “Downloading Dataset”
curl -s https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M103/products.json.tgz -o products.json.tgz
tar -xzvf products.json.tgz -C /dataset
rm -rf products.json.tgz

curl -s https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M103/products.part2.json.tgz -o products.part2.json.tgz
tar -xzvf products.part2.json.tgz -C /dataset
rm -rf products.part2.json.tgz
}

function download_validators() {
echo “Downloading Validation Scripts”
curl -s https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M103/m103_validation.tgz -o m103_validation.tgz
tar -xzvf m103_validation.tgz -C /var/m103/validation
rm -rf m103_validation.tgz
echo “#!/bin/bash
curl -s https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M103/m103_validation.tgz -o m103_validation.tgz
sudo tar -xzvf m103_validation.tgz -C /var/m103/validation
rm -rf m103_validation.tgz” > /var/m103/validation/download_validators
echo “#!/bin/bash
echo -n ‘m103 rocks’ | openssl sha256 | sed -e s/(stdin)=.//” > /var/m103/validation/validate_box
chmod -R +x /var/m103/validation/
chown root:root /var/m103/validation
echo “Done: Downloaded Validation Scripts”
}

function data_path() {
sudo mkdir -p /data
sudo chown -R vagrant:vagrant /data
}

function install_pymongo() {
sudo apt-get -y install python-pip --force-yes
sudo pip install pymongo
}

function verify_ip() {
export EXPECTED_IP=192.168.103.100
ifconfig | grep EXPECTED_IP ret=?
if [ $ret -ne 0 ]
then
ERR=“The VM does not have the expected IP: $EXPECTED_IP
instead it has: $CLIENT_IP_ADDR
Ensure no other vagrant VM has that same expected IP: $EXPECTED_IP
You should recreate this VM after destroying it with ‘vagrant destroy’”
fatal “$ERR”
fi
}

function fatal() {
echo ERROR
echo “$1”
exit 1
}

config
ip_config
update_repo
install_mongod
user_setup
data_path
install_pymongo
download_dataset
download_validators

Starting at this point, it is only validations so removing exit on error

set +e
verify_ip
echo “DONE”

Hi @sailesh_57749,

Thanks for sharing this!
Everything looks good to me.

Can you once try and run the following commands?

vagrant destroy
vagrant up
vagrant provision
vagrant ssh

Let me know if you are able to get past the “ssh” command, then we’ll look further into the issue.

Thanks,
Muskan

hey muskan,

still same issue.

regards

Hi @sailesh_57749,

Please try re-installing vagrant/VirtualBox after complete uninstatallation.

Kindly look at the following post for for detailed steps to be followed: Installing, Setting up Vagrant and Run Validation Scripts

Do get back to us if the issue persists.

Thanks,
Muskan

Hey Muskan,

still same issue.

regards
Sailesh Kode

is there any other way to finish this course? ive never worked on linux, hence im unable to figure this one out.

i noticed following error when i run in debug mode:

capturefilename=“C:\Users\sakode\VirtualBox VMs\ubuntu-cloudimg-trusty-vagrant-amd64_1573185930413_5813\ubuntu-cloudimg-trusty-vagrant-amd64_1573185930413_5813.webm”
captureres=“1024x768”
capturevideorate=512
capturevideofps=25
captureopts=""
GuestMemoryBalloon=0
GuestOSType=“Linux26_64”
GuestAdditionsRunLevel=2
GuestAdditionsVersion=“4.3.40_Ubuntu r110317”
GuestAdditionsFacility_VirtualBox Base Driver=50,1573185967261
GuestAdditionsFacility_VirtualBox System Service=50,1573185973380
GuestAdditionsFacility_Seamless Mode=0,1573185967261
GuestAdditionsFacility_Graphics Mode=0,1573185967261
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
INFO warden: Recovery complete.
INFO warden: Calling recover: #Vagrant::Action::Builtin::Call:0x0000000005f0d070
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
INFO warden: Beginning recovery process…
INFO warden: Recovery complete.
ERROR warden: Error occurred: 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.
does this help?

Hi @sailesh_57749 what version of Windows 10 are you using? Enterprise, Pro, Home etc?

And also let’s try the following:

  1. Destroy the box
    vagrant destroy
  2. Make a copy of the provision file
  3. Open the original provision file in a text editor, scroll all the way to the bottom, comment out the following lines using this character “#” and save the file:
  4. Provision and ssh into the box
    vagrant up
    vagrant ssh
  5. Inside the box, let’s see the results when you ping the repo::
    ping repo.mongodb.com
  6. In the provision file, find the function below, take each line one-by-one and run it until it errors:

    Let’s also see the results of each line that you run. Also, if the keyserver line fails, you may need to change it as per @Muskan_47318’s suggestion but try each variation.

Hi ,

the VM is provisioned and i am able to ping repo.mongodb.org. however i am getting follwoing error in update repo method:

i am getting following error:

Err http://repo.mongodb.com trusty/mongodb-enterprise/3.6 InRelease

Err http://repo.mongodb.com trusty/mongodb-enterprise/3.6 Release.gpg
Could not resolve ‘repo.mongodb.com
Reading package lists… Done
W: Failed to fetch http://repo.mongodb.com/apt/ubuntu/dists/trusty/mongodb-enterprise/3.6/InRelease

W: Failed to fetch http://repo.mongodb.com/apt/ubuntu/dists/trusty/mongodb-enterprise/3.6/Release.gpg Could not resolve ‘repo.mongodb.com

W: Some index files failed to download. They have been ignored, or old ones used instead.

and when i try to install_mongo, i get following error:

vagrant@m103:~$ sudo apt-get install --force-yes -y mongodb-enterprise
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package mongodb-enterprise

regards
SailesH kode

After running each line one-by-one, which line exactly is throwing the error?

sudo apt-get update -y --force-yes

Can you also confirm this?

As per step 5 above, can you share the results for this. Screen showing your ping command and the results.

Hi @sailesh_57749,

In addition to @007_jb,

Can you please confirm if you are using your work laptop or connected to your office network ?

Thanks,
Shubham Ranjan
Curriculum Support Engineer

widows 10 enterprise.

following is ping result:

64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=20 ttl=243 time=10.8 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=21 ttl=243 time=11.7 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=22 ttl=243 time=14.8 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=23 ttl=243 time=11.2 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=24 ttl=243 time=10.7 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=25 ttl=243 time=11.3 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=26 ttl=243 time=11.5 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=27 ttl=243 time=10.6 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=27 ttl=243 time=10.6 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=28 ttl=243 time=11.8 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=29 ttl=243 time=11.5 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=30 ttl=243 time=11.2 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=31 ttl=243 time=11.1 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=32 ttl=243 time=12.3 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=33 ttl=243 time=11.6 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=34 ttl=243 time=11.4 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=35 ttl=243 time=13.4 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=36 ttl=243 time=11.3 ms
64 bytes from server-13-226-16-243.ord51.r.cloudfront.net (13.226.16.243): icmp_seq=37 ttl=243 time=10.8 ms

i am using my office laptop but not connected to VPN.

I asked because I’ve seen lots of people using Windows Enterprise office machines not having much luck with these sort of installations because of restrictions placed by their organisation. Do you have full admin rights on your machine?

You mentioned that you’re not using VPN, but are you plugged in to the LAN or WiFi at work? Try connecting to your network at home and see if it makes a difference.

If none of these work, suggest speaking with your IT Support to complete this installation. Or use a non-work machine.

i am using WIFI@ home. yes i have admin rights.

when i ping repo.mongodb.com…it seems to be connecting …however when i try to install manually…i get follwoing error:

Err http://repo.mongodb.com trusty/mongodb-enterprise/3.6 Release.gpg
Could not resolve ‘repo.mongodb.com
Reading package lists… Done
W: Failed to fetch http://repo.mongodb.com/apt/ubuntu/dists/trusty/mongodb-enterprise/3.6/InRelease

W: Failed to fetch http://repo.mongodb.com/apt/ubuntu/dists/trusty/mongodb-enterprise/3.6/Release.gpg Could not resolve ‘repo.mongodb.com

W: Some index files failed to download. They have been ignored, or old ones used instead.