排查在 Azure 中新建 Linux 虚拟机时遇到的 Resource Manager 部署问题Troubleshoot Resource Manager deployment issues with creating a new Linux virtual machine in Azure

尝试创建新的 Azure 虚拟机 (VM) 时,遇到的常见错误是预配失败或分配失败。When you try to create a new Azure Virtual Machine (VM), the common errors you encounter are provisioning failures or allocation failures.

  • 当由于准备步骤不当,或者在从门户捕获映像期间选择了错误的设置而导致 OS 映像无法加载时,将发生预配失败。A provisioning failure happens when the OS image fails to load either due to incorrect preparatory steps or because of selecting the wrong settings during the image capture from the portal.
  • 当群集或区域没有可用的资源或无法支持所请求的 VM 大小时,将发生分配失败。An allocation failure results when the cluster or region either does not have resources available or cannot support the requested VM size.

如果本文未解决你的 Azure 问题,请访问 MSDN 和 CSDN 上的 Azure 论坛。If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and CSDN. 可以在这些论坛上发布问题。You can post your issue in these forums. 还可提交 Azure 支持请求。You also can submit an Azure support request. 若要提交支持请求,请在 Azure 支持页上提交。To submit a support request, on the Azure support page.

常见问题Top issues

以下常见问题可能对解决你的问题有帮助。The following top issues may help resolve your issue. 若要开始故障排除,请查看以下步骤:To start troubleshooting, review these steps:

若有其他 VM 部署问题和疑问,请参阅排查 Azure 中的 Linux 虚拟机部署问题For other VM deployment issues and questions, see Troubleshoot deploying Linux virtual machine issues in Azure.

收集活动日志Collect activity logs

若要开始故障排除,请收集活动日志,以识别与问题相关的错误。To start troubleshooting, collect the activity logs to identify the error associated with the issue. 以下链接包含有关要遵循的过程的详细信息。The following links contain detailed information on the process to follow.

查看部署操作View deployment operations

通过查看活动日志管理 Azure 资源View activity logs to manage Azure resources

问题:自定义映像;预配错误Issue: Custom image; provisioning errors

上传或捕获用作专用 VM 映像的通用化 VM 映像时,将发生预配错误,反之亦然。Provisioning errors arise if you upload or capture a generalized VM image as a specialized VM image or vice versa. 前者会导致预配超时错误,后者会导致预配失败。The former will cause a provisioning timeout error and the latter will cause a provisioning failure. 若要部署自定义映像且不出错,必须确保在捕获过程中映像类型不会更改。To deploy your custom image without errors, you must ensure that the type of the image does not change during the capture process.

下表列出了通用和专用映像的可能组合、将遇到的错误类型和修复错误需要执行的操作。The following table lists the possible combinations of generalized and specialized images, the error type you will encounter and what you need to do to fix the errors.

下表列出了可能的 Linux 通用和专用 OS 映像的上传与捕获组合。The following table lists the possible upload and capture combinations of Linux generalized and specialized OS images. 使用 Y 表示处理不会有任何错误的组合,使用 N 表示会出现错误的组合。下表提供了有关各种错误的原因和解决方法。The combinations that will process without any errors are indicated by a Y, and those that will throw errors are indicated by an N. The causes and resolutions for the different errors you will run into are given below the table.

OSOS 上传专用 OS 映像Upload spec. 上传通用 OS 映像Upload gen. 捕获专用 OS 映像Capture spec. 捕获通用 OS 映像Capture gen.
Linux 通用Linux gen. N1N1 YY N3N3 YY
Linux 专用Linux spec. YY N2N2 YY N4N4

Y: 如果 OS 是通用的 Linux,并且是使用通用设置上传和/或捕获的,则不会有任何错误。Y: If the OS is Linux generalized, and it is uploaded and/or captured with the generalized setting, then there won't be any errors. 同理,如果 OS 是专用的 Linux,并且是使用专用设置上传和/或捕获的,也不会有任何错误。Similarly, if the OS is Linux specialized, and it is uploaded and/or captured with the specialized setting, then there won't be any errors.

上载错误:Upload Errors:

N1 如果 OS 是通用的 Linux,但是以专用设置上载的,则会发生预配超时错误,并且 VM 会卡在预配阶段。N1: If the OS is Linux generalized, and it is uploaded as specialized, you will get a provisioning timeout error because the VM is stuck at the provisioning stage.

N2 如果 OS 是专用的 Linux,但是以专用设置上载的,则会发生预配失败错误,因为新 VM 是以原始计算机名称、用户名和密码运行的。N2: If the OS is Linux specialized, and it is uploaded as generalized, you will get a provisioning failure error because the new VM is running with the original computer name, username and password.

解决方法:Resolution:

若要解决这两个错误,请上传原始 VHD、可用的本地设置、以及与该 OS(通用/专用)相同的设置。To resolve both these errors, upload the original VHD, available on premises, with the same setting as that for the OS (generalized/specialized). 若要以通用设置上传,请记得先运行 -deprovision。To upload as generalized, remember to run -deprovision first.

捕获错误:Capture Errors:

N3 如果 OS 是通用的 Linux,但是以专用设置捕获的,则会发生预配超时错误,因为标记为通用的原始 VM 不可用。N3: If the OS is Linux generalized, and it is captured as specialized, you will get a provisioning timeout error because the original VM is not usable as it is marked as generalized.

N4 如果 OS 是专用的 Linux,但是以专用设置捕获的,则会发生预配失败错误,因为新 VM 是以原始计算机名称、用户名和密码运行的。N4: If the OS is Linux specialized, and it is captured as generalized, you will get a provisioning failure error because the new VM is running with the original computer name, username and password. 此外,标记为专用的原始 VM 不可用。Also, the original VM is not usable because it is marked as specialized.

解决方法:Resolution:

若要解决这两个错误,请从门户中删除当前映像,并从当前 VHD 重新捕获映像,该映像具有与该 OS(通用/专用)相同的设置。To resolve both these errors, delete the current image from the portal, and recapture it from the current VHDs with the same setting as that for the OS (generalized/specialized).

当新的 VM 请求被固定到不支持所请求的 VM 大小、或没有可用空间可处理请求的群集时,便会发生此错误。This error arises in situations when the new VM request is pinned to a cluster that either cannot support the VM size being requested, or does not have available free space to accommodate the request.

原因 1: 群集不支持请求的 VM 大小。Cause 1: The cluster cannot support the requested VM size.

解决方法 1:Resolution 1:

  • 以更小的 VM 大小重试请求。Retry the request using a smaller VM size.
  • 如果无法更改请求的 VM 大小:If the size of the requested VM cannot be changed:
    • 停止可用性集中的所有 VM。Stop all the VMs in the availability set. 单击“资源组” > 资源组 > “资源” > 可用性集 > “虚拟机” > 虚拟机 > “停止”。Click Resource groups > your resource group > Resources > your availability set > Virtual Machines > your virtual machine > Stop.
    • 所有 VM 都停止后,创建所需大小的新 VM。After all the VMs stop, create the new VM in the desired size.
    • 先启动新 VM,选择每个已停止的 VM,并单击“启动”。 Start the new VM first, and then select each of the stopped VMs and click Start.

原因 2: 群集没有可用的资源。Cause 2: The cluster does not have free resources.

解决方法 2:Resolution 2:

  • 稍后重试请求。Retry the request at a later time.
  • 如果新 VM 属于不同的可用性集If the new VM can be part of a different availability set
    • 在不同的可用性集(位于同一区域)中创建新 VM。Create a new VM in a different availability set (in the same region).
    • 将新 VM 添加到同一虚拟网络。Add the new VM to the same virtual network.

后续步骤Next steps

如果在 Azure 中启动已停止的 Linux VM 或调整现有 Linux VM 的大小时遇到问题,请参阅排查在 Azure 中重新启动现有 Linux 虚拟机或调整其大小时遇到的 Resource Manager 部署问题If you encounter issues when you start a stopped Linux VM or resize an existing Linux VM in Azure, see Troubleshoot Resource Manager deployment issues with restarting or resizing an existing Linux Virtual Machine in Azure.