我试图让打包者创build一个qemu / kvm图像。 我觉得它应该是相当简单的,但我的构build不断在SSH上失败。 这里是相关的文件
template.json:
{ "builders": [ { "type": "qemu", "iso_url": "/home/username/ubuntu-14.04.4-desktop-amd64.iso", "iso_checksum": "807fa1f246b719d28d0b362fd2f31855", "iso_checksum_type": "md5", "shutdown_command": "/sbin/shutdown -hP now", "ssh_username": "ubuntu", "ssh_password": "test", "ssh_port": 22, "ssh_wait_timeout": "5m", "ssh_host_port_min": 2222, "ssh_host_port_max": 2229, "boot_wait": "30s", "disk_size": 20480, "format": "raw", "headless": true, "accelerator": "kvm", "http_directory": "http", "http_port_min": 10082, "http_port_max": 10089, "vm_name": "ubuntu-test", "net_device": "virtio-net", "disk_interface": "virtio", "boot_command": [ "<esc><wait>", "install ", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", "debian-installer=en_US ", "auto ", "locale=en_US ", "kbd-chooser/method=us ", "keyboard-configuration/xkb-keymap=us ", "fb=false ", "debconf/frontend=noninteractive ", "console-setup/ask_detect=false ", "console-keymaps-at/keymap=us ", "<enter><wait>" ] } ] }
preseed.cfg命令:
choose-mirror-bin mirror/http/proxy string di debian-installer/framebuffer boolean false di debconf/frontend select noninteractive di base-installer/kernel/override-image string linux-server di clock-setup/utc boolean true di clock-setup/utc-auto boolean true di finish-install/reboot_in_progress note di grub-installer/only_debian boolean true di grub-installer/with_other_os boolean true di netcfg/get_domain string test-domain di netcfg/get_hostname string test-hostname di partman-auto/method string regular di partman/choose_partition select finish di partman/confirm boolean true di partman/confirm_nooverwrite boolean true di partman/confirm_write_new_label boolean true di pkgsel/include string openssh-server di pkgsel/install-language-support boolean false di pkgsel/update-policy select unattended-upgrades di pkgsel/upgrade select none di time/zone string CET di user-setup/allow-password-weak boolean true di user-setup/encrypt-home boolean false tasksel tasksel/first multiselect none di passwd/user-fullname string default di passwd/username string ubuntu di passwd/user-password password test di passwd/user-password-again password test
这是我在打包机日志中得到的错误:
2016/08/16 11:24:05 packer: 2016/08/16 11:24:05 handshaking with SSH 2016/08/16 11:24:05 packer: 2016/08/16 11:24:05 handshake error: ssh: handshake failed: read tcp 127.0.0.1:40788->127.0.0.1:2227: read: connection reset by peer 2016/08/16 11:24:05 packer: 2016/08/16 11:24:05 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:40788->127.0.0.1:2227: read: connection reset by peer
任何提示或想法将受到欢迎,谢谢