Vagrant up --provision GPG Key Request Timeout

When attempting to provision through Vagrant on a Windows VirtualBox install, it fails to finish the update_repo function because it got a request timeout when adding the gpg key from keyserver.ubuntu.com. I am behind a corporate firewall. Are there specific ports I need to whitelist:

> vagrant up --provision                                                                                                                                                                                                      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: 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.40
    mongod-m103: VirtualBox Version: 6.0
==> mongod-m103: Setting hostname...
==> mongod-m103: Configuring and enabling network interfaces...
==> mongod-m103: Mounting shared folders...
    mongod-m103: /shared => C:/Users/chammerton/Downloads/m103-vagrant-env/shared
    mongod-m103: /vagrant => C:/Users/chammerton/Downloads/m103-vagrant-env
    mongod-m103: /dataset => C:/Users/chammerton/Downloads/m103-vagrant-env/dataset
==> mongod-m103: Running provisioner: shell...
    mongod-m103: Running: C:/Users/CHAMME~1/AppData/Local/Temp/vagrant-shell20191113-7016-bnoti7
    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: ++ cut -d: -f2
    mongod-m103: ++ grep -v 127.0.0.1
    mongod-m103: ++ awk '{ print $1}'
    mongod-m103: ++ grep 'inet addr:'
    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: + 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: + 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.kDKp3if4IN --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:
    mongod-m103: 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.

I’ve found a workaround by changing the apt-key command to the following:

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

Hi @Corey_52283,

Good to know you were able to figure it out.

Please feel free to reach out to us in case of any other queries! :slight_smile:

Thanks,
Muskan

I am having the same issue. Can you please elaborate on where to add/modify this?

Thanks in advance.
Kristof

Hi @Kristof_98641,

Responded to you on another thread.

I would request you to stick to a single thread for posting your queries, you may definitely edit your query post until you receive a reply on the same :slight_smile:

Thanks,
Muskan

Hi, I saw the answer. I found out the place where the line needed to be changed and was one step further but then again had an issue on the next step. (which was the same error as the other topic. therefore I posted there as well.)

I am having the exact same issue and not able to fix it.
Can someone help me fixing it ?
I’ll be grateful!

Hi @Muhammad_Zaid_07211,

In the post #2, @Corey_52283 has mentioned that he was able to resolve the issue by modifying the apt-key command on line # 57 in his provision-mongod file.

Can you please make the same changes in your configuration file and see if this resolves the issue?

Note: Before modifying your provision-mongod file, please make sure you have created a copy of this file.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

2 Likes