我从图像创建 VM 失败。我收到这个错误

I failed making a VM from image. I got this error

我制作了一个 VM,用于在 Azure 中制作图像。 在我制作 linux vm(Redhat) 之后,我停止了 vm 并制作了图像。 但是我从图像制作虚拟机失败了。

两种情况都有相同的问题 -1st case:I 没有安装任何东西。 -2nd case:I 安装一些东西并制作 ssh key(rsa)

如果我执行这个命令'sudo waagent -deprovision+user',没有错误。 但是我的 ssh 密钥消失了,所以我的映像中的虚拟机无法相互连接,这意味着我无法使用 Ambari 生成集群。

有什么办法可以解决这个问题吗?

这是我从映像创建 VM 失败时遇到的错误。

--------error---- Provisioning failed. OS Provisioning for VM 'master0' did not finish in the allotted time. However, the VM guest agent was detected running. This suggests the guest OS has not been properly prepared to be used as a VM image (with CreateOption=FromImage). To resolve this issue, either use the VHD as is with CreateOption=Attach or prepare it properly for use as an image: * Instructions for Windows: https://azure.microsoft.com/documentation/articles/virtual-machines-windows-upload-image/ * Instructions for Linux: https://azure.microsoft.com/documentation/articles/virtual-machines-linux-capture-image/. OSProvisioningTimedOut

在创建图像之前,您应该执行sudo waagent -deprovision+user。如果你不这样做,你会得到这个错误。

根据您的情况,您可以配置 Provisioning.RegenerateSshHostKeyPair=n (/etc/waagent.conf)。根据这个official document

deprovision: Attempt to clean the system and make it suitable for re-provisioning. This operation deleted the following:

All SSH host keys (if Provisioning.RegenerateSshHostKeyPair is 'y' in the configuration file)

如果它不适合您,我建议您可以使用 Azure 门户将 publickey 添加到您的 VM。