The boxes were working fine. Then I halted one (the only one running at the time) and now I can't get either of them back up.
Running vagrant up [name] gives me the following error, regardless of which I pick or whether I leave it at vagrant up for them both to come up:
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* A box must be specified.
Running latest version of Vagrant (1.7.4).
Here is my Vagrantfile in its entirety, comments included (just in case):
# Search for boxes here: https://atlas.hashicorp.com/boxes/search
# Refer to commands_vagrant.txt for command reference
Vagrant.configure("2") do |config|
# Globally defined variables
config.vm.synced_folder "./", "/var/www/public"
# CentOS 6.5, Apache 2.2.15, MySQL 5.5.36 (-u root), PHP 5.3.28
# Note: If PHP session keys don't work, set permissions to 777 (or other more restrictive, but this is guaranteed to work) on /var/lib/php/session
config.vm.define "php5dot3", primary: true do |php5dot3|
config.vm.box = "smallhadroncollider/centos-6.5-lamp"
config.vm.network :forwarded_port, guest: 80, host: 4567
end
# Ubuntu 14.04 (SSH pw: vagrant), Apache 2.4.12, MySQL 5.5.43 (-u root -p root), PHP 5.6.10
config.vm.define "php5dot6" do |php5dot6|
config.vm.box = "scotch/box"
config.vm.network :forwarded_port, guest: 80, host: 4568
end
end
Result of running vagrant status:
Current machine states:
php5dot3 poweroff (virtualbox)
php5dot6 poweroff (virtualbox)
Result of running vagrant global-status:
id name provider state directory
--------------------------------------------------------------------------
e1f3c85 default virtualbox poweroff /home/sam/Web
c588d51 php5dot6 virtualbox poweroff /home/sam/Web
4e71c50 php5dot3 virtualbox poweroff /home/sam/Web
'default' was the singular box I had in my Vagrantfile before I got multi-machines working last week. (Relevant?)
Result of running vagrant box list:
scotch/box (virtualbox, 2.0)
smallhadroncollider/centos-6.5-lamp (virtualbox, 1.0.0)
Any help would be appreciated, thanks.
Inside of your machine definitions, you need to use the variable name of that machine, instead of config. Try this out:
In the file below, I've changed config.vm to either php5dot3.vm or php5dot6.vm:
Vagrant.configure("2") do |config|
# Globally defined variables
config.vm.synced_folder "./", "/var/www/public"
# CentOS 6.5, Apache 2.2.15, MySQL 5.5.36 (-u root), PHP 5.3.28
# Note: If PHP session keys don't work, set permissions to 777 (or other more restrictive, but this is guaranteed to work) on /var/lib/php/session
config.vm.define "php5dot3", primary: true do |php5dot3|
php5dot3.vm.box = "smallhadroncollider/centos-6.5-lamp"
php5dot3.vm.network :forwarded_port, guest: 80, host: 4567
end
# Ubuntu 14.04 (SSH pw: vagrant), Apache 2.4.12, MySQL 5.5.43 (-u root -p root), PHP 5.6.10
config.vm.define "php5dot6", autostart:false do |php5dot6|
php5dot6.vm.box = "scotch/box"
php5dot6.vm.network :forwarded_port, guest: 80, host: 4568
end
end
I also added autostart:false to the definition of your php5dot6 box, which you can remove if you wish. (It just means that running vagrant up will only start the primary by default.
If you are getting this error with DigitalOcean, you may need their plugin:
vagrant plugin install vagrant-digitalocean
Installing the 'vagrant-digitalocean' plugin. This can take a few minutes...
Fetching: multipart-post-2.0.0.gem (100%)
Fetching: faraday-0.15.4.gem (100%)
Fetching: vagrant-digitalocean-0.9.3.gem (100%)
For someone that is having this issue now:
I had deleted my Vagrantfile before trying to destroy it. You need to run the vagrant destroy command from the right directory where the Vagrantfile for that process is.
Run vagrant ssh-config and look at the directory column.
If you, like me, deleted the file, do:
vagrant init
Then
vagrant destroy $id
P.S.: Use sudo if you have permission issues running those commands.
Related
First, apologies: I'm a newbie.
I've created a very basic Vagrantfile by running Vagrant init. I only made a few changes:
config.vm.box = "generic/fedora28"
config.vm.box_version = "1.8.32"
config.vm.provider "libvirt" do |lv|
lv.memory = "4096"
end
(There are also a few items in my config.vm.provision section).
After running vagrant up , the process gets stuck at
==> default: Waiting for domain to get an IP address...
I'm running this off a Fedora 27 box, which uses version 2.0.2 of the Vagrant package (even though current is 2.1.5).
I've tried adding this line:
config.vm.network "private_network", ip: "192.168.100.101"
but it had no effect.
Can anyone help?
I have a Vagrant File that spins up 4 VMs, of image generic/ubuntu2004 on libvirt kvm, to make a k3s cluster that's accessible on the LAN. (multipass + k3s is only accessible via localhost b/c it doesn't allow easy bridging.)
I ran both of these commands > 50 times
sudo vagrant destroy --force --parallel
sudo vagrant up
On the ~51'st time, I noticed vagrant up got stuck on "Waiting for domain to get an IP address..."
What fixed it for me was sudo reboot. You know the classic have you tried unplugging it and plugging it back in?
Something else to try (I rebooted before trying it)
https://bugzilla.redhat.com/show_bug.cgi?id=1283989
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.
I have two directories under /var/www/html, named vlp1 and vlp2 with Vagrant setup. If I run vagrant up separately in these folders the default local URL is vagrant.local for both. But vagrant.local/ always loads site from vlp1 folder.
As it should be, vagrant global-status shows that I have two virtual machines running under these directories. I require to run both sites side by side and to do this the only option I see is to have separate URLs. I believe there is a way to assign different URLs to different sites but don't have any idea how!
What I need to do to accomplish the above so that my sites run like local.vlp1.com and local.vlp2.com or may be like vagrant.vlp1 and vagrant.vlp2?
According to project instructions I have to keep two sites completely separated in two folders and have to use separate Vagrantfiles.
OS: Ubuntu 14.04 64 bit
Installed VitualBox version: 5.1
Installed Vagrant version: 1:1.9.4
Thank you!
UPDATE
Went through the following steps as advised by Henri:
Step 1:
$ vagrant global-status
Output:
id name provider state directory
------------------------------------------------------------------------
eb9b569 default virtualbox running /var/www/html/vlp1
190608c default virtualbox running /var/www/html/vlp2
Step 2: Did a graceful shutdown on vlp2
$ vagrant halt 190608c
Step 3: Output of vagrant global-status now is
id name provider state directory
-------------------------------------------------------------------------
eb9b569 default virtualbox running /var/www/html/vlp1
190608c default virtualbox poweroff /var/www/html/vlp2
Step 4:
$ sudo gedit /var/www/html/vlp2/Vagrantfile
if CONF['ip'] == "dhcp"
config.vm.network :private_network, type: "dhcp", hostsupdater: "skip"
else
config.vm.network :private_network, ip: "192.168.2.5"
end
Step 5: Re up'd vlp2 machine
$ vagrant up 190608c
Step 6:
$ vagrant global-status now shows both machine are back to running state again.
id name provider state directory
------------------------------------------------------------------------
eb9b569 default virtualbox running /var/www/html/vlp1
190608c default virtualbox running /var/www/html/vlp2
Step 7:
In /etc/hosts added following entry
192.168.2.5 vagrant.vlp2
Finally I tried vagrant.vlp2/ in browser but ended up with the following message:
This site can’t be reached
http://vagrant.vlp2/ is unreachable.
As I understand you're using multiple VM so the easiest in this case is to assign each of the VM a static IP (that must be different) so you do so in Vagrantfile
Vagrant.configure("2") do |config|
...
config.vm.network "private_network", ip: "192.168.10.x"
...
end
and you use another IP for the second VM
Vagrant.configure("2") do |config|
...
config.vm.network "private_network", ip: "192.168.20.y"
...
end
and then you update your /etc/hosts file with the information
192.168.10.x vagrant.vlp1
192.168.20.y vagrant.vlp2
I am running Virtualbox version 4.3.40r110317 with Vagrant 1.8.4 and am trying to start a concourse vm with vagrant. I am trying to start a concourse/lite version 2.2.1 vagrant box, however any vagrant up will stall out at this point:
==> 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
I am able to create a working concourse/lite version 1.2.0, but the later variations of version 2 that I have attempted to use all stall out at the same point.
For reference heres my Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# https://atlas.hashicorp.com/concourse/boxes/lite
config.vm.box = "concourse/lite"
config.vm.box_version = "2.2.1"
config.vm.network "forwarded_port", guest: 8080, host: 8080
end
Note:
Due to some other dependency issues I cannot update my version of virtualbox. If you happen to know the latest version of concourse that will work with my current version, it would help.
Make sure you're running VirtualBox 5.1.x. Something changed backwards-incompatibly in VirtualBox that made boxes build with 5.1.x (as we do now for the Concourse boxes) have broken networking when run with 5.0.x.
So #AlexSuraci found it. The answer was: manually clicking the "cable connected" checkbox on eth0 for the box.
For reference to get to the cable connected checkbox do the following:
open virtualbox
right click the concourse VM
click settings
click network at the top of the popup window
select Adapter 1
at the bottom below MAC address and above port forwarding is the
cable connected checkbox
Thanks #zgagnon.
I have a problem with synced folder in Vagrant. My config is really simple:
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.synced_folder ".", "/vagrant"
end
Vagrant usually creates /vagrant folder automatically on start - this time it did not happen so I've done it manually.
But when I create a file in my host system - it's not visible in guest. Any ideas why?
I've succesfully created a similar configuration with:
config.vm.box = "hashicorp/precise64"
but it's a little bit outdated and I want to use Ubuntu 16.04.
Is it a problem with my config, vagrant box, or something else?
You could try: Make sure you have the latest version of Vagrant and VB. Restart your computer (I know, but it sometimes does help in these cases). Try again in a new directory (or vagrant destroy if you want to start fresh and don't need any old content), i.e., make sure the old .vagrant directory isn't there.
vagrant up or vagrant reload and check again.
Assuming you are using VirtualBox, make sure you don't have any "Guest Additions" issues. You could try https://github.com/dotless-de/vagrant-vbguest
If it still doesn't work, check the --debug output again as #frédéric-henri mentioned -- look for all mentions of your share name. Also "/vagrant" isn't always the default, it depends on the box. Sometimes it's "/vagrant_data" or others, but if you specify "/vagrant" in the config -- that should work.