有一台阿里云经典网络的实例。系统太老了,重装了Debian 11,但是启动非常慢,要5分钟才能开机,简直离谱。
root@AliYun:~# systemd-analyze blame 5min 3.954s cloud-init.service 1min 2.905s cloud-init-local.service 13.256s systemd-networkd-wait-online.service 1.041s aegis.service 882ms cloud-config.service 800ms e2scrub_reap.service
查看是cloud-init拖慢了启动。接着查看cloud-init-output.log日志,发现是连不上实例元数据100.100.100.200服务器。咨询客服得到答复网络类型是经典网络,是不支持访问元数据的,可以考虑把cloud-init服务禁止开机启动
Cloud-init v. 19.1.11 running 'init-local' at Wed, 09 Nov 2022 15:46:38 +0000. Up 4.00 seconds. 2022-11-09 15:47:39,579 - util.py[WARNING]: Getting data from <class 'cloudinit.sources.DataSourceAliYun.DataSourceAliYun2Local'> failed Cloud-init v. 19.1.11 running 'init' at Wed, 09 Nov 2022 15:47:53 +0000. Up 78.81 seconds. 2022-11-09 15:47:58,522 - url_helper.py[WARNING]: Calling 'http://100.100.100.200/2016-01-01/meta-data/instance-id' failed [5/300s]: request error [HTTPConnectionPool(host='100.100.100.200', port=80): Max retries exceeded with url: /2016-01-01/meta-data/instance-id (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f085a4eea30>, 'Connection to 100.100.100.200 timed out. (connect timeout=5.0)'))] 2022-11-09 15:48:04,534 - url_helper.py[WARNING]: Calling 'http://100.100.100.200/2016-01-01/meta-data/instance-id' failed [11/300s]: request error [HTTPConnectionPool(host='100.100.100.200', port=80): Max retries exceeded with url: /2016-01-01/meta-data/instance-id (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f085a456490>, 'Connection to 100.100.100.200 timed out. (connect timeout=5.0)'))]
那么解决方法就很简单了:
通过创建文件禁用 cloud-init。这是最简单最安全的方法,在 /etc/cloud 目录下创建一个空文件 cloud-init.disabled 文件重启后生效。删除该文件就可以恢复。
sudo touch /etc/cloud/cloud-init.disabled
重启后,很快就开机了。问题解决。
标签:11,100.200,01,100.100,init,阿里,Debian,cloud From: https://www.cnblogs.com/ccc008/p/16878085.html