使用带有 --noautoconsole 选项的 kickstart 安装时,VM 不会自动重启

VM not restarting automatically when installed with kickstart with --noautoconsole option

我使用以下命令使用 kickstart 创建了一个 Centos 7.3 VM:

virt-install --name=vm1 --disk path=vm1.img,size=20 --vcpus=2 --ram=10240 --os-type=linux --os-variant=rhel7.0 --network bridge=br0 --graphics none --location=http://<IP>/centos7.3 -x "ks=http://<IP>/centos73vm-ks.cfg append ip=<VM IP> netmask=255.255.252.0 gateway=<gw> bootproto=static console=ttyS0"

这很好用。 VM 已创建,自动重新启动并且节点可用。但是,这样做的问题是我无法使用它来实现自动化,因为我没有取回控制权。为此,我在上述命令的末尾添加了 virt-install 命令的 --noautoconsole 选项。

这样做之后,VM 就安装好了,但是重启后它并没有自动启动。它保持 shut off 状态。我需要手动启动它。登录到控制台没有错误。有人可以提供有关如何解决此问题的线索吗?

如有任何帮助,我们将不胜感激。提前致谢。

这听起来确实像 issue that was covered on the RedHat customer portal。我不确定这是否需要付费许可,但您的公司(或您)可能已经拥有一个?

-- 乔纳斯

您需要添加--wait=-1 以便virt-install 等待安装完成后再退出。安装完成后,虚拟机将自动启动。