Initially, I had 8 vagrant machines running and something went wrong. So I deleted the vms in ~/VirtualBox\ VMs folder and placed the backup .vmdk files in the same location.
Then I tried running vagrant up...
But I'm getting the following error
Bringing machine 'virtual-am1' up with 'virtualbox' provider...
==> virtual-am1: Importing base box 'centos653'...
==> virtual-am1: Matching MAC address for NAT networking...
==> virtual-am1: Setting the name of the VM: vagrant_virtual-am1_1478100170176_83326
==> virtual-am1: Clearing any previously set network interfaces...
==> virtual-am1: Preparing network interfaces based on configuration...
virtual-am1: Adapter 1: nat
virtual-am1: Adapter 2: bridged
==> virtual-am1: Forwarding ports...
virtual-am1: 22 (guest) => 2203 (host) (adapter 1)
==> virtual-am1: Running 'pre-boot' VM customizations...
A customization command failed:
["modifyvm", :id, "--name", "virtual-am1"]
The following error was experienced:
#<Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["modifyvm", "6dd13964-e648-40cd-932e-3e18be375d31", "--name", "virtual-am1"]
Stderr: VBoxManage: error: Could not rename the directory '/home/vagrant/VirtualBox VMs/vagrant_virtual-am1_1478100170176_83326' to '/home/vagrant/VirtualBox VMs/virtual-am1' to save the settings file (VERR_ALREADY_EXISTS)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "SaveSettings()" at line 2788 of file VBoxManageModifyVM.cpp
>Please fix this customization and try again.
This is how my Vagrantfile looks like...
We had a custom Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
#Parse nodes config file
nodes_config = (JSON.parse(File.read("nodes.json")))['nodes']
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.insert_key = false
config.vm.box = "centos653"
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box"
# config.vm.provision :shell, path: "bootstrap.sh"
nodes_config.each do |node|
node_name = node[0] # name of node
node_values = node[1] # content of node
config.vm.define node_name do |config|
# configures all forwarding ports in JSON array
ports = node_values['ports']
ports.each do |port|
config.vm.network :forwarded_port,
host: port[':host'],
guest: port[':guest'],
id: port[':id']
end
config.vm.synced_folder "/bits", "/vagrant/bits"
config.vm.synced_folder "../virtual", "/vagrant/virtual"
config.vm.hostname = node_values[':hostname']
#config.vm.network :private_network, ip: node_values[':ip']
config.vm.network "public_network", bridge: 'enp134s1f0', ip: node_values[':ip']
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", node_values[':memory']]
vb.customize ["modifyvm", :id, "--name", node_values[':node']]
vb.customize ["modifyvm", :id, "--cpus", 8]
end
end
end
end
This is how my nodes.json file looks like
{
"nodes": {
"virtual-am1": {
":node": "virtual-am1",
":ip": "192.168.1.50",
":hostname": "am1.onefederation.org",
"ports": [
{
":host": 2203,
":guest": 22,
":id": "ssh"
}
],
":memory": 1024
},
}
}
Please help!!!
I've had this error and you can use this fix:
Delete folder project in vagrant
rm -rf /home/protobox/VirtualBox VMs/project_folder
Go to project folder:
cd /var/www/project_folder
Then restart vagrant:
vagrant destroy**maybe more**`vagrant destroy -f`
vagrant reload
Finally you start vagrant
vagrant up
vagrant ssh
Or you can refer to here: http://getprotobox.com/docs/issues/vbox_rename
Good luck!
Related
I have moved this question over from Serverfault I thought it was more of a question belonging there :-)
I have Vagrant version 1.9.1 on macOS and I have VirtualBox 5.1.12
I am trying to have a go at creating a multi machine Vagrant file and I am running into trouble when I want to run it.
I get the message:
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The following settings shouldn't exist: memory, name
Now at this stage I have commented out the second machine, because I get the error twice - so I am just trying to fix the first one.
I have seen on other threads I should remove the .vm in the lines that are in the "web" block, but if I do that then I get this error:
There are errors in the configuration of this machine. Please fix
the following errors and try again:
Vagrant:
* Unknown configuration section 'memory='.
* Unknown configuration section 'name='.
* Unknown configuration section 'network'.
* Unknown configuration section 'provision'.
I am at a bit of a loss here, because the answers I am getting make sense in theory and I started this from the vagrant up docs, but somehow in my case I can't get it running.
My vagrant file is right here - so please any help would be appreciated :-)
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.provider "virtualbox" do |vb|
vb.gui = false
end
config.vm.define "web" do |web|
web.vm.name = "16.04-web01"
web.vm.memory = "512"
web.vm.network "private_network", ip: "192.168.50.3"
web.vm.network "forwarded_port", guest: 80, host: 8083
web.vm.network "public_network", bridge: "en1: Wi-Fi (AirPort)"
web.vm.provision :shell, path: "bootstrap.sh"
end
# config.vm.define :sql01 do |sql|
# sql.vm.name = "16.04-sqlserver"
# sql.vm.memory = "4096"
# sql.vm.network "private_network", ip: "192.168.50.2"
# sql.vm.network "forwarded_port", guest: 80, host: 8084
# sql.vm.network "public_network", bridge: "en1: Wi-Fi (AirPort)"
# sql.vm.provision :shell, path: "bootstrap.sh"
# end
#Options for Me specific
config.vm.synced_folder "/Applications/MAMP/htdocs/", "/htdocs_home"
end
name and memory are provider specific parameters so they need to be moved in this block
Vagrant.configure("2") do |config|
config.vm.box = "geerlingguy/ubuntu1604"
config.vm.define "web" do |web|
web.vm.network "private_network", ip: "192.168.50.3"
web.vm.network "forwarded_port", guest: 80, host: 8083
web.vm.network "public_network", bridge: "en1: Wi-Fi (AirPort)"
web.vm.provision :shell, path: "bootstrap.sh"
web.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.name = "16.04-web01"
vb.memory = "512"
end
end
config.vm.define :sql01 do |sql|
sql.vm.network "private_network", ip: "192.168.50.2"
sql.vm.network "forwarded_port", guest: 80, host: 8084
sql.vm.network "public_network", bridge: "en1: Wi-Fi (AirPort)"
sql.vm.provision :shell, path: "bootstrap.sh"
sql.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.name = "16.04-sqlserver"
vb.memory = "4096"
end
end
#Options for Me specific
config.vm.synced_folder "/Applications/MAMP/htdocs/", "/htdocs_home"
end
After i have upgraded the vagrant from 1.8.1 to 1.8.4, when i issue vagrant up command, only first machine starts, while second only will only start if I issue "vagrant up vmname" command. I do not have anything regarding autostart and i assume that both should start, but they dont...
code below:
Vagrant.configure(2) do |config|
config.vm.define :webserver do |webserver|
webserver.vm.box = BASE_IMAGE_NAME
webserver.vm.box_url = BASE_IMAGE_ARTIFACTORY_REF
webserver.vm.network "private_network", ip: "10.2.0.10"
webserver.vm.network "forwarded_port", guest: 80, host: 8880
webserver.vm.network "forwarded_port", guest: 443, host: 4443
webserver.vm.network "forwarded_port", guest: 8080, host: 8888
webserver.vm.synced_folder VAGRANT_SYNC_PATH, TOMCAT_INSTALL_PATH
webserver.vm.synced_folder WEBSERVER_PATH, "/srv/salt/"
webserver.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
webserver.vm.provision "shell", inline: <<-SHELL
sudo hostname web1.domain.com
SHELL
webserver.vm.provision "salt" do |salt|
salt.masterless = true
salt.minion_config = WEBSERVER_MINION_PATH
###salt.minion_config = "/srv/salt/minion"
salt.run_highstate = true
salt.colorize = true
#salt.verbose = true
end
end
config.vm.define :redis do |redis|
redis.vm.box = BASE_IMAGE_NAME
redis.vm.box_url = BASE_IMAGE_ARTIFACTORY_REF
redis.vm.network "private_network", ip: "10.2.0.20"
redis.vm.network "forwarded_port", guest: 6379, host: 6379
redis.vm.synced_folder VAGRANT_SYNC_PATH, TOMCAT_INSTALL_PATH
redis.vm.synced_folder REDIS_PATH, "/srv/salt/"
redis.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
redis.vm.provision "shell", inline: <<-SHELL
sudo hostname redis1.domain.com
SHELL
redis.vm.provision "salt" do |salt|
salt.masterless = true
salt.minion_config = REDIS_MINION_PATH
#salt.minion_config = "/srv/salt/minion"
salt.run_highstate = true
salt.colorize = true
#salt.verbose = true
end
end
end
here is the output with salt commented out:
C:\vagrantfiles\MOBILEWEB\WINDOWS\TOMCAT-REDIS>vagrant up
Bringing machine 'webserver' up with 'virtualbox' provider...
==> webserver: Importing base box 'vagrant-centos7-base'...
==> webserver: Matching MAC address for NAT networking...
==> webserver: Setting the name of the VM: TOMCAT-REDIS_webserver_1468231810504_5980 ==> webserver: Clearing any previously set network interfaces...
==> webserver: Preparing network interfaces based on configuration...
webserver: Adapter 1: nat
webserver: Adapter 2: hostonly
==> webserver: Forwarding ports...
webserver: 80 (guest) => 8880 (host) (adapter 1)
webserver: 443 (guest) => 4443 (host) (adapter 1)
webserver: 8080 (guest) => 8888 (host) (adapter 1)
webserver: 22 (guest) => 2222 (host) (adapter 1)
==> webserver: Running 'pre-boot' VM customizations...
==> webserver: Booting VM...
==> webserver: Waiting for machine to boot. This may take a few minutes...
webserver: SSH address: 127.0.0.1:2222
webserver: SSH username: vagrant
webserver: SSH auth method: private key
webserver: Warning: Remote connection disconnect. Retrying...
webserver: Warning: Remote connection disconnect. Retrying...
webserver: Warning: Remote connection disconnect. Retrying...
webserver:
webserver: Vagrant insecure key detected. Vagrant will automatically replace
webserver: this with a newly generated keypair for better security.
webserver:
webserver: Inserting generated public key within guest...
webserver: Removing insecure key from the guest if it's present...
webserver: Key inserted! Disconnecting and reconnecting using new SSH key...
==> webserver: Machine booted and ready!
==> webserver: Checking for guest additions in VM...
==> webserver: Configuring and enabling network interfaces...
==> webserver: Mounting shared folders...
webserver: /vagrant => C:/vagrantfiles/MOBILEWEB/WINDOWS/TOMCAT-REDIS
webserver: /srv/salt => C:/vagrantfiles/vgsalt/webserver
webserver: /opt/apache-tomcat-8.0.33/webapps => C:/vagrantsync
==> webserver: Running provisioner: shell...
webserver: Running: inline script
C:\vagrantfiles\MOBILEWEB\WINDOWS\TOMCAT-REDIS>
I want to sync my OSX dev folder which contains my applications to my VM. My VagrantFile (based off Phansible):
Vagrant.require_version ">= 1.5"
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |v|
v.name = "default"
v.customize [
"modifyvm", :id,
"--name", "default",
"--memory", 512,
"--natdnshostresolver1", "on",
"--cpus", 1,
]
end
config.vm.box = "ubuntu/trusty64"
config.vm.network :private_network, ip: "192.168.33.99"
config.ssh.forward_agent = true
if which('ansible-playbook')
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/playbook.yml"
ansible.inventory_path = "ansible/inventories/dev"
ansible.limit = 'all'
ansible.extra_vars = {
private_interface: "192.168.33.99",
hostname: "default"
}
end
else
config.vm.provision :shell, path: "ansible/windows.sh", args: ["default"]
end
config.vm.synced_folder "/Users/xylar/Code", "/vagrant", type: "nfs"
end
When I vagrant up:
==> default: Exporting NFS shared folders...
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
==> default: Running provisioner: ansible...
There are no error messages and when I vagrant ssh and view contents of the vagrant folder I only see some dot files (ansible, bash etc). Is there something I have missed?
I was being foolish. Once I had ssh'd into the box I thought I was in the synced folder (as it was called vagrant) however I was in /home/vagrant and the synced location was in /vagrant.
You need to specify the mount options:
config.vm.synced_folder "/Users/xylar/Code", "/vagrant", "nfs" => { :mount_options => ['dmode=777', 'fmode=777'] }
I am pretty new using Vagrant and Chef. I am trying to change the Hostname of my Vagrant image using Chef. For some reason, I do not see a changed Hostname when I do vagrant ssh
What am I missing?
Here is my Cheffile
site "http://community.opscode.com/api/v1"
cookbook 'apt'
cookbook 'build-essential'
cookbook 'hostname'
Here is my Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
config.vm.box = "ubuntu/trusty64"
# Configurate the virtual machine to use 2GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Forward the Rails server default port to the host
# config.vm.network :forwarded_port, guest: 3000, host: 3000
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "hostname"
# Install Ruby 2.1.2 and Bundler
# Set an empty root password for MySQL to make things simple
chef.json = {
hostname: {
set_fqdn: 'Olympus'
}
}
end
end
As defined in the documentation you should set the attribute at the node level, not in node['hostname'].
In your case it will be
chef.json = {
set_fqdn: 'Olympus'
}
You can find more information in The hostname documentation
Vagrant version: 1.4.0
vagrant-windows version: 1.5.1
Vagrant file:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "win7.x86.v.004"
config.vm.box_url = "URL"
config.vm.boot_timeout = 300
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
config.windows.halt_timeout = 15
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.guest = :windows
config.vm.network :forwarded_port, guest: 5985, host: 5685, id: "winrm", :auto => true
config.vm.network :forwarded_port, guest: 5986, host: 5686
config.vm.network :forwarded_port, guest: 8080, host: 5687
config.vm.network :forwarded_port, guest: 1521, host: 5688
config.winrm.host = "192.168.33.33"
config.winrm.port = 5985
config.windows.set_work_network = true
config.vm.network :private_network, ip: "192.168.33.33"
config.vm.provision :shell, :path => "provision.bat"
end
I am using selfcreated Win7 enterprise SP1 box
vagrant up hangs on configuring network adapter, debug logs here:
DEBUG configure_networks: vm_interface_map: {1=>{:net_connection_id=>"Local Area
Connection", :mac_address=>"08002753776B", :interface_index=>"11", :index=>"7"}
, 2=>{:net_connection_id=>"Local Area Connection 2", :mac_address=>"080027F5E843
", :interface_index=>"14", :index=>"12"}}
INFO winrmshell: Configuring NIC Local Area Connection 2 using static ip 192.16
8.33.33
DEBUG winrmshell: powershell executing:
netsh interface ip set address "Local Area Connection 2" static 192.168.33.33 25
5.255.255.0
After "netsh" command execution hangs.
Any workaround of how I can resolve this?
found solution, in my VagrantFile there wrong
config.winrm.host = "192.168.33.33"
this shoult be host IP address, but i used guest IP, thats why while executing netsh command "vagrant up" silently hungs.
Reason is that netsh command resets network interface and vagrant can not get result of netsh comand.
mainly, this parametr should not be set or set to 127.0.0.1