允许 OS 关机超时而不会使 Packer 构建失败

allow OS shutdown to timeout without failing Packer build

我有一个 OS 当我 运行 它在一个特定的虚拟机管理程序 (KVM) 中时无法正常关闭,即使它适用于所有其他虚拟机管理程序。相反,它所做的是将所有数据同步到磁盘,然后无限期挂起消息 "Hit any button to reboot",直到您从管理程序发出硬关闭。

我正在尝试使用 Packer 将此 OS 从 .iso 文件自动安装到 .box 文件中。但是,Packer 运行 每次都会失败,因为它在 OS 挂起等待输入时命中 shutdown_timeout(来自 QEMU 构建器)。我正在寻找一种解决方法——似乎以下任何一种方法都可行(也许还有其他方法),但我想不出任何方法来实现它们!我搜索过的一些想法是:

重新阅读文档后,我找到了答案:

shutdown_command (string) - The command to use to gracefully shut down the machine once all the provisioning is done. By default this is an empty string, which tells Packer to just forcefully shut down the machine.

哦!