vagrant can't find existing box - vagrant

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... :/

Related

Using Homestead with downloaded box file

I am trying to install laravel/homestead and following the steps described in https://laravel.com/docs/5.4/homestead .
In doing that I initially ran into problems while adding a box in "First Step", so I had to download the virtualbox file externally and added the box using that file:
$ vagrant box list
There are no installed boxes! Use `vagrant box add` to add some.
$ vagrant box add laravel/homestead virtualbox/homestead.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'laravel/homestead' (v0) for provider:
box: Unpacking necessary files from: file://D:/Code/virtualbox/homestead.box
box:
==> box: Successfully added box 'laravel/homestead' (v0) for 'virtualbox'!
$ git clone https://github.com/laravel/homestead.git Homestead
Cloning into 'Homestead'...
...
$ cd Homestead ; git checkout v5.4.0
Note: checking out 'v5.4.0'.
$ bash init.sh
Homestead initialized!
My trouble is in doing vagrant up, it is still trying to download and failing. How can I tell vagrant not to download the box file anymore and use the existing box ?
$ vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Box 'laravel/homestead' could not be found. Attempting to
find and install...
homestead-7: Box Provider: virtualbox
homestead-7: Box Version: >= 2.0.0
==> homestead-7: Loading metadata for box 'laravel/homestead'
homestead-7: URL: https://atlas.hashicorp.com/laravel/homestead
==> homestead-7: Adding box 'laravel/homestead' (v2.1.0) for provider:
virtualbox
homestead-7: Downloading: https://atlas.hashicorp.com/laravel/boxes/homestead/versions/2.1.0/providers/virtualbox.box
I have tried naming my box in first step to homestead-7 , no luck yet. on subsequent executions of vagrant up, vagrant claims to resume from prior download , but the progress does not suggest so.
Here
Successfully added box 'laravel/homestead' (v0) for 'virtualbox'!
You have installed version 0 of the box laravel/homestead. In your version of homestead, it requires to have version greater than 2.0.0.
If you want to use your version of the box, you can add a version parameter in your json file.
{
"version": "0",
"ip": "192.168.10.10",
"memory": 2048,
"cpus": 1,
"provider": "virtualbox",
...
}

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.

Why "vagrant up" gives me an error?

I am installing the datasciencetoolbox and after entering the valgrant up I am receiving the following error:
dyn-72-33-239-166:psql mona$ mkdir MyDataScienceToolbox
dyn-72-33-239-166:psql mona$ cd MyDataScienceToolbox/
dyn-72-33-239-166:MyDataScienceToolbox mona$ vagrant init data-science-toolbox/dst
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
dyn-72-33-239-166:MyDataScienceToolbox mona$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The box 'data-science-toolbox/dst' could not be found.
dyn-72-33-239-166:MyDataScienceToolbox mona$ ls -la Vagrantfile
-rw-r--r-- 1 mona staff 4646 Aug 25 20:55 Vagrantfile
I am following this tutorial: DataScienceToolBox
Are you using an old version of Vagrant, perhaps? Here's what those commands do for me:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'data-science-toolbox/dst' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'data-science-toolbox/dst'
default: URL: https://vagrantcloud.com/data-science-toolbox/dst
==> default: Adding box 'data-science-toolbox/dst' (v0.1.5) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/data-science-toolbox/dst/version/1/provider/virtualbox.box
==> default: Waiting for cleanup before exiting...
The fact that yours doesn't even attempt to retrieve the box from vagrantcloud suggests an old version, maybe.
You can get your version with $ vagrant version.
This box needs version 1.5+ so I updated to version 1.6 downloading from this website and now it is working
http://www.vagrantup.com/downloads.html

box add from vagrantcloud using vagrant 1.4.3

I am trying to add vagrant box using vagrant 1.4.3 on Ubuntu 14.04.1 LTS:
Vagrant 1.4.3 user#machine:~$ vagrant box add
ffuenf/debian-6.0.9-amd64
and I get:
This command was not invoked properly. The help for this command is
available below.
Obviously the format of command is wrong but how can I get box:
https://vagrantcloud.com/ffuenf/debian-6.0.9-amd64
from vagrant cloud?
vagrant box add "ffuenf/debian-6.0.9-amd64"
is your answer.
edit:
My previous answer was based on the latest Vagrant version.
In 1.4.3 you cannot add boxes in this way because it's not working with Vagrantcloud.
Instead you need to manually specify the box url like this:
$ vagrant box add "ffuenf/debian-6.0.9-amd64" https://vagrantcloud.com/ffuenf/debian-6.0.9-amd64/version/7/provider/virtualbox.box --provider virtualbox
You should get the following:
Downloading box from URL: https://vagrantcloud.com/ffuenf/debian-6.0.9-amd64/version/7/provider/virtualbox.box
Extracting box...te: 1591k/s, Estimated time remaining: 0:00:02)
Successfully added box 'ffuenf/debian-6.0.9-amd64' with provider 'virtualbox'!
You need to manually look up the URL of the box you want to add, and use that instead.
So, for example, say you want to add the box puppetlabs/ubuntu-14.04-32-puppet from Vagrantcloud, you need to:
Go to https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet
Click on a version from the versions dropdown on the right hand side (eg, 1.0.0) to get to: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet/versions/1
Copy and paste the URL of the box for the provider you want to use. For Virtualbox in this case, it is: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet/versions/1/providers/virtualbox.box
Use the URL to add the box like this:
vagrant box add "puppetlabs/ubuntu-14.04-32-puppet" https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-32-puppet/versions/1/providers/virtualbox.box --provider virtualbox
I struggled with this for a while. The key was getting the most recent version of vagrant -- 1.7.4 at the time that I am writing this. The download link that I used was: https://www.vagrantup.com/downloads.html
I am running Mac OS X 10.7.5 on a MacBook Pro. To download ubuntu/trusty64 I went to the site https://atlas.hashicorp.com/boxes/search?utm_source=vagrantcloud.com&vagrantcloud=1 which listed the currently available boxes. You can search for a box by description. For example, entering 'debian' as a search term returns a list.
I selected a box and followed the instructions on its page (in my case the page was https://atlas.hashicorp.com/ubuntu/boxes/trusty64). Here is a log of what I did next:
$ vagrant init ubuntu/trusty64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
$ vagrant up --provider virtualbox
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
default: URL: https://atlas.hashicorp.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20150923.0.0) for provider: virtualbox
default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20150923.0.0/providers/virtualbox.box
default: Progress: 56% (Rate: 111k/s, Estimated time remaining: 0:28:59)
This is not exactly answer to your question, but I used:
vagrant box add precise32 http://files.vagrantup.com/precise32.box
and then just change ffuenf/debian-6.0.9-amd64 name to precise32 in config file (Vagrantfile). And it looks like it is running properly. Probably there is somewhere a box file for ffuenf, but I don't know that.

Vagrant, error when running vagrant up --provider=docker

I'm trying to test the new docker support in vagrant 1.6. I'm on windows and I've setup my vagrant file but when I run "vagrant up --provider=docker" I get the following:
Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
default: Vagrant will now create or start a local VM to act as the Docker
default: host. You'll see the output of the `vagrant up` for this VM below.
default:
default: Box 'mitchellh/boot2docker' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
default: Loading metadata for box 'mitchellh/boot2docker'
default: URL: https://vagrantcloud.com/mitchellh/boot2docker
default: Adding box 'mitchellh/boot2docker' (v0.8.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/mitchellh/boot2docker/version/1/provider/virtualbox.box
default: Progress: 100% (Rate: 2999k/s, Estimated time remaining: --:--:--)
The executable 'bsdtar' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.
Uninstall Vagrant completely, remove C:\HashiCorp.
Reinstall Vagrant.
This will fix everything.
Go to Programs and Features
Find Vagrant and Repair
No need to reinstall :)
a fast solution is to attach the path of the mingw binary location to the system's Path variable, e.g.:
C:\HashiCorp\Vagrant\embedded\mingw\bin
Remember to separate path entries with a ;.
Download & Install package follow instruction here http://gnuwin32.sourceforge.net/packages/libarchive.htm
then update your Path environment variable to include the installed path of bsd executable, usually C:\Program Files (x86)\GnuWin32\bin

Resources