Vagrant up error getting key id from url

==> default: TASK [mariadb : Add MariaDB MySQL apt-key] *************************************
==> default: System info:
==> default: Ansible 2.0.2.0; Vagrant 1.8.6; Linux
==> default: Trellis at “Enable per-site setup for permalink structure”
==> default: ---------------------------------------------------
==> default: error getting key id from url: http://keyserver.ubuntu.com/pks/lookup?op=get&
==> default: fingerprint=on&search=0x…
==> default: fatal: [192.168.50.5]: FAILED! => {“changed”: false, “failed”: true, “traceback”: “Traceback (most recent call last):\n File “/root/.ansible/tmp/ansible-tmp-1477078689.21-34602049943728/apt_key”, line 166, in download_key\n return rsp.read()\n File “/usr/lib/python2.7/socket.py”, line 355, in read\n data = self._sock.recv(rbufsize)\n File “/usr/lib/python2.7/httplib.py”, line 612, in read\n s = self.fp.read(amt)\n File “/usr/lib/python2.7/socket.py”, line 384, in read\n data = self._sock.recv(left)\nerror: [Errno 104] Connection reset by peer\n”}

I’m getting this error on a clean Vagrant machine, firstly on clean vagrant up, now happening after vagrant destroy, vagrant up.
The weird thing is that the whole trellis repo works A-OK on the remote host with staging environment.

I just noticed that the Virtual Box has two network adapters, one host-only and one NAT. Could that have an impact?

Getting the same error; @Ivan_Svaljek, were you able to resolve?

Not yet, but I have a couple of questions:

  • do you have the latest Virtual Box 5.0.28 ?
  • do you have Hyper-V installed besides?
  • which version of Vagrant do you have?
  • does the created machine have two network adapters?

This is part of every Vagrant box from what I can see

As for an issue with your boxes not being able to hit keyserver.ubuntu.com from the looks of it… but it works on staging/production… I would assume it’s something with your local setup. I’ve never seen it, but perhaps a firewall issue?

But I did vagrant ssh to the local box and tried pinging that same URL and did a successful wget of the same from inside the box, that’s what troubling me.

  • running Virtual Box 5.1.8 (gui)
  • no Hyper-V
  • $ vagrant --version Vagrant 1.8.6
  • yep, 2 network adapters, which is expected as @kalenjohnson mentioned

I installed GPG Tools (I’m on OS X 10.11.6) and now sudo apt-get update works from inside the VM. I’ll try re-provisioning and seeing if I get the same error.

@runofthemill does your parent folder have a dot in it’s name? Like
example.com/
/site
/trellis
?
If it does, try renaming it without, then running vagrant destroy, then delete your virtual machine, then delete .vagrant folder in your trellis folder and then try vagrant up, followed by vagrant provision if it fails the first time.
Seems to have worked for me.

No dot in the parent folder…

I de-activated Avast Mac Security’s web shield, and that problem no longer occurs, so perhaps you have a firewall/security app that’s running?

Now though it fails on the next step…:

TASK [mariadb : Add MariaDB MySQL deb and deb-src] *****************************
System info:
  Ansible 2.0.2.0; Vagrant 1.8.6; Darwin
  Trellis at "Enable per-site setup for permalink structure"
---------------------------------------------------
MODULE FAILURE

Splitting up /var/lib/apt/lists/partial/nyc2.mirrors.digitalocean.com_mariadb
_repo_10.0_ubuntu_dists_trusty_InRelease into data and signature
failedTraceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-
tmp-1477514439.05-98116588384278/apt_repository", line 3322, in <module>
    main()
  File "/home/vagrant/.ansible/tmp/ansible-
tmp-1477514439.05-98116588384278/apt_repository", line 471, in main
    cache.update()
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 454, in update
    raise FetchFailedException(e)
apt.cache.FetchFailedException: E:GPG error:
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty
InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network
require authentication?)

failed: [default] (item=deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main) => {"failed": true, "item": "deb http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main", "module_stderr": "", "parsed": false}
---------------------------------------------------

Time for some more debugging… :stuck_out_tongue:

I managed to get it working, uninstalling Avast Mac Security completely, and making some tweaks to the following in the mariadb role, based off the MariaDB install wizard:


/trellis/roles/mariadb/defaults/main.yml

mariadb_keyserver_fingerprint: "0xF1656F24C74CD1D8"
mariadb_mirror: sfo1.mirrors.digitalocean.com
mariadb_version: "10.1"
mariadb_dist: xenial

/trellis/roles/mariadb/tasks/main.yml

- name: Add MariaDB MySQL apt-key
  apt_key:
    keyserver: hkp://keyserver.ubuntu.com:80
    id: "{{ mariadb_keyserver_fingerprint }}"
    state: present

- name: Add MariaDB MySQL deb and deb-src
  apt_repository:
    repo: "deb [arch=amd64,i386,ppc64el] http://{{ mariadb_mirror }}/mariadb/repo/{{ mariadb_version }}/ubuntu {{ mariadb_dist | default(ansible_distribution_release) }} main"
    state: present
1 Like