Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vagrant box update - Fails with 404 Not Found error #9442

Closed
remd opened this issue Feb 4, 2018 · 56 comments · Fixed by #9499
Closed

vagrant box update - Fails with 404 Not Found error #9442

remd opened this issue Feb 4, 2018 · 56 comments · Fixed by #9499
Assignees
Milestone

Comments

@remd
Copy link

remd commented Feb 4, 2018

Vagrant version

$ vagrant -v
Vagrant 2.0.2

Host operating system

Ubuntu 16.04.3 LTS

Guest operating system

Ubuntu 16.04.3 LTS (ubuntu/xenial64)

Vagrantfile

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/xenial64"

  # insecure vagrant key
  config.ssh.insert_key = false
end

Debug output

$ vagrant --debug box update > debug.output 2>&1
https://gist.github.com/remd/8cc26e356fbb8b04c5f25df82ce077d1

Expected behavior

Should have downloaded and installed the new box version. 20170713.0.0 -> 20180126.0.0

Actual behavior

404 Not Found Error.

Steps to reproduce

  1. Create Vagrantfile with ubuntu/xenial64
  2. vagrant box update

Also, directly navigating to the URL listed in the debug output (https://atlas.hashicorp.com/ubuntu/xenial64) shows a 404 Not Found error in my browser. Is Atlas not working properly at the moment?

References

I could not find any associated with the latest version of vagrant.

EDIT

See #9442 (comment) for a clearer summary of the root cause of this issue.

@Val
Copy link

Val commented Feb 4, 2018

Same with debian/stretch64:

> /usr/bin/curl -I -q --fail --location --max-redirs 10 --user-agent "Vagrant/1.9.1 \
(+https://www.vagrantup.com; ruby2.3.3)" --continue-at - \
-H "Accept: application/json" https://atlas.hashicorp.com/debian/stretch64
HTTP/1.1 200 Connection established

curl: (22) The requested URL returned error: 404 Not Found

At this time "All Systems Operational" https://status.hashicorp.com ...

@mal-risma
Copy link

Testet this with a lot of different boxes including ubuntu/xenial64, centos/7 and laravel/homestead. All gives 404.

@tjventurini
Copy link

tjventurini commented Feb 5, 2018

Same here for ubuntu/xenial64 ... At least it doesn't seem to be our firewall anymore ^^

@wizonesolutions
Copy link

I'm wondering if this is related to Vagrant Cloud now being the source for Vagrant boxes. Perhaps HashiCorp Atlas removed its redirects recently? Going to experiment with this a bit.

@mal-risma
Copy link

Upgraded to Vagrant 2.0.2 and it started working.
Version 1.9.1 is latest in ubuntu 17.10, so anyone running ubuntu need to fetch the latest version from the vagrant homepage.

@Val
Copy link

Val commented Feb 5, 2018

A workarround to add in your Vagrantfile:

Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')

@remd
Copy link
Author

remd commented Feb 5, 2018

@mal-risma I am using Vagrant 2.0.2.

@mal-risma
Copy link

Can't explain why it started working on my machine then. Sorry.

@Val
Copy link

Val commented Feb 5, 2018

@mal-risma : perhaps you don't need authentication

The whole patch to read is: 5f955c3

So my workarround is not a valid solution for authenticated users...

@HenningCash
Copy link

HenningCash commented Feb 5, 2018

I had the same issue. Updated to v2.0.2 but updates were still downloaded from atlas. New installs work fine.
Looks like this is a caching error: Vagrant stores in a file where it downloaded the box from.
So find all $VAGRANT_HOME/boxes/[box-slug]/metadata_url files and replace atlas.hashicorp.com with vagrantcloud.com. After that box updates should work fine again.

I'm not a find/xarg/sed pro but I bet someone will come up with a one-liner to replace all occurrences automatically

@remd
Copy link
Author

remd commented Feb 5, 2018

That looks like the underlying cause @HenningCash. Thank you!

$ cat ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/metadata_url
https://atlas.hashicorp.com/ubuntu/xenial64

After fixing this I was able to successfully download the box update.

Since I had been using a version earlier than Vagrant 2.0.2 when I originally downloaded this box's metadata the metadata_url for each box was still cached against Atlas.

@nicwortel
Copy link

nicwortel commented Feb 5, 2018

sed -i -- 's/atlas.hashicorp/vagrantcloud/g' ~/.vagrant.d/boxes/*/metadata_url

This seems to work for me (on an Ubuntu 16.04 host).

@chrisroberts chrisroberts self-assigned this Feb 5, 2018
@chrisroberts chrisroberts added this to the 2.0.3 milestone Feb 5, 2018
@laurentj
Copy link

laurentj commented Feb 5, 2018

A better solution would be to setup a redirection on the web server of atlas.hashicorp. My 2 cents...

@whatnickcodes
Copy link

This is effecting all boxes. Anyone clarify what's happening here exactly?

@Val
Copy link

Val commented Feb 6, 2018

@whatnickcodes : HashCorp's SysOps/DevOps/WhaterverOps removed previous Vagrant URL redirections from atlas.hashicorp.com to vagrantcloud.com too quickly.

@whatnickcodes
Copy link

whatnickcodes commented Feb 6, 2018

What's a fix for people who aren't going to be knowledgable enough to modify Vagrant meta data?

Edit: I support a popular Vagrant box targeted towards absolute beginners

@Val
Copy link

Val commented Feb 6, 2018

@remd
Copy link
Author

remd commented Feb 6, 2018

@whatnickcodes Likely you will need to wait for the upstream fix. This issue is tagged with the 2.0.3 milestone, so that, presumably, will be the version that this fix lands in.

@samrocketman
Copy link

@whatnickcodes the fix is to install the latest version of Vagrant from the website. I also had to upgrade VirtualBox because it was freezing.

@remd
Copy link
Author

remd commented Feb 7, 2018

@samrocketman That won't fix box metadata_urls that were downloaded using a version of Vagrant <1.9.6.

To be clear what the issue here is: 5f955c3 converted cached box metadata_urls from atlas.hashicorp.com to vagrantcloud.com. This was released in Vagrant 1.9.6.

If you were using a version of Vagrant <1.9.6 you were still able to download boxes, update box versions, etc., until very recently (I first encountered the 404 Not Found error on 2018-02-03). Because my box metadata was created with a version of Vagrant <1.9.6, it still pointed at https://atlas.hashicorp.com/ubuntu/xenial64 instead of https://vagrantcloud.com/ubuntu/xenial64 (see #9442 (comment) and #9442 (comment)).

Even after I updated to Vagrant 2.0.2, the issue was still present, because Vagrant does not migrate the old box metadata_url stored in $VAGRANT_HOME/boxes/[box-slug]/metadata_url.

In order to be backwards compatible with box metadata_urls created prior to 1.9.6, a fix needs to be introduced to Vagrant.

@sromberg
Copy link

sromberg commented Feb 7, 2018

What's the ETA for 2.0.3? This issue broke a critical part in our test infrastructure so we are very much looking forward to a fix.

@samrocketman
Copy link

samrocketman commented Feb 7, 2018

@remd I guess I didn't face a problem because I deleted all of my virtualbox VMs and ran

rm -rf ~/.vagrant.d

to clean up the settings. I have .vagrant in my global gitignore (core.excludesfile) file so it's not tracked in my repositories. .vagrant is created in the current working directory where vagrant up is run. That means I can run

# git clean -xfdn to dry run
git clean -xfd

to remove the vagrant metadata. It was an opportunity to clean up a year of vagrant cruft for me.

@Fuxy22
Copy link

Fuxy22 commented Feb 7, 2018

i did vagrant box remove laravel/homestead --all and after vagrant up before i found out what exactly was the issue.

This seems to wor as well since it deleted everything :)

ttarczynski added a commit to ttarczynski/kubernetes-101-workshop that referenced this issue Mar 28, 2018
@alex1x
Copy link

alex1x commented Apr 3, 2018

 ~/vagrant/concourse  vagrant up                 
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'concourse/lite' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'concourse/lite'
    default: URL: https://vagrantcloud.com/concourse/lite
==> default: Adding box 'concourse/lite' (v3.2.1) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/concourse/boxes/lite/versions/3.2.1/providers/virtualbox.box
    default: Download redirected to host: s3.amazonaws.com
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
 ✘  ~/vagrant/concourse  ls -a
.           ..          .vagrant    Vagrantfile
 ~/vagrant/concourse  rm -rf .vagrant 
 ~/vagrant/concourse  vagrant up     
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'concourse/lite' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'concourse/lite'
    default: URL: https://vagrantcloud.com/concourse/lite
==> default: Adding box 'concourse/lite' (v3.2.1) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/concourse/boxes/lite/versions/3.2.1/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
    default: Download redirected to host: s3.amazonaws.com
==> default: Successfully added box 'concourse/lite' (v3.2.1) for 'virtualbox'!

¯\(ツ)

srgvg added a commit to srgvg/vagrant-labs that referenced this issue Apr 19, 2018
ocdtrekkie added a commit to ocdtrekkie/vagrant-spk that referenced this issue Apr 21, 2018
With Vagrant 2.0.3 and up, the DEFAULT_SERVER_URL is frozen, so it cannot be changed. But earlier versions of Vagrant need this line to work. While we could mandate a minimum Vagrant version, this change would set the correct URL if it's wrong, and leave it alone if the Vagrant version is new enough not to need it.

In hashicorp/vagrant#9442 this fix was posted by @reedy, credit where credit is due.
@vavilen84
Copy link

Vagrant 2.0.4 downloaded image successfull without 'not found' error

@samirspatel
Copy link

Not sure if this will help anyone but I just nixed the box from my system, which seemed to resolve the issue

vagrant destroy
vagrant box list
vagrant box remove  {boxName}
vagrant up

@Ayush97Didwaniya
Copy link

it will fix your error.
run command "vagrant destroy".
use version 5.18 of virtual box.
then install version 1.9.2 of vagrant.
restart your computer.
now go to the directory you want to work in.
"vagrant init ubuntu/trusty64" run command.
"vagrant up" run command.

@matthewpennell
Copy link

Update for anyone coming across this thread in the future - after downloading Vagrant version 2.1.2 from their website, the vagrant box update command ran with no complaints, and no issues updating existing boxes.

Specifically it located the metadata in the right place:

==> homestead-7: Loading metadata for box 'https://vagrantcloud.com/laravel/homestead'

Maybe they fixed the issue or added a redirect.

@ramprsad1433
Copy link

Hi Team,
I'm unable to install ubuntu os throgh vagrant,I 'm getting 404 error,Please find the below ,I tried 32 & 64 bit same error,Please check and reply ASAP..
prasad@prasad-PC MINGW64 /i/sample1
$ vagrant up
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty32' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'ubuntu/trusty32' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
vagrant login. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/ubuntu/trusty32"]
Error: The requested URL returned error: 404 Not Found

@NSpencer4
Copy link

Hey @ramprsad1433, try adding the following to your VagrantFile:
config.vm.box = "ubuntu/trusty32"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-i386-vagrant-disk1.box"

bors-servo pushed a commit to servo/saltfs that referenced this issue Dec 31, 2018
Fix vagrant hashicorp url

More details: hashicorp/vagrant#9442

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/931)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/saltfs that referenced this issue Dec 31, 2018
Fix vagrant hashicorp url

More details: hashicorp/vagrant#9442

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/931)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/saltfs that referenced this issue Jan 2, 2019
Fix vagrant hashicorp url

More details: hashicorp/vagrant#9442

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/931)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/saltfs that referenced this issue Jan 2, 2019
Fix vagrant hashicorp url

More details: hashicorp/vagrant#9442

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/931)
<!-- Reviewable:end -->
@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.