Vagrantfile packaged in box (via packer) is not used - vagrant

I used packer to create a vagrant box for a workshop I am running, and packaged vagrantfile in the box via the vagrantfile_template directive in the Vagrant post-processor as shown:
...
"post-processors": [{
"type": "vagrant",
"vagrantfile_template": "vagrantfile_templates/workshop",
"compression_level": "{{user `compression_level`}}",
"output": "fedora-22-x86_64.box"
}],
...
The contents of the resulting .box are:
% tar -tf workshop.box
Vagrantfile
box.ovf
metadata.json
packer-fedora-22-x86_64-disk1.vmdk
The contents of Vagrantfile in the box seem OK, and include the contents of the vagrantfile_template specified in the packer configuration. Note that this Vagrantfile defines two VMs named client and server:
% tar -O -xf freeipa-workshop.box Vagrantfile
# The contents below were provided by the Packer Vagrant post-processor
Vagrant.configure("2") do |config|
config.vm.base_mac = "0800278AF3E8"
end
# The contents below (if any) are custom contents provided by the
# Packer template during image build.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "workshop"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define "server" do |server|
server.vm.network "private_network", ip: "192.168.33.10"
server.vm.hostname = "server.ipademo.local"
end
config.vm.define "client" do |client|
client.vm.network "private_network", ip: "192.168.33.20"
client.vm.hostname = "client.ipademo.local"
end
end
I added the box to vagrant with the name workshop:
% vagrant box add --name workshop workshop.box
==> box: Adding box 'workshop' (v0) for provider:
box: Downloading: file:///.../workshop.box
==> box: Successfully added box 'workshop' (v0) for 'virtualbox'!
% vagrant box list
workshop (virtualbox, 0)
Problem description
When I execute vagrant init workshop and then vagrant up, the Vagrantfile included in the box is not applied:
% vagrant init workshop
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.
% cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "workshop"
... and so on (the rest of the default Vagrantfile)
% vagrant up --provider virtualbox
Bringing machine 'default' up with 'virtualbox' provider...
...
Whoa! Why did it bring up default? According to the Vagrantfile docs the Vagrantfile packaged with the box should be used, and other Vagrantfiles including from the current directory should be merged into it. But this does not seem to be the case.
Vagrant 1.7.2 is the version in use.
I would like workshop participants to be able to bring up the VMs defined in the Vagrantfile included in the box, without supplying that Vagrantfile out of band (in order to minimise dependencies). Have I missed something important?

As all of us know, Vagrant loads and merges multiple Vagrantfiles in a pre-determined order outlined here (in the same section they also point out that multiple Vagrant.configure blocks are also OK).
I was experiencing the same very same issue when Vagrant would not pick up the config.vm.communicator = "winrm" configuration that was bundled in the .box using vagrantfile_template.
However, by Using vagrant --debug I noticed that Vagrant appeared to have cached the bundled Vagrantfile from a previous build of the same box:
INFO loader: Set :"26224240_win7sp1_x64_virtualbox" = ["#<Pathname:/home/thomas/.vagrant.d/boxes/win7sp1_x64/0/virtualbox/Vagrantfile>"]
One would think that vagrant destroy would remove the associated files in vagrant.d but it does not, so I was able to resolve the issue by manually removing ~/.vagrant.d/boxes/win7sp1_x64.
I confirmed that it now was working as intended by seeing that WinRM was indeed being used:
==> default: Waiting for machine to boot. This may take a few minutes...
default: WinRM address: 127.0.0.1:55985
default: WinRM username: vagrant
default: WinRM execution_time_limit: PT2H
default: WinRM transport: negotiate
==> default: Machine booted and ready!
Even though the Vagrantfile in the initialized directory did not have that configuration:
Vagrant.configure("2") do |config|
config.vm.box = "win7sp1_x64"
config.vm.box_url = "/media/data/VagrantBaseBoxes/win7sp1_x64/win7sp1_x64-virtualbox.box"
end
TL;DR:
Make sure no "old" Vagrantfiles are present in vagrant.d that may overwrite what's configured in the 'packer-ed box (see "load order and merging" in the link above).

Related

How to up Vagrant with hashicorp/precise64 box?

I started learning Vagrant and I'm trying to up vagrant machine with hashicorp/precise64 box. I've installed VirtualBox 5.1 on Gentoo and I emerged Vagrant from Gentoo repository. I executed following command in terminal:
pecan#tux ~/vagrant_getting_started $ vagrant box add hashicorp/precise64
==> box: Loading metadata for box 'hashicorp/precise64'
box: URL: https://vagrantcloud.com/hashicorp/precise64
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) virtualbox
3) vmware_fusion
Enter your choice: 2
==> box: Adding box 'hashicorp/precise64' (v1.1.0) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/virtualbox.box
==> box: Successfully added box 'hashicorp/precise64' (v1.1.0) for 'virtualbox'!
pecan#tux ~/vagrant_getting_started $ nano Vagrantfile
pecan#tux ~/vagrant_getting_started $ vagrant up
No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.
If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.
and I got above error when I tried to up Vagrant machine.
Vagrantfile content:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "base"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:
vb.memory = "1024"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
end
end
vagrant up --provider=virtualbox command returns the below error:
pecan#tux ~/vagrant_getting_started $ vagrant up --provider=virtualbox
The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
this to be available on the PATH. If VirtualBox is installed, please find the
`VBoxManage` binary and add it to the PATH environmental variable.
I'm counting for help!
The Vagrantfile is wrong, it does not contain the correct box information
You can remove the whole folder all together and start with vagrant init hashicorp/precise64 which will create a correct Vagrantfile, then you can run vagrant up (virtual box should be the default provider if not run vagrant up --provider virtualbox)
Fix the Vagrantfile and replace
config.vm.box = "base"
with
config.vm.box = "hashicorp/precise64"
Then you can run vagrant up and it will work.

Vagrant on w7 : can't find any box

I am new on stackoverflow and this is my first question...
I had an issue with Vagrant when trying to get a box on a private repository so I tried to get 'hashicorp/precise64' on Atlas and I have the same problem : Vagrant can't find the box.
I am using Vagrant 1.9.3 on Windows 7 with Virtualbox 5.1.18 (with extension pack).
I had no issue on installation.
$ vagrant version
Installed Version: 1.9.3
Latest Version: 1.9.3
You're running an up-to-date version of Vagrant!
Everything seems to be right on initialization, Vagrantfile is created :
$ vagrant init hashicorp/precise64
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.
Vagrantfile :
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "hashicorp/precise64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
end
Here is the error I get when using 'vagrant up' command :
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'hashicorp/precise64'
default: URL: https://atlas.hashicorp.com/hashicorp/precise64
The box 'hashicorp/precise64' 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/hashicorp/precise64
Error: Failed writing body (0 != 1063)
I have the same issue when trying to download other public boxes.
I tried with few Vagrant versions (v1.9.0, v1.9.1, v1.9.2, v1.9.3), with and without admin rights.
I have no proxy and no internet connection issue.
I tried to disable my firewall.
I did some research on this, especially on Vagrant compatibility issues, but I could not find much and the problem remains.
Does anyone have an idea?
I just found the origin of my problem : I had special characters in my windows username that brought encoding issue in Vagrant temporary folder path...
A big thanks to Frédéric Henri (https://stackoverflow.com/users/4296747/fr%c3%a9d%c3%a9ric-henri) who helped me a lot and also found the origin of my issue.

Spin up multiple Vagrant boxes and SSH into them

I have 3 vagrant boxes
vagrant box list
hashicorp/precise32 (virtualbox, 1.0.0)
hashicorp/precise64 (vmware_fusion, 1.1.0)
laravel/homestead (virtualbox, 0.4.2)
when I do vagrant up, and vagrant ssh, I kept logged into hashicorp/precise32 machine.
How do I spin those 3 boxes up at the same time ?
How do I SSH into each of them ?
First you have to create Vagrant environments for each of box in three projects folder:
vagrant init hashicorp/precise32
vagrant init hashicorp/previse64
vagrant init laravel/homestead
Now you can use vagrant up and vagrant ssh in projects folder. Command vagrant global-status show you status yours machines.
vagrant up
will spin up all the vagrant boxes that you have listed in your Vagrantfile.
Then, just simple ssh into them - one by one.
You can include all three machines in the same vagrantfile and do a single vagrant up inside the directory which will bring up all the machines. Here is a virtualbox example, you may have to edit this and add a vmware provider block to get your laravel machine added.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
# declare the machine config in a hash
HOST_CONFIG = {
'ubuntu_32' => 'hashicorp/precise32',
'ubuntu_64' => 'hashicorp/previse64',
'laravel' => 'laravel/homestead'
}
# create the vms
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
HOST_CONFIG.each do |hostname, basebox|
config.vm.define hostname do |hname|
hname.vm.box = basebox
hname.vm.provider 'virtualbox' do |v|
v.name = hostname
end
end
end
end
Once the machines are up, inside the same directory you can use the box names you provided in the hash to ssh into each box.
example:
vagrant ssh ubuntu_32
will take you into hashicorp/precise32 box.
The important part in the vagrantfile that allows you to use a name is
config.vm.define hostname do |hname|
below block attaches the name to the machine inside virtualbox
hname.vm.provider 'virtualbox' do |v|
v.name = hostname
end
This assign the given name to the attached machine(vm). To get the vmware machine to get a name, you'd probably have to wrap this inside an if-else
if hostname == 'ubuntu_64'
hname.vm.provider 'vmware_fusion' do |v|
v.name = hostname
end
else
hname.vm.provider 'virtualbox' do |v|
v.name = hostname
end
end

Box 'laravel/homestead' could not be found

I have downloaded the laravel/homestead box manually from here.
I successfully add the box:
vagrant box add file:///path/to/the/laravel/homestead.box --name 'laravel/homestead'
but when I run vagrant up it says: Box 'laravel/homestead' could not be found even though vagrant box list shows the box.
The download page says that run vagrant init laravel/homestead that generates a vagrantfile but the laravel/homestead repository itself provides a vagrantfile.
I can vagrant up with the vagrantfile that is generated with vagrant init laravel/homestead but it lacks the essential configs inside the laravel/homestead repository's vagrantfile.
This is the vagrantfile that is generated
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "laravel/homestead"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end
it has this setting:
Vagrant.configure(2) do |config|
config.vm.box = "laravel/homestead"
end
I tried to add this to the default laravel/homestead's vagrantfile but it didn't work.
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
confDir = $confDir ||= File.expand_path("~/.homestead")
homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
## HERE I added the setting ############################################
config.vm.box = "laravel/homestead"
########################################################################
end
What should I do?
The Vagrantfile provided by the laravel/homstead project is more advanced than a generic Vagrantfile that is generated by vagrant init
The Vagrantfile provided by the laravel/homstead project uses some ruby code to assist in setting up the vagrant environment. What we can see from the homestead ruby code is that it is checking that you have a box with a version greater than or equal to 0.4.0:
config.vm.box_version = settings["version"] ||= ">= 0.4.0"
As you added the box manually you will see that it is present on your local machine:
$ vagrant box list
laravel/homestead (virtualbox, 0)
Note however the number next to the provider is 0. That number is the box version. As the box was added manually the box metadata was not available and by default you will get a version of 0.
When you now do a vagrant up the code is checking if you have a box >= 0.4.0 which you don't have so is why you are getting Box 'laravel/homestead' could not be found. It would then attempt to download the box at the minimal version required.
To circumvent around this you could create a metadata.json file locally in the same directory as your downloaded box file. e.g:
{
"name": "laravel/homestead",
"versions": [{
"version": "0.4.0",
"providers": [{
"name": "virtualbox",
"url": "file:///path/to/homestead.box"
}]
}]
}
Then run vagrant box add metadata.json
This will install the box with a version and can be confirmed by:
$ vagrant box list
laravel/homestead (virtualbox, 0.4.0)
You will now be able to perform vagrant up using your local box.
I have solved the problem by following. I test only on Mac El-capitan.
vagrant box add laravel/homestead homestead.box
it shows the following:
==> 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:///Users/lwinmaungmaung/Vagrant%20Boxes/Homestead/homestead.box
==> box: Successfully added box 'laravel/homestead' (v0) for 'virtual box'!
And then I changed to vagrant file directory
cd ~/.vagrant.d/
Then list files and I saw My boxes
cent hashicorp-VAGRANTSLASH-precise64 laravel-VAGRANTSLASH-homestead
and choose to laravel by cd laravel-VAGRANTSLASH-homestead
and ls and see 0
I command by mv 0 0.4.0
When I list by vagrant box list
cent (virtualbox, 0)
hashicorp/precise64 (virtualbox, 0)
laravel/homestead (virtualbox, 0.4.0)
Then I edit Vagrant Homestead file vi ~/Homestead/Vagrantfile
and add the following:
config.vm.box = "laravel/homestead"
config.vm.box_url = "https://atlas.hashicorp.com/laravel/homestead"
config.vm.box_version = "0.4.0"
config.vm.box_check_update = false
and then vagrant up
I hope it will works for some whose cannot add by metadata.json directly. Thanks.
if someone have the same probelm and useing win, check if ms visual libraries are ok, the main is curl.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=5555
Why download the box manually, if you can let Vagrant do all that for you?
As said in the homestead documentation:
vagrant box add laravel/homestead will add and download the box for you.
"If this command fails, you may have an old version of Vagrant that requires the full URL:"
vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead
You can add a box manually like so:
vagrant box add laravel/homestead path/to/your/box/file.box
How to Install Manually Downloaded .box for Vagrant
El-Capitan OS
Vagrant 2.2.14
Virtualbox 6
Go to you directory like: /user/(name)/Homestead/scripts
This directory is where you make vagrant init and other installation processes.
Open homestead.rb file with sublime text or text editor then change the following:
config.vm.box_version = settings['version'] ||= '‍‍‍‍‍~> 9'
TO
config.vm.box_version = settings['version'] ||= '‍‍‍‍‍>= 10.1.1'
after this changings you can start your vagrant in the directory
vagrant up
This will take some minutes to import your box into virtualbox.
I followed the accepted answer but still it was trying to download the virtualbox "box". I had to modify the following settings in scripts/homestead.rb
#config.vm.box_version = settings["version"] ||= ">= 1.0.0"
config.vm.box_url = "file:///home/divick/Homestead/virtualbox.box"
Note I have commented out the version line because it was complaining with the following message:
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: >= 1.0.0
==> homestead-7: Box file was not detected as metadata. Adding it directly...
You specified a box version constraint with a direct box file
path. Box version constraints only work with boxes from Vagrant
Cloud or a custom box host. Please remove the version constraint
and try again.
For anyone facing this issue, make sure you upgrade your vagrant and adding laravel/homestead should get installed without issues.

Updated Vagrantfile but still getting warning that my Vagrantfile is outdated

I have updated my Vagrantfile to this:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define :ceph do |ceph|
ceph.vm.box = "big-ceph"
ceph.vm.network :private_network, ip: "192.168.251.100"
ceph.vm.hostname = "ceph"
end
config.vm.define :client do |client|
client.vm.box = "hashicorp/precise64"
client.vm.hostname = "ceph-client"
client.vm.provision :shell, path: "setup/ceph.sh"
client.vm.network :private_network, ip: "192.168.251.101"
end
end
but I am still getting this warning message whenever I vagrant up my virtual machines.
calvin % vagrant reload ceph && vagrant reload client
There were warnings and/or errors while loading your Vagrantfile
for the machine 'ceph'.
Your Vagrantfile was written for an earlier version of Vagrant,
and while Vagrant does the best it can to remain backwards
compatible, there are some cases where things have changed
significantly enough to warrant a message. These messages are
shown below.
Warnings:
* `config.vm.customize` calls are VirtualBox-specific. If you're
using any other provider, you'll have to use config.vm.provider in a
v2 configuration block.
Any idea why?
Ok, I figured it out. This 3rd party ceph box that I am using comes with its own Vagrantfile which overrides my Vagrantfile and the included box Vagrantfile (which is located in ~/.vagrant.d/boxes/big-ceph) still contains
config.vm.customize ["modifyvm", :id, "--nictype1", "virtio"]
Comment that out and I no longer see the annoying warning.

Resources