'vagrant up' gives 'An error occurred while downloading' - vagrant

I use Vagrant on my Linux and OS X machines without problem.
Now on Windows 10 (the preview with Bash for Windows) it fails while downloading my box, without specifying a proper error message:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'trusty' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'trusty' (v0) for provider: virtualbox
default: Downloading: http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
default:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
I also tried downloading the box (so the URL is correct!) and adding it manually but this results in the same:
C:\> vagrant box add ubuntu/trusty64 c:\Users\michi\boxes\trusty-server-cloudimg-amd64-vagrant-disk1.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu/trusty64' (v0) for provider:
box: Unpacking necessary files from: file://c:/Users/michi/boxes/trusty-server-cloudimg-amd64-vagrant-disk1.box
box:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

I found the answer in this github issue: https://github.com/mitchellh/vagrant/issues/6725#issuecomment-223733553
I installed the VC++ 2010 redistributable and vagrant up worked immediately!

Related

The "metadata.json" file for the box 'laravel/homestead' was not found

OC: Windows 10.
Vagrant: 2.2.1.
I run:
vagrant box add laravel/homestead --provider virtualbox
and got an error:
==> box: Loading metadata for box 'laravel/homestead'
box: URL: https://vagrantcloud.com/laravel/homestead
==> box: Adding box 'laravel/homestead' (v6.4.0) for provider: virtualbox
The "metadata.json" file for the box 'laravel/homestead' was not found.
Boxes require this file in order for Vagrant to determine the
provider it was made for. If you made the box, please add a
"metadata.json" file to it. If someone else made the box, please
notify the box creator that the box is corrupt. Documentation for
box file format can be found at the URL below:
https://www.vagrantup.com/docs/boxes/format.html
Before that, I had already executed this command, I added the box and everything worked for me, but then I decided to remove the box through vagrant box remove laravel/homestead and add it again.
The problem was solved by deleting the laravel-VAGRANTSLASH-homestead folder inside the ~\.vagrant.d\boxes directory (C:\Users\User\.vagrant.d\boxes im my case).
After this i successfully run:
$ vagrant box add laravel/homestead --provider virtualbox
==> box: Loading metadata for box 'laravel/homestead'
box: URL: https://vagrantcloud.com/laravel/homestead
==> box: Adding box 'laravel/homestead' (v6.4.0) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/6.4.0/providers/virtualbox.box
box: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
box:
==> box: Successfully added box 'laravel/homestead' (v6.4.0) for 'virtualbox'!
I hope this helps someone.

Vagrant box could not be found error

I am trying to set up virtual machine using virtual box. I have got virtual box and vagrant installed in my windows 7 64-bit machine. I have also built an environment using puphpet. But whenever I try to install the box ubuntu1404-x64 it throws the error
Bringing machine 'machine1' up with 'virtualbox' provider...
==>Machine1: Box 'puphpet/ubuntu1404-x64' could not be found. Attempting to find and install...
machine1: Box Provider: virtualbox
machine1: Box Version: >= 0
machine1: Box file was not detected as metadata. Adding it directly...
machine1: Adding box 'puphpet/ubuntu1404-x64' (v0) for provider: virtualbox
machine1: Downloading: puphpet/boxes/ubuntu1404-x64
machine1:
An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again.
I checked the URL https://atlas.hashicorp.com/puphpet/boxes/ubuntu1404-x64/ and the box puphpet/ubuntu1404-x64 does exist.
Also when it says The error message, if any, is reproduced below it does not show any description at the terminal.
I googled the issue, tried some of the answers here at stackoverflow but no result. Please help.
I've had a similar situation in the past, and it helped me to download the box using vagrant command line, instead of having it be downloaded automatically ( from the URL in Vagrantfile ):
$ vagrant box add USER/BOX
see more here. Could you try the same approach? It might work for you as well.
EDIT: on a windows box, Microsoft Visual C++ 2010 redist looks to be needed to perform the provisioning of the box. It can be downloaded here. More info on the puhpet issuet: here
I ran into a similar problem and fixed it by installing the latest version of vagrant.

turning files into .tar in vagrant

i've tried fixing the problem "bsdtar: Error opening archive: Unrecognized archive format" #161 but i didnt find an anwser ,
(im using 1.7.4 vagrant which is the latest version.
i tried this approach first :
C:\Users\1>vagrant box add pip C:\Users\1\Desktop
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'pip' (v0) for provider:
box: Unpacking necessary files from: file://C:/Users/1/Desktop
box:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/1/Desktop
after failing i tried importing the file through a url,making me get the error on top.:
C:\Users\1>vagrant box add pip https://bootstrap.pypa.io/get-pip.py
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'pip' (v0) for provider:
box: Downloading: https://bootstrap.pypa.io/get-pip.py
box: Progress: 100% (Rate: 826k/s, Estimated time remaining: --:--:--
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again. The
output from attempting to unpackage (if any):
bsdtar.EXE: Error opening archive: Unrecognized archive format
Vagrant expects either a box path/url or a name of the box that is available on Vagrant Atlas. You give it just arbitrary things that do not contain a box.
To e.g. download the Ubuntu Trusty x64 box, use
vagrant box add ubuntu/trusty64

Could not open file error with Vagrant Up command

Would anyone know what I can do to solve this? I'm a noob with Vagrant.
Crystal:~ Adam$
Crystal:~ Adam$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/Adam/base
Crystal:~ Adam$
It looks like you have the same situation as described in this SO question: Error when trying vagrant up. My answer repeated here:
You may have created a Vagrant project with just vagrant init. That will create your Vagrantfile, but it won't have a box defined.
Instead, you could try vagrant init hashicorp/precise32 which uses a standard Ubuntu image. The Vagrant website has a Getting Started which gives some good examples.

vagrant can't find existing box

i was add box with local file from https://dl.dropboxusercontent.com/s/x1085661891dhkz/lxc-centos6.5-2013-12-02.box
vagrant box add centos centos.box
vagrant init centos
my shell:
cheneytekimbp:vagrant-centos zicjin$ vagrant box list
centos (lxc, 0)
lucid32 (virtualbox, 0)
cheneytekimbp:vagrant-centos zicjin$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'centos' (v0) for provider: virtualbox
default: Downloading: centos
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/zicjin/Work/vagrant-centos/centos
Add the local box file using the full path with the file protocol URI. For instance:
vagrant box add centos file:///Users/zicjin/Work/vagrant-centos/centos.box
(the exact location of course depends on where you've put the file)
$ vagrant box add CentOSMinimal https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box
$ vagrant init CentOSMinimal
$ vagrant up
If you're on windows, you can define the path as:
vagrant box add box_name "C:\Users\JohnDoe\blahblah\box_name.box"
Notice the .box at the end of the path.
Then you can cd into the directory if you're not already there and do vagrant up.
I've solved a similar issue upgrading Vagrant to the latest version and magically it works... :/

Resources