Reputation: 15929
being new to packer i am trying to build my first virtual box image with a packer file. But somehow it hangs on the inline shell provisioning. I cannot figure out what the issue is. Tried to debug and it hangs on.
virtualbox-iso: Provisioning with shell script: /var/folders/27/p5wvd4l164z3c56378y7pp940000gn/T/packer-shell450560231
My packer script is as follows:
{
"provisioners": [{
"type": "shell",
"inline": [
"sleep 30",
"sudo apt-get update"
]
}],
"builders": [
{
"type": "virtualbox-iso",
"boot_command": [
"<esc><wait>",
"<esc><wait>",
"<enter><wait>",
"/install/vmlinuz<wait>",
" auto<wait>",
" console-setup/ask_detect=false<wait>",
" console-setup/layoutcode=us<wait>",
" console-setup/modelcode=pc105<wait>",
" debian-installer=en_US<wait>",
" fb=false<wait>",
" initrd=/install/initrd.gz<wait>",
" kbd-chooser/method=us<wait>",
" keyboard-configuration/layout=USA<wait>",
" keyboard-configuration/variant=USA<wait>",
" locale=en_US<wait>",
" netcfg/get_hostname=ubuntu-1404<wait>",
" netcfg/get_domain=acme.com<wait>",
" noapic<wait>",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
" -- <wait>",
"<enter><wait>"
],
"boot_wait": "10s",
"disk_size": 40960,
"guest_os_type": "Ubuntu_64",
"http_directory": "http",
"iso_checksum": "9e5fecc94b3925bededed0fdca1bd417",
"iso_checksum_type": "md5",
"iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso",
"ssh_username": "packer",
"ssh_password": "packer",
"ssh_port": 22,
"ssh_pty" : "true",
"headless": "false",
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo packer | sudo -S shutdown -P now",
"output_directory": "/Users/marco/Desktop/generated_images/ubuntu",
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--memory", "512" ],
[ "modifyvm", "{{.Name}}", "--cpus", "1" ]
]
}
]
}
Upvotes: 0
Views: 2553
Reputation: 456
You can get verbose output from Packer with PACKER_LOG=1
before the build command. That might help diagnose what's happening on particular scripts. Also packer has a --debug flag that will stop the build at breakpoints and enable you to login to the image.
Upvotes: 1