Originally reported on https://github.com/marcindulak/vagrant-mariadb-galera-tutorial-centos7/pull/1 for
OS X 10.11.6
Vagrant 1.9.0
VirtualBox 5.1.10 r112026 (Qt5.6.2)
$ vagrant -v
Vagrant 1.9.0 # the problem present also for Vagrant 1.9.1
$ vagrant plugin list
vagrant-share (1.1.6, system)
$ vboxmanage -v
5.1.10r112026
$ vboxmanage list extpacks
Extension Packs: 1
Pack no. 0: Oracle VM VirtualBox Extension Pack
Version: 5.1.10
Revision: 112026
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
$ uname -a
Linux ubuntu 3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
https://atlas.hashicorp.com/centos/boxes/7/versions/1610.01
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX = ENV.fetch('BOX', 'centos/7')
VERSION = ENV.fetch('VERSION', '1610.01')
CONTROLLER = ENV.fetch('CONTROLLER', 'IDE Controller')
Vagrant.configure(2) do |config|
config.vm.define "ideControllerProblem" do |machine|
machine.vm.box = BOX
machine.vm.box_url = machine.vm.box
machine.vm.box_version = VERSION
machine.vm.provider "virtualbox" do |v|
v.memory = 256
v.cpus = 1
disk = 'sdb.vdi'
if !File.exist?(disk)
v.customize ['createhd', '--filename', disk, '--size', 64, '--variant', 'Fixed']
v.customize ['modifyhd', disk, '--type', 'writethrough']
end
v.customize ['storageattach', :id, '--storagectl', CONTROLLER, '--port', 0, '--device', 1, '--type', 'hdd', '--medium', disk]
end
end
config.vm.define "ideControllerProblem" do |machine|
machine.vm.provision :shell, :inline => "hostname ideControllerProblem", run: "always"
end
end
Vagrantfile available also at https://gist.githubusercontent.com/marcindulak/1b0ee3eda0bc94617023e85a62e1cac6/raw/ec8706ad136ddac8dc86adb90c30c0e76752a414/Vagrantfile
https://gist.github.com/marcindulak/f60dea9036b077e83c20727e8a72d210
'IDE Controller' is present.
'IDE Controller' defined in ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1610.01/virtualbox/box.ovf is not found.
A. verify that centos box https://atlas.hashicorp.com/centos/boxes/7/versions/1610.01 has the problem
rm -rf /tmp/t01
mkdir /tmp/t01
cd /tmp/t01
wget https://gist.githubusercontent.com/marcindulak/1b0ee3eda0bc94617023e85a62e1cac6/raw/ec8706ad136ddac8dc86adb90c30c0e76752a414/Vagrantfile
unset VAGRANT_LOG
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t01_ideControllerProblem*
VAGRANT_LOG=$VAGRANT_LOG BOX='centos/7' VERSION='1610.01' vagrant up 2>&1 | tee t01.centos.log${VAGRANT_LOG}
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t01_ideControllerProblem*
Result
A customization command failed:
["storageattach", :id, "--storagectl", "IDE Controller", "--port", 0, "--device", 1, "--type", "hdd", "--medium", "sdb.vdi"]
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: ["storageattach", "4d543d7e-1183-4123-9b6b-c8751901adb2", "--storagectl", "IDE Controller", "--port", "0", "--device", "1", "--type", "hdd", "--medium", "sdb.vdi"]
Stderr: VBoxManage: error: Could not find a controller named 'IDE Controller'
>
Please fix this customization and try again.
B. verify that puppetlabs box https://atlas.hashicorp.com/puppetlabs/boxes/centos-7.2-64-puppet/versions/1.0.1 does not have this problem
rm -rf /tmp/t00
mkdir /tmp/t00
cd /tmp/t00
wget https://gist.githubusercontent.com/marcindulak/1b0ee3eda0bc94617023e85a62e1cac6/raw/ec8706ad136ddac8dc86adb90c30c0e76752a414/Vagrantfile
unset VAGRANT_LOG
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t00_ideControllerProblem*
VAGRANT_LOG=$VAGRANT_LOG BOX='puppetlabs/centos-7.2-64-puppet' VERSION='1.0.1' vagrant up 2>&1 | tee t00.puppetlabs.log${VAGRANT_LOG}
VAGRANT_LOG=debug
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t00_ideControllerProblem*
VAGRANT_LOG=$VAGRANT_LOG BOX='puppetlabs/centos-7.2-64-puppet' VERSION='1.0.1' vagrant up 2>&1 | tee t00.puppetlabs.log${VAGRANT_LOG}
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t00_ideControllerProblem*
C. with controller 'IDE' the centos box starts, but does not include all settings from box.ovf, e.g boot order is incorrect
rm -rf /tmp/t03
mkdir /tmp/t03
cd /tmp/t03
wget https://gist.githubusercontent.com/marcindulak/1b0ee3eda0bc94617023e85a62e1cac6/raw/ec8706ad136ddac8dc86adb90c30c0e76752a414/Vagrantfile
unset VAGRANT_LOG
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t03_ideControllerProblem*
VAGRANT_LOG=$VAGRANT_LOG BOX='centos/7' VERSION='1610.01' CONTROLLER='IDE' vagrant up 2>&1 | tee t03.centos.log${VAGRANT_LOG}
xmllint --format ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1610.01/virtualbox/box.ovf | grep 'Order'
vboxmanage showvminfo --machinereadable `vboxmanage list runningvms | grep t03_ideControllerProblem | cut -d' ' -f2` | grep 'boot.='
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t03_ideControllerProblem*
Result:
<ns0:Order device="HardDisk" position="1"/>
<ns0:Order device="DVD" position="2"/>
<ns0:Order device="None" position="3"/>
<ns0:Order device="None" position="4"/>
boot1="floppy"
boot2="dvd"
boot3="disk"
boot4="none"
D. taking the working https://atlas.hashicorp.com/puppetlabs/boxes/centos-7.2-64-puppet/versions/1.0.1 box and using it as a template for centos/7 box brings the 'IDE Controller' and the correct boot order back
rm -rf /tmp/t04
mkdir /tmp/t04
cd /tmp/t04
cp -p ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1610.01/virtualbox/box.ovf centos.ovf
cp -p ~/.vagrant.d/boxes/puppetlabs-VAGRANTSLASH-centos-7.2-64-puppet/1.0.1/virtualbox/box.ovf box.ovf
wget https://gist.githubusercontent.com/marcindulak/4d0a8d48dd7b5ef9fc52629f12ed59b2/raw/a30860c15120f4ec206731d132f05aa6dcecc88e/box.ovf.puppetlabs-centos-7.2-64-puppet_1.0.1TOcentos-7_1610.01.patch
patch box.ovf box.ovf.puppetlabs-centos-7.2-64-puppet_1.0.1TOcentos-7_1610.01.patch
cp -pf box.ovf ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1610.01/virtualbox/
wget https://gist.githubusercontent.com/marcindulak/1b0ee3eda0bc94617023e85a62e1cac6/raw/ec8706ad136ddac8dc86adb90c30c0e76752a414/Vagrantfile
unset VAGRANT_LOG
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t04_ideControllerProblem*
VAGRANT_LOG=$VAGRANT_LOG BOX='centos/7' VERSION='1610.01' CONTROLLER='IDE Controller' vagrant up 2>&1 | tee t04.centos.log${VAGRANT_LOG}
xmllint --format ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1610.01/virtualbox/box.ovf | grep 'Order'
vboxmanage showvminfo --machinereadable `vboxmanage list runningvms | grep t04_ideControllerProblem | cut -d' ' -f2` | grep 'boot.='
vagrant destroy -f; rm -f sdb.vdi; killall VBoxHeadless 2> /dev/null; rm -rf ~/VirtualBox\ VMs/t04_ideControllerProblem*
cp -pf centos.ovf ~/.vagrant.d/boxes/centos-VAGRANTSLASH-7/1610.01/virtualbox/box.ovf
Result
<Order position="1" device="HardDisk"/>
<Order position="2" device="DVD"/>
<Order position="3" device="None"/>
<Order position="4" device="None"/>
boot1="disk"
boot2="dvd"
boot3="none"
boot4="none"
Note that the box.ovf from https://atlas.hashicorp.com/centos/boxes/7/versions/1610.01 uses a different way of handling xml namespaces that most other box.ovf files.
This is a recurring problem reported over several years, normally resolved by renaming the controller in Vagrantfile, switching to another box, or changing virtualbox and/or vagrant version.
https://github.com/mitchellh/vagrant/issues/6686
https://github.com/xdissent/ievms/issues/204
https://github.com/marcindulak/vagrant-mariadb-galera-tutorial-centos7/pull/1
https://lists.centos.org/pipermail/centos-devel/2016-December/015433.html
The issue is also related to the lack of consensus about which controllers should be present and how to handle missing controllers from Vagrantfile
https://github.com/mitchellh/vagrant/issues/6682
https://gist.github.com/leifg/4713995
https://github.com/phusion/open-vagrant-boxes/issues/1
Hello.
This is not a Vagrant isue.
The issue relies on Virtualbox use different Controller names between os.
In some OS can be IDE Controller but in other is just IDE
0 $ VBoxManage list vms
"c7_host01_1481400784099_26895" {97bec202-de3a-4b06-b790-4aa742671dd0}
0 $ VBoxManage showvminfo 97bec202-de3a-4b06-b790-4aa742671dd0 | grep 'Storage Controller Name'
Storage Controller Name (0): IDE
0 $
So, your script should check OS, etc.
Easier will be build your own VM that include the disk.
Please check for http://packer.io
If by OS you mean the guest OS, then the controller seems to be defined in box.ovf.
My test D. (I don't know if it makes sense, someone knowledgeable should review it) shows that taking the puppetlabs box.ovf https://atlas.hashicorp.com/puppetlabs/boxes/centos-7.2-64-puppet/versions/1.0.1 and replacing the uuid and vmdk to match the values for https://atlas.hashicorp.com/centos/boxes/7/versions/1610.01 results in 'IDE Controller' being present.
If this is the case then the question is why the box.ovf provided by https://atlas.hashicorp.com/centos/boxes/7/versions/1610.01 does not result in 'IDE Controller' being defined.
Or you mean that the settings in box.ovf have nothing to do with the controller used by virtualbox when the given VM is started by Vagrant?
Please be more precise what you mean by "your script should check OS, etc.".
I provided the link https://gist.github.com/leifg/4713995 which shows that checking for the presence of a controller is not an elegant solution as it involves overriding the VagrantPlugins::ProviderVirtualBox::Action::SetName call method. I guess if this is the recommended solution then Vagrant should provide this functionality out-of-the-box.
@marcindulak hi!
We only provide the boxes under hashicorp organization in atlas.
Vagrant provide the capability to run VBoxManage commands, however Virtualbox doesn't have a consistent naming between host os / versions.
In some cases the controller includes the name Controller, but not always.
Vagrant is executing raw commands to VBoxManage on your behalf, but if the the box doesn't have the controller you are referring, its Virtualbox whos crashing, and vagrant halts due this.
If you use only one box, I assume you can rely on the controller should be the same, but this is a moving part.
Not sure why you think this is a vagrant bug, or vagrant should do better.
VBoxManage is an advanced way to do VM settings, however are just raw commands that vagrant run.
Hi,
I don't think it's a vagrant bug anymore. Actually I submitted the case at https://github.com/redhat-imaging/imagefactory/issues/393 - the problem seems to be not in differences between OS but in the inability of Virtualbox to read different variations of box.ovf - this is where the Controller is defined.
It could well be I need to open a case at Virtualbox too.
Most helpful comment
Hello.
This is not a Vagrant isue.
The issue relies on Virtualbox use different Controller names between os.
In some OS can be
IDE Controllerbut in other is justIDESo, your script should check OS, etc.
Easier will be build your own VM that include the disk.
Please check for http://packer.io