简体   繁体   English

Azure cloud-init:挂在模块最后阶段

[英]Azure cloud-init: hanging at modules-final stage

I'm experiencing some issues with Azure cloud-init on Ubuntu 20.04 and am looking for some guidance on the next steps for troubleshooting.我在 Ubuntu 20.04 上遇到 Azure cloud-init 的一些问题,我正在寻找有关后续故障排除步骤的一些指导。

At the moment, I'm just using a test cloud-init file, testing installing my required packages.目前,我只是使用一个测试 cloud-init 文件,测试安装我需要的包。 This is the cloud-init file.这是云初始化文件。 The custom apt configuration is in there because of waagent was locking the process (ref. Azure cloud-init: Failed to install packages ):自定义 apt 配置在那里,因为 waagent 正在锁定进程(参考Azure cloud-init:无法安装包):

#cloud-config

apt:
  conf: |
    Acquire::Retries "60";
    DPkg::Lock::Timeout "60";

package_update: true

# Install packages required for NetBox
packages:
  - python3
  - python3-pip
  - python3-venv
  - python3-dev
  - build-essential
  - libxml2-dev
  - libxslt1-dev
  - libffi-dev
  - libpq-dev
  - libssl-dev
  - zlib1g-dev
  - nginx

When I create the Azure VM with this configuration I get no errors, but in checking the job status 'modules-final' is always in the 'running' state and never seems to complete.当我使用此配置创建 Azure VM 时,我没有收到任何错误,但在检查作业状态时,“modules-final”始终处于“运行”状态 state 并且似乎从未完成。

azureuser@cloud-init-test:~$ cat /var/lib/cloud/data/status.json 
{
 "v1": {
  "datasource": "DataSourceAzure [seed=/dev/sr0]",
  "init": {
   "errors": [],
   "finished": 1671618221.4859056,
   "start": 1671618217.8323092
  },
  "init-local": {
   "errors": [],
   "finished": 1671618215.7414432,
   "start": 1671618214.2585633
  },
  "modules-config": {
   "errors": [],
   "finished": 1671618332.374849,
   "start": 1671618275.386914
  },
  "modules-final": {
   "errors": [],
   "finished": null,
   "start": 1671618332.9963179
  },
  "modules-init": {
   "errors": [],
   "finished": null,
   "start": null
  },
  "stage": "modules-final"
 }
}

If I re-run the process manually (ref. How to re-run cloud-init without reboot ), then I get the following:如果我手动重新运行该过程(参考How to re-run cloud-init without reboot ),那么我会得到以下信息:

azureuser@cloud-init-test:~$ sudo cloud-init modules --mode=final
Cloud-init v. 22.4.2-0ubuntu0~20.04.2 running 'modules:final' at Wed, 21 Dec 2022 11:42:19 +0000. Up 665.68 seconds.
Ign:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:2 http://archive.ubuntu.com/ubuntu focal InRelease
...

(I had to chop the list of URLs to avoid having the question flag as spam:)). (我不得不砍掉 URL 列表以避免将问题标记为垃圾邮件:))。 This list just scrolls seemingly without timeout.该列表似乎没有超时就滚动。 I'm not familiar with what this means, but it seems like the URLs are where packages are held so I get the feeling that it's trying to run the package installs but failing and retrying?我不熟悉这意味着什么,但似乎 URL 是保存包的地方所以我觉得它正在尝试运行 package 安装但失败并重试?

Does anyone have any insight into how I can proceed to troubleshoot?有没有人知道我如何继续进行故障排除?

Thanks!谢谢!

I tried to reproduce the same in my environment and got below results:我试图在我的环境中重现相同的结果并得到以下结果:

Try to ping the URLs to check whether you are able to do so like below尝试 ping 网址以检查您是否能够像下面那样这样做在此处输入图像描述Try to Sudo ping 8.8.8.8 inside your distro (Ubuntu).尝试在您的发行版 (Ubuntu) 中使用 Sudo ping 8.8.8.8。 If you cannot reach.network, search for.network related issues in wsl.如果无法访问.network,请在wsl中搜索与.network相关的问题。

If.network is reachable, it's either DNS problem or host being blocked by your.network.如果.network 是可达的,它要么是 DNS 问题,要么是主机被你的.network 阻止了。

To check DNS, try Sudo ping archive.ubuntu.com.要检查 DNS,请尝试 Sudo ping archive.ubuntu.com。

Step 1: sudo  systemctl restart systemd-resolved.service  
Step 2: sudo cloud-init modules --mode=final  

Execute the commands below if above steps doesn't give you required output如果上面的步骤没有给你需要的,执行下面的命令 output

sudo  systemctl unmask systemd-resolved.service  
sudo  systemctl enable systemd-resolved.service  
sudo  systemctl start systemd-resolved.service

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM