I have VirtualBox 5.2.44 installed on a freebsd 11.3-RELEASE p6 system.
If I run VB and create a new ubuntu 18.04.5 VM from a local iso image,
it starts up fine (although there may be ssh issues).
However, if I run packer to build a system from the same iso image,
the install media boots and goes through the configuration process ok;
after the last question asking if I want to install some popular server environments (no), when I tell it to continue it starts the install process, fetches some updates I think (but doesn’t get too far compared to the successful build) then it reboots and goes through the whole configuration question process again… and again…
The last thing I see before reboot is something about
"Sorry, there was a problem completing the installation…
"Gathering information…
The packer tty session is not helpful, as it shows nothing after the configuration process starts:
$ packer build ubuntu-18-04.json
…
==> virtualbox-iso: Retrieving Guest additions
…
==> virtualbox-iso: Retrieving ISO
==> virtualbox-iso: Trying file:///hd2/Downloads/Ubuntu/ubuntu-18.04.5-live-server-amd64.iso
…
=> /hd2/Downloads/Ubuntu/ubuntu-18.04.5-live-server-amd64.iso
==> virtualbox-iso: Starting HTTP server on port 8102
==> virtualbox-iso: Creating virtual machine…
==> virtualbox-iso: Creating hard drive…
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2322)
==> virtualbox-iso: Executing custom VBoxManage commands…
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1599079865 --memory 1536
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1599079865 --cpus 1
==> virtualbox-iso: Starting the virtual machine…
==> virtualbox-iso: Waiting 10s for boot…
==> virtualbox-iso: Typing the boot command…
==> virtualbox-iso: Using ssh communicator to connect: 127.0.0.1
==> virtualbox-iso: Waiting for SSH to become available…
The above “Waiting for SSH to become available…” is the last thing I see in the packer xterm; it preceeds all install / configuration questions.
My .json file:
(I removed provisioners and post-processors, made no difference)
{
“builders”: [
{
“boot_command”: [
“”,
“”,
“”,
“”,
“/install/vmlinuz”,
" auto",
" console-setup/ask_detect=false",
" console-setup/layoutcode=us",
" console-setup/modelcode=pc105",
" debconf/frontend=noninteractive",
" debian-installer=en_US.UTF-8",
" fb=false",
" initrd=/install/initrd.gz",
" kbd-chooser/method=us",
" keyboard-configuration/layout=USA",
" keyboard-configuration/variant=USA",
" locale=en_US.UTF-8",
" netcfg/get_domain=vm",
" netcfg/get_hostname=vagrant",
" grub-installer/bootdev=/dev/sda",
" noapic",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user preseed_path
}}",
" – ",
“”
],
“boot_wait”: “10s”,
“disk_size”: “{{user disk_size
}}”,
“guest_os_type”: “Ubuntu_64”,
“hard_drive_interface”: “sata”,
“headless”: “{{ user headless
}}”,
“http_directory”: “http”,
“iso_checksum”: “{{user iso_checksum_type
}}:{{user iso_checksum
}}”,
“iso_urls”: [
“file:///hd2/Downloads/Ubuntu/ubuntu-18.04.5-live-server-amd64.iso”,
“{{user mirror
}}/{{user mirror_directory
}}/{{user iso_name
}}”
],
“output_directory”: “…/…/builds/packer-{{user template
}}-virtualbox”,
“shutdown_command”: “echo ‘vagrant’ | sudo -S shutdown -P now”,
“ssh_password”: “vagrant”,
“ssh_port”: 22,
“ssh_timeout”: “10000s”,
“ssh_username”: “vagrant”,
“type”: “virtualbox-iso”,
“vboxmanage”: [
[
“modifyvm”,
“{{.Name}}”,
“–memory”,
“{{ user memory
}}”
],
[
“modifyvm”,
“{{.Name}}”,
“–cpus”,
“{{ user cpus
}}”
]
]
}
],
“variables”: {
“cpus”: “1”,
“disk_size”: “10000”,
“headless”: “”,
“iso_checksum”: “3756b3201007a88da35ee0957fbe6666c495fb3d8ef2e851ed2bd1115dc36446”,
“iso_checksum_type”: “sha256”,
“iso_name”: “ubuntu-18.04.5-live-server-amd64.iso”,
“memory”: “1536”,
“mirror”: “http://releases.ubuntu.com/”,
“mirror_directory”: “18.04.5/”,
“template”: “ubuntu-18.04.05-live-server-amd64.iso”,
“version”: “TIMESTAMP”,
“vm_description”: “packer-ubuntu 18.04.05”,
“vm_version”: “18.04.5”
}
}
The log is no more helpful:
00:00:00.792440 NAT: ICMP/ping not available (could not open ICMP socket, error VERR_ACCESS_DENIED)
00:00:00.799901 NAT: Guest address guess set to 10.0.2.15 by initialization
…
00:00:00.800106 NAT: Set redirect TCP 127.0.0.1:3531 -> 0.0.0.0:22
…
00:00:00.812237 Changing the VM state from ‘CREATING’ to ‘CREATED’
…
00:00:00.815830 Changing the VM state from ‘CREATED’ to ‘POWERING_ON’
…
00:00:00.815937 Changing the VM state from ‘POWERING_ON’ to ‘RUNNING’
…
00:00:03.317539 VMMDev: Guest Log: BIOS: Booting from CD-ROM…
…
00:00:23.342747 NAT: Link up
…
00:00:29.585079 NAT: DHCP offered IP address 10.0.2.15
00:00:29.585278 NAT: DHCP offered IP address 10.0.2.15
00:00:52.506263 NAT: Old socket recv size: 79KB
00:00:52.506286 NAT: Old socket send size: 79KB
but then nothing while the system boots and configures.
Any ideas what I’m doing wrong?
Is there a way to get VB to dump the packer equivalent to create a vm when one uses the vb gui?