当我使用打包程序构建 win7 盒子时,它会挂起,等待 SSH 可用:
==> virtualbox-iso: Downloading or copying Guest additions
virtualbox-iso: Downloading or copying: file:///vb/VBoxGuestAdditions.iso
==> virtualbox-iso: Downloading or copying ISO
virtualbox-iso: Downloading or copying: file:///home/foo/win7_prof.iso
==> virtualbox-iso: Creating floppy disk...
virtualbox-iso: Copying: ./answer_files/7/Autounattend.xml
virtualbox-iso: Copying: ./scripts/dis-updates.ps1
virtualbox-iso: Copying: ./scripts/microsoft-updates.bat
virtualbox-iso: Copying: ./scripts/win-updates.ps1
virtualbox-iso: Copying: ./scripts/openssh.ps1
virtualbox-iso: Copying: ./scripts/oracle-cert.cer
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Attaching floppy disk...
==> virtualbox-iso: Creating forwarded port mapping for SSH (host port 3143)
==> virtualbox-iso: Executing custom VBoxManage commands...
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1420575242 --memory 2048
virtualbox-iso: Executing: modifyvm packer-virtualbox-iso-1420575242 --cpus 2
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 2m0s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Waiting for SSH to become available...
有解决这个问题的经验吗?
答案1
Packer 当前要求在客户操作系统(虚拟机)中安装并运行 SSH 服务器。
编辑 Autounattend.xml 并添加安装 OpenSSH 的命令。确保它是最后一个命令,并且顺序正确。
参考: https://github.com/joefitzgerald/packer-windows/issues/141#issuecomment-82056372
有关安装 OpenSSH 的示例命令和脚本,请参阅https://github.com/joefitzgerald/packer-windows/blob/master/answer_files/7/Autounattend.xml和https://github.com/joefitzgerald/packer-windows/blob/develop/scripts/openssh.ps1