Installation via Vagrant requires GUI - virtualization

UPDATE (5 Feb, 2014) : This error comes up when machine is restarted without proper shutdown
I am trying to install EdX's open source Learning Management System, through their development vagrant box on a remote machine. However, I get an error related to virtual machine GUI. Is there anything that can be done via CLI/ssh ?
This is the exact error.
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
Below are the contents of VagrantFile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.network :forwarded_port, guest: 8000, host: 9000
config.vm.network :forwarded_port, guest: 8001, host: 9001
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, ip: "192.168.20.40"
nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
config.vm.synced_folder ".", "/opt/edx/edx-platform", id: "vagrant-root", :nfs => nfs_setting
# Make it so that network access from the vagrant guest is able to
# use SSH private keys that are present on the host without copying
# them into the VM.
config.ssh.forward_agent = true
config.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"]
# This setting makes it so that network access from inside the vagrant guest
# is able to resolve DNS using the hosts VPN connection.
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
config.vm.provision :shell, :path => "scripts/install-acceptance-req.sh"
config.vm.provision :shell, :path => "scripts/vagrant-provisioning.sh"
end

No, there's not much you can do/diagnose using CLI or Ssh at this stage, because the VM fails to initialize properly and is not in a "working" state.
You should follow the advice contained in the error message.
Destroy your current VM:
vagrant destroy
then open VirtualBox GUI, and restart the Vagrant setup with :
vagrant up
You can then watch in the VM Console/Window (from Virtualbox GUI) what fails and prevents the setup from running.
An alternative way to start the VM with a console GUI would be to modify your Vagrantfile:
# You will find this line in the Vagrantfile
Vagrant.configure("2") do |config|
#Add this directive
config.vm.provider "virtualbox" do |v|
v.gui = true
end
end
(destroy your existing and failing VM with vagrant destroyand then run vagrant up)
If the remote machine (where VirtualBox runs) is a Unix box accessed using SSH, you may be able to export the GUI to your local machine using the -Xoption when SSHing to it. See this answer for more details about ssh -X

This message occured with my environment because 2 things:
1 - If your VirtualBox Software GUI have is closed, just open it.
Ps.: Try vagrant destroy then vagrant up again
2 - If the problem persist, just update your VirtualBox GUI.
VirtualBox Downloads
Let me know if it's done.

Related

vagrant up failed my centos 4.1 i386 box

vagrant up failed
here is my "Vagrantfile"
#-*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION="2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos41build"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--cpus", "1", "--memory", "1024"]
vb.gui = false
end
config.vm.define :centostest41 do |centostest41|
centostest41.vm.network "private_network", ip: "192.168.10.10"
centostest41.vm.hostname = "centosfivefour"
## ssh
centostest41.vm.network :forwarded_port, guest: 22, host: 2105
end
end
that is fail messages
$ vagrant up
Bringing machine 'centostest41' up with 'virtualbox' provider...
==> centostest41: Clearing any previously set forwarded ports...
==> centostest41: Fixed port collision for 22 => 2222. Now on port 2203.
==> centostest41: Clearing any previously set network interfaces...
==> centostest41: Preparing network interfaces based on configuration...
centostest41: Adapter 1: nat
centostest41: Adapter 2: hostonly
==> centostest41: Forwarding ports...
centostest41: 22 => 2105 (adapter 1)
centostest41: 22 => 2203 (adapter 1)
==> centostest41: Running 'pre-boot' VM customizations...
==> centostest41: Booting VM...
==> centostest41: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
this box made in myself by centos4.1i386 virtualbox
how to solve this problem?
i was search this issue. but i can't solve.... gui config -> false solution is failed
this error get when i give to vagrant debug option
INFO interface: error: The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run vagrant up while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run vagrant up while the
VirtualBox GUI is open.
The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.
INFO interface: Machine: error-exit ["Vagrant::Errors::VMBootBadState", "The guest machine entered an invalid state while waiting for it\nto boot. Valid states are 'starting, running'. The machine is in the\n'poweroff' state. Please verify everything is configured\nproperly and try again.\n\nIf the provider you're using has a GUI that comes with it,\nit is often helpful to open that and watch the machine, since the\nGUI often has more helpful error messages than Vagrant can retrieve.\nFor example, if you're using VirtualBox, run vagrant up while the\nVirtualBox GUI is open.\n\nThe primary issue for this error is that the provider you're using\nis not properly configured. This is very rarely a Vagrant issue."]

Vagrant is attempting to interface with the UI in a way that requires a TTY

Problem: vagrant up fails with the error below. I am running vagrant on Windows 7 and the base box is Ubuntu )( files.vagrantup.com/precise32.box ).
how can it be fixed?
vagrant.bat up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Available bridged network interfaces:
1) Intel(R) PRO/1000 EB Network Connection with I/O Acceleration
2) Intel(R) PRO/1000 PL Network Connection
Vagrant is attempting to interface with the UI in a way that requires
a TTY. Most actions in Vagrant that require a TTY have configuration
switches to disable this requirement. Please do that or run Vagrant
with TTY.
Process finished with exit code 1
thanks
This worked for me on cygwin:
Or add this to ~/.bashrc:
export VAGRANT_DETECTED_OS=cygwin
Then I got the "Vagrant displays a message that it needs to run some internal upgrades..."
Edit - Oops! Spoke to soon. During its updates, I got Warning: Authentication failure. Retrying... until timeout :P
Edit 2 - I was able to fix it by setting config.ssh.private_key_path to the .vagrant.d/insecure_private_key in my Windows user's home directory.
I had the same error while destroying a Vagrant Box. I simply added -f and it did the job.
vagrant destroy m001 -f
This is happening because when script attempts vagrant destroy, Vagrant asks for [Yes/No] confirmation. Adding -f skips that.
I got the same error after upgrading Vagrant from 1.4 to 1.6.3 (Windows 7).
Running VAGRANT_HOME\bin\vagrant.exe manually resolved this issue for me:
Execute VAGRANT_HOME\bin\vagrant.exe
Vagrant displays a message that it needs to run some internal upgrades
"Press any key to continue"...
Once the process finished (it took several minutes), I was able to proceed with Vagrant instance launch as usual.
This is caused by Vagrant finding multiple Ethernet interfaces that can be used as public network and Vagrant cannot decide which one to use.
There are 3 options:
Deactivate one of the 2 adapters, so that Vagrant can use the other
Specify the Ethernet adapter you would like Vagrant to use in the vagrantfile. Like this:
app.vm.network "public_network", bridge: "Intel(R) PRO/1000 PL Network Connection"
Running the vagrant executable manually as already described in Al Belsky's answer
If you are on Windows and are starting Vagrant through MinGW (Git Bash for example) and get this message, try running it once through Windows' default cmd.exe. You are then able to answer the question about your network adapters.
I'm using Vagrant 1.7.4
Execute the below code before running vagrant up:
export VAGRANT_DETECTED_OS=cygwin
That will eliminate the exiting of vagrant and will allow you to choose Network Interface.
This may also be caused by not having Hardware Virtualization enabled in BIOS.
Also encountered this with Windows 10, when Vagrant cannot properly detect OS.
also can happen if you have both vmware and virtual box installed and you try to use MinGW.

Chef workflow for new cookbooks

While building my own cookbooks I find myself constantly within this cycle:
Change cookbook on my local computer
Upload modified cookbook to chef server
Run chef-client on remote machine
Repeat
Since I am new to chef, I repeat that cycle extremely often, but I find rather cumbersome uploading and downloading so frequently from the chef server.
How experienced chef users ease this cycle? I learnt Chef with the free hosted solution, but I am not sure if I should be better off using just Chef-solo and move back later to the hosted version once I have many servers and more experience with chef.
Is there maybe a workflow where I can quickly try changes to my cookbooks directly on my remote machine while using hosted Chef but without uploading them?
I do all my development locally on my laptop, using Vagrant. When the cookbook is ready, it gets pushed to it's new Git repository home and integrated into my production chef server infrastructure.
The following example runs nginx on a virtualbox image.
Example
Install vagrant plugins (only needs to be done once):
vagrant plugin install vagrant-omnibus
vagrant plugin install vagrant-berkshelf
vagrant plugin install vagrant-chef-zero
Use Berkshelf to generate a new application cookbook.
$ berks cookbook demo
create demo/files/default
create demo/templates/default
create demo/attributes
create demo/definitions
create demo/libraries
create demo/providers
create demo/recipes
create demo/resources
create demo/recipes/default.rb
create demo/metadata.rb
create demo/LICENSE
create demo/README.md
create demo/Berksfile
create demo/Thorfile
create demo/chefignore
create demo/.gitignore
run git init from "./demo"
create demo/Gemfile
create demo/Vagrantfile
Edit the following files (Details below):
Vagrantfile <-- Controls vagrant's operation
metadata.rb <-- List community cookbook dependencies
recipes/default.rb <-- Calls to community cookbook recipes and LWRPs
Running vagrant will startup a virtual machine that is provisioned using chef-client. The chef zero plugin will run a local embedded instance of chef-server. The berkself plugin is used to automatically load the cookbook dependencies.
vagrant up
The following command will rerun chef-client (following edits):
vagrant provision
Finally, the really big advantage of doing development, using local virtualization, is that you can tear everything down and build it again from scratch:
vagrant destroy -f && vagrant up
Vagrantfile
Controls vagrant's operation. In this case I'm only starting a single VM, provisioned using chef-client:
Vagrant.require_plugin "vagrant-omnibus"
Vagrant.require_plugin "vagrant-berkshelf"
Vagrant.require_plugin "vagrant-chef-zero"
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Box config
config.vm.box = "saucy64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box"
# Virtualbox config
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 1024]
end
# Networking config
config.vm.network "private_network", ip: "10.0.0.10"
# Plugin config
config.omnibus.chef_version = :latest
config.chef_zero.enabled = true
config.berkshelf.enabled = true
# Chef config
config.vm.provision :chef_client do |chef|
chef.add_recipe "demo"
end
end
The omnibus plugin is responsible for installing the desired version of chef. The Berkshelf plugin will download cookbook dependencies and when combined with chef-zero will upload cookbooks during each provision run.
metadata.rb
Add nginx as a cookbook dependency:
name 'demo'
maintainer 'YOUR_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installs/Configures demo'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends "nginx"
The Berksfile is preconfigured to load the cookbook dependencies, listed in the metadata file, from the community cookbook repository.
site :opscode
metadata
recipes/default.rb
Run the default nginx recipe
#
# Cookbook Name:: demo
# Recipe:: default
#
# Copyright (C) 2014 YOUR_NAME
#
# All rights reserved - Do Not Redistribute
#
include_recipe "nginx"
I go through that loop most of the time during my testings. But I also use Chef solo when I need to try several minor changes in a recipe. If you have a test machine with a local copy of your chef repo then you can try making changes there and running chef solo to see the results. This way there's no uploading.

vagrant cannot access webserver on localhost:8080

I am running CentOS 6.4 through vagrant.
I have put this line inside my Vagrantfile:
config.vm.network :forwarded_port, guest: 80, host: 8080
Then I have installed nginx in the VM and verified it's working with:
wget http://locahost/
Works fine.
But from my host machine (Macbook Air, Mountain Lion) when I go to:
http://localhost:8080
It times out. Did I miss any configuration in Vagrantfile?
I have used this box:
https://github.com/NREL/vagrant-boxes
Have you checked your iptables?
It's a common mistake: when you use provisioning you also have to configure your iptables. (For puppet you have this module.) If you don't want to work with a firewall you can just do vagrant ssh followed by sudo service iptables stop.
What do you see when you go to your browser? Does it say Data not received or it never stops reloading? Do you get any messages in your browser? The server config file must be a bit messed up. Try reloading the server configuration, and restarting it.
Also, try changing the port number to something else. With the newer version of Vagrant, the syntex looks a bit different. So you have to do:
config.vm.forward_port 80, 2759
This is the config file that I use for one of my instances:
Vagrant::Config.run do |config|
config.vm.box = 'rails-dev-ready'
config.vm.host_name = 'rails-dev-ready'
config.vm.forward_port 5800, 5800
config.vm.forward_port 1080, 1090
config.vm.forward_port 80, 2759
config.vm.provision :puppet,
:manifests_path => 'puppet/manifests',
:module_path => 'puppet/modules'
config.vm.share_folder "sharedapps", "/home/vagrant/sharedapps", "sharedapps"
end
I recently set up a CentOS 6.4 box. My ports got all messed up because of iptables. I just disabled the service. It's in /sbin/sevices.
You may run the following command to find out if any other process (such as Tomcat) is bind to port 8080:
lsof -i :8080
If so, that may cause the problem.
I have found a solution,
I have found that there is an issue with Apache + vagrant, and sometimes Apache won't start automatically.
Please try: sudo service apache2 start once logged in via ssh.
I was having issues with Vagrant and all the error messages indicated a networking problem, but in reality my Apache service just wasn't starting on vagrant up

Specific VM name to target in a multi-VM environment

I am creating two CentOS Boxes with a Vagrantfile, and using two unique host names for them, in their respectibe blocks
box1_config.vm.host_name = "Base1"
box1_config.vm.network:hostonly, "192.168.50.4"
box2_config.vm.host_name = "Base2"
box2_config.vm.network:hostonly, "192.168.50.5"
The OS starts without any issues, but I don't know what hostname to use to access them.
I tried following as argument to "vagrant ssh", but none worked and I get error: "This command requires a specific VM name to target in a multi-VM environment"
Tried with:
host_name
IP Address
The VM Name in VirtualBox
Any clues where I might be going wrong?
The argument for vagrant ssh is the symbol attached to the vm definition block. For example (from the vagrant docs):
Vagrant::Config.run do |config|
config.vm.define :web do |web_config|
web_config.vm.box = "web"
web_config.vm.forward_port 80, 8080
end
config.vm.define :db do |db_config|
db_config.vm.box = "db"
db_config.vm.forward_port 3306, 3306
end
end
you would do
vagrant ssh web
or
vagrant ssh db
since those are the names of the box as defined in the config.
HTH.