6

I tried updating my Homestead box on from Vagrant and received a 404 error message and I did some searching but not sure what the issue is on why I can update it.

➜  Homestead git:(master) ✗ vagrant box update
==> default: Checking for updates to 'laravel/homestead'
    default: Latest installed version: 2.0.0
    default: Version constraints: >= 0
    default: Provider: virtualbox
There was an error while downloading the metadata for this box.
The error message is shown below:

The requested URL returned error: 404 Not Found
user3732216
  • 1,579
  • 8
  • 29
  • 54
  • https://github.com/hashicorp/vagrant/issues/9442 – techraf Feb 07 '18 at 19:42
  • I was able to install the newsest release of Vagrant and did (re)added the the homestead box however it only downloaded this. ==> default: Box 'laravel/homestead' (v5.1.0) is running the latest version. Which is odd because the latest version is 7.1.1 – user3732216 Feb 07 '18 at 20:13

3 Answers3

28

Open the file ~/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead/metadata_url using a text editor and change it's content to https://vagrantcloud.com/laravel/homestead

joepferguson
  • 1,088
  • 7
  • 18
  • If anyone would know, it's @joepferguson! Thanks. – Tim F Feb 13 '18 at 20:31
  • 1
    I changed mine from `https://atlas.hashicorp.com/laravel/homestead` to `https://vagrantcloud.com/laravel/homestead`, and then I got this error: `Illegal characters found in URL` – Ryan Feb 23 '18 at 00:34
  • Ahhh, the problem was a newline character afterwords. – Ryan Feb 23 '18 at 00:36
  • 1
    If you cant remove the newline from command line open in a text editor and save. it works. – Fasil kk Feb 24 '18 at 21:28
  • 1
    If you're using vim, you can follow this https://stackoverflow.com/questions/1050640/vim-disable-automatic-newline-at-end-of-file to solve newline problem. Can be checked with `cat`, btw. – Anton Kolenkov Mar 07 '18 at 12:43
  • 2
    On Mac OS X, you can edit the url AND avoid the newline problem in one step `echo -n "https://vagrantcloud.com/laravel/homestead" > ~/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead/metadata_url` . Probably works on Linux too (not tested) – Erion May 10 '18 at 08:39
  • Also if there is an access token do not delete it. For example, https://vagrantcloud.com/laravel/homestead?access_token=asdjhfksjdfh – padawanTony Jan 28 '19 at 20:02
  • as for end of line issue due to edit with vim, open the file in binary like this: vim -b ~/.vagrant.d/boxes/debian-VAGRANTSLASH-jessie64/metadata_url, type the Vim command :set noeol, edit the URL and save the file. credit to https://github.com/laravel/homestead/issues/816 – Apit John Ismail Mar 06 '19 at 02:17
6

For me, changing the file data didn't solved the problem. I used an extra param in the command.

vagrant box add laravel/homestead https://vagrantcloud.com/laravel/homestead

So the URL was pass in the command

EduLopez
  • 721
  • 7
  • 18
0

This short script combines the first answer with removal of the newline character.

echo "https://vagrantcloud.com/laravel/homestead" > ~/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead/metadata_url && truncate --size=-1 ~/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead/metadata_url
Mud
  • 72
  • 7