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

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

Related

Is it possible to configure vagrant to use a box mirror?

I'm trying to try out Vagrant, but ...
$ vagrant init hashicorp/precise32
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
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise32' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'hashicorp/precise32'
default: URL: https://atlas.hashicorp.com/hashicorp/precise32
==> default: Adding box 'hashicorp/precise32' (v1.0.0) for provider: virtualbox
default: Downloading: https://atlas.hashicorp.com/hashicorp/boxes/precise32/versions/1.0.0/providers/virtualbox.box
default: Progress: 3% (Rate: 62598/s, Estimated time remaining: 0:52:14)
62K/s is pretty much the fastest its been for multiple boxes I've tried including hashicorp/precise32, hashicorp/precise64, bento/debian-8.2 and some others.
Is there a Vagrant box mirror that I can configure vagrant to use or some other mechanism to allow for faster box downloads?
You can try wget on the URL as
wget https://atlas.hashicorp.com/hashicorp/boxes/precise32/versions/1.0.0/providers/virtualbox.box
There has been issue opened related to this without clear fix. vagrant uses curl internally but it might work better using wget instead.
once you have the box file you still need to add to vagrant (vagrant box add ...)

How start a local VM built by packer?

I am new to packer.
For a start I tried to build: https://github.com/shiguredo/packer-templates/tree/develop/ubuntu-14.04 which worked fine. But when I want to sin it up via vagrant up I get the following error:
Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
After calling vagrant init a config file which looks like a default config file is created. But still there are errors:
Bringing machine 'default' up with 'parallels' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: parallels
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: parallels
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 /Downloads/packer-templates-develop/ubuntu-14.04/base
How can I start my packer-generated VM locally?
Is the only solution to keep track of the Vagrantfile manually?
Edit:
if I call vagrant init myNewlyCreatedBox.box
Then vagrant will try too boot the VM but
Failed to mount folders in Linux guest. This is usually because
the "prl_fs" file system is not available. Please verify that
Parallels Tools are properly installed in the guest and
can work properly. If so, the VM reboot can solve a problem.
The command attempted was:
mount -t prl_fs -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t prl_fs -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
Those templates will generate a Vagrant box for you. If the process completes successfully you should have ubuntu-14-04-x64-virtualbox.box and ubuntu-14-04-x64-vmware.box file as specified by template.json file. To use those newly created boxes in Vagrant you'll need to add the one corresponding to your specific hypervisor to the list of boxes that Vagrant knows about by the following:
vagrant box add <nameToReferToBox> <pathToBoxYouJustCreated>
for example
vagrant box add ubuntu-14-04-x64 ubuntu-14-04-x64-virtualbox.box
Then to create an instance of that box (a VM) you can simply create a Vagrant file targeting the new box you just imported:
vagrant init ubuntu-14-04-x64
and then spin up a VM based on the base box:
vagrant up

Vagrant error: Failed to mount folders in Linux guest

I have a vagrant error. The log as follows:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /Users/diguage/box/centos
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
I Google it. StackOverflow had the same question:
Vagrant error : Failed to mount folders in Linux guest
I did it as the top answer: here. The different is that I downloaded the VBoxGuestAdditions_4.3.18.iso. But it did not work.
I try the second answer: here. It also did not work.
So, I have to ask the question.
My environment is :
Mac OSX 10.10
vagrant 1.6.3
CentOS release 6.5 (Final)
Kernel 2.6.32-431.29.2.el6.x86_64
VirtualBox 4.3.18
PS:
I used the box chef / centos-6.5. I first start the box, it was OK. But I sudo yum update,then sudo yum clean, restart the box, export the error.
Use Following is work fine for me.
vagrant plugin install vagrant-vbguest
I was having the same problem with the same setup, I noticed the problem is only with centos 6.5, so I am using chef/centos-6.6 and it has been working fine. There is very little difference between 6.5 and 6.6, so you shouldn't have any problems migrating your code over. Here's the link to the chef boxes.
EDIT
Ok, I ended up needing a 6.5 box, so I worked through it. The core issue is that the CentOS base repo doesn't include kernel headers(Ubuntu does). You first need to add the appropriate repos to your /etc/yum.repos.d/CentOS-Vault.repo, and you need to enable them. What you append should look something like this:
[C6.5-centosplus]
name=CentOS-6.5 - CentOSPlus
baseurl=http://vault.centos.org/6.5/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
You also need to check the /etc/yum.conf file and make sure there aren't any exclusions such as:
exclude=kernel*
if so comment this out for the time being, but make sure to uncomment it at the end.
Now, you can install the necessary headers for the kernel. The headers depend on kernel-devel, so lets grab that up first.
yum install kernel-devel-$(uname -r)
Then, grab up the headers
yum install kernel-headers-$(uname -r)
Finally, you'll need the dkms package
yum install dkms
Go back and uncomment the exclusions in yum.conf and you should be good to reboot. With only that installed you could then use:
vagrant package --base MyBase
This will give you a reusable CentOS 6.5 box that you can grab on demand. Hope this wasn't too late for you.
I have experienced this using Vagrant 1.8.1, VirtualBox 5.0.18, Chef 12.10.10 host MacOSX El Capitan and guest CentOS7.
I tried installing kernel-devel inside the guest, installing the latest GuestAdittions and running yum update, but none of these worked for me, so I changed the mount type for "nfs" in both my custom synced folders and chef temporary folder, and it worked!
In Vagrantfile, my synced folders:
config.vm.synced_folder ".", "/vagrant", type: "nfs"
and my chef_solo config:
chef.cookbooks_path = ["chef/cookbooks/"]
chef.synced_folder_type = "nfs"

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 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