成为打包者的新手我正在尝试用打包器文件构建我的第一个虚拟盒子图像。但不知何故,它挂在内联shell配置上。我无法弄清楚问题是什么。试图调试,它挂起。
virtualbox-iso:使用shell脚本进行配置:/ var / folders / 27 / p5wvd4l164z3c56378y7pp940000gn / T / packer-shell450560231
我的打包程序脚本如下:
{
"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" ]
]
}
]
}
答案 0 :(得分:1)
您可以在构建命令之前使用PACKER_LOG=1
从Packer获取详细输出。这可能有助于诊断特定脚本上发生的事情。 Packer还有一个--debug标志,它将在断点处停止构建并使您能够登录到图像。