Hello,
I’m using packer version 1.3.4 but I have tested this on version 1.5.6 and the problem persists.
I’m trying to build a virtualbox ova from a centos iso. When I build the vm I have two .vdi’s one called vm-name which is attached to the IDE controller and one which will be used for mongodb called vm-name-mongo which is attached to a sata controller.
I want to install the OS on vm-name.vdi.
Most of the time things work as expected but in approximately 1/11 builds the OS is installed on the vm-name-mongo.vdi which means the vm fails to reboot before the provisioners and packer is left waiting for an ssh connection. The os seems to be installed properly its just on the wrong vdi.
I’ve removed the provisions from the template because we don’t get to that stage.
{
"variables": {
"ssh_username": "root",
"ssh_password": "password"
},
"builders": [
{
"type": "virtualbox-iso",
"iso_urls": [
"CentOS-7-x86_64-Minimal-1908.iso",
"http://mirror.ox.ac.uk/sites/mirror.centos.org/7.7.1908/isos/x86_64/CentOS-7-x86_64-Minimal-1908.iso"
],
"iso_checksum": "9a2c47d97b9975452f7d582264e9fc16d108ed8252ac6816239a3b58cef5c53d",
"iso_checksum_type": "sha256",
"vm_name": "vm-name",
"guest_os_type": "RedHat_64",
"output_directory": "vbox_builds",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_port": 22,
"ssh_wait_timeout": "5400s",
"headless":"TRUE",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "6144"],
["modifyvm", "{{.Name}}", "--cpus", "2"],
["modifyvm", "{{.Name}}", "--audio", "none"],
["modifyvm", "{{.Name}}", "--nic1", "nat"],
["modifyvm", "{{.Name}}", "--nic2", "hostonly", "--hostonlyadapter2", "vboxnet0"],
["storagectl", "{{.Name}}", "--name", "IDE Controller","--hostiocache","off"],
["createmedium", "disk", "--filename", "{{.Name}}-mongo.vdi", "--size", "78000"],
["storagectl", "{{.Name}}", "--add", "sata", "--controller", "IntelAHCI", "--name", "SATA Controller","--hostiocache","off"],
["storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "1", "--device", "0", "--type", "hdd", "--medium", "{{.Name}}-mongo.vdi"]
],
"disk_size": "100000",
"http_directory": "http",
"boot_wait": "20s",
"boot_command": [
"<tab><wait> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
],
"format": "ova",
"shutdown_command": "/sbin/halt -p"
}
],
"provisioners": []
}
This is the kickstart file I’m using. I also use this for a vmware build and this issue doesn’t happen there.
install
# installing from CDROM
cdrom
# configuring language and keyboard layout
lang en_US.UTF-8
keyboard us
# setting timezone
timezone --utc Europe/Berlin
# setting dhcp
network --bootproto=dhcp
# setting root password
rootpw --plaintext password
auth --enableshadow --passalgo=sha512 --kickstart
# disabled firewall
firewall --disabled
selinux --disabled
bootloader --location=mbr
# text based installation
text
skipx
zerombr
# creating partitions
clearpart --all --initlabel
part /boot --fstype="xfs" --size=512 --ondisk=sda
part / --fstype="xfs" --size=20000 --ondisk=sda
part /home --fstype="xfs" --size=2048 --ondisk=sda
firstboot --disable
reboot
%packages --instLangs=en_US.utf8 --nobase --ignoremissing --excludedocs
@core
%end
I created an issue HERE