1

I've set up a vagrant machine on my mac using the following commands -

vagrant init ubuntu/trusty64
vagrant up

Now I've sshed successfully into the machine using vagrant ssh and trying to use sudo apt-get update, which fails with the following error -

W: GPG error: http://archive.ubuntu.com trusty Release: The following signatures were invalid: BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>

I've tried cleaning my apt cache and removing the /var/lib/apt/lists dir. I've also tried running the following command -

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5

When I do the error changes to - W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/source/Sources Hash Sum mismatch

And when I clean my cache the original error returns.

What can I do to resolve this?

Yaron Idan
  • 6,207
  • 5
  • 44
  • 66

1 Answers1

2

What version of the base box do you have (ubuntu/trust64)? When I follow the steps you took, I get a little warning:

==> default: A newer version of the box 'ubuntu/trusty64' is available! You currently
==> default: have version '20151119.0.0'. The latest is version '20160323.0.0'. Run
==> default: `vagrant box update` to update.

Have you tried running vagrant box update ?

I followed your steps and was able to ssh and sudo apt-get update without any errors on this box.

Brian Brownton
  • 1,313
  • 14
  • 31
  • Thanks, I've ran the update. Although it said I was already running the right version the command ran successfully this time, so either way my problem is solved. – Yaron Idan Mar 29 '16 at 05:22
  • 1
    Update: I just got to my office and connected myself to the LAN here, and now the command fails again. When I connect through my mobile data network, it succeeds again, so the problem lies somewhere in my network settings. If you (or anyone) has any input about this I'll be happy to hear, if not I'll try my luck somewhere else. – Yaron Idan Mar 29 '16 at 09:16
  • 1
    @YaronIdan Is your office LAN behind a proxy? In this case, use the vagrant [proxyconf](http://stackoverflow.com/questions/19872591/how-to-use-vagrant-in-a-proxy-enviroment) plugin. – Marc Tarin Mar 29 '16 at 09:35
  • I believe we are not, since we're a small company using nothing but a switch and a simple router to connect to a home-like in internet connection. I'll try to check it out though, thanks. – Yaron Idan Mar 29 '16 at 09:43
  • @YaronIdan well it definitely seems like some part of the network stack is messing the the request which is why the key signatures aren't matching up... whether that is a proxy, your isp, the nsa, etc is best left up to you to figure out based on the context. – Brian Brownton Mar 29 '16 at 20:03
  • 1
    True that, anyway since you practically lead me to the solution I'll go ahead and mark this question answered. – Yaron Idan Mar 29 '16 at 20:34