2015-11-25 13 views
0

對於打包器來說是新的,我正嘗試用打包器文件構建我的第一個虛擬盒子圖像。但不知何故,它掛在內聯shell配置上。我無法弄清楚問題是什麼。試圖調試,它掛起。打包器掛起等待(內聯)要執行的外殼腳本

VirtualBox的異:用shell腳本配置:在/ var /文件夾/ 27/p5wvd4l164z3c56378y7pp940000gn/T /封隔器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

你可以在構建命令之前使用PACKER_LOG=1從Packer獲得詳細輸出。這可能有助於診斷特定腳本發生了什麼。此外,打包程序還有一個--debug標誌,它將停止構建斷點並使您能夠登錄到映像。