cloud-init is slow to complete init on minimized images
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Won't Fix
|
Undecided
|
Unassigned | ||
cloud-init (Ubuntu) |
Won't Fix
|
Wishlist
|
Unassigned | ||
linux-kvm (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned | ||
python3.6 (Ubuntu) |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
http://
cloud-init is very slow to complete its initialization steps. Specifically, the 'init' takes over 150 seconds.
Cloud-init v. 17.1 running 'init-local' at Wed, 25 Oct 2017 13:22:07 +0000. Up 2.39 seconds.
2017-10-25 13:22:07,157 - util.py[WARNING]: did not find either path /sys/class/dmi/id or dmidecode command
Cloud-init v. 17.1 running 'init' at Wed, 25 Oct 2017 13:22:16 +0000. Up 11.37 seconds.
ci-info: +++++++
ci-info: +------
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +------
ci-info: | ens3: | True | 192.168.100.161 | 255.255.255.0 | . | 52:54:00:bb:ad:fb |
ci-info: | ens3: | True | . | . | d | 52:54:00:bb:ad:fb |
ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . | . |
ci-info: | lo: | True | . | . | d | . |
ci-info: | sit0: | False | . | . | . | . |
ci-info: +------
ci-info: +++++++
ci-info: +------
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +------
ci-info: | 0 | 0.0.0.0 | 192.168.100.1 | 0.0.0.0 | ens3 | UG |
ci-info: | 1 | 192.168.100.0 | 0.0.0.0 | 255.255.255.0 | ens3 | U |
ci-info: | 2 | 192.168.100.1 | 0.0.0.0 | 255.255.255.255 | ens3 | UH |
ci-info: +------
2017-10-25 13:24:38,187 - util.py[WARNING]: Failed to resize filesystem (cmd=('resize2fs', '/dev/root'))
2017-10-25 13:24:38,193 - util.py[WARNING]: Running module resizefs (<module 'cloudinit.
Generating public/private rsa key pair.
Your identification has been saved in /etc/ssh/
Your public key has been saved in /etc/ssh/
The key fingerprint is:
SHA256:
The key's randomart image is:
+---[RSA 2048]----+
| |
| . + |
| . O . |
|o . % +. |
|++.o %=.S |
|+=ooo=+o. . .E |
|* +.+. . o o. |
|=. . . .=. |
|+. . B= |
+----[SHA256]-----+
Generating public/private dsa key pair.
Your identification has been saved in /etc/ssh/
Your public key has been saved in /etc/ssh/
The key fingerprint is:
SHA256:
The key's randomart image is:
+---[DSA 1024]----+
| .oo=X==o|
| =* *+.|
| . = .B . |
| . o =E.. .|
| S .oo+o..|
| o ..*+.|
| . +.=o|
| .o *|
| .o..++|
+----[SHA256]-----+
Generating public/private ecdsa key pair.
Your identification has been saved in /etc/ssh/
Your public key has been saved in /etc/ssh/
The key fingerprint is:
SHA256:
The key's randomart image is:
+---[ECDSA 256]---+
| .o. |
| .o |
| o . o. . |
| +.* . . . .|
| .*XE S o .|
| oo++ . . . |
| oo= o . . . o|
|o.Oo. + o . .o.o |
|oB=+.. . .o++o. |
+----[SHA256]-----+
Generating public/private ed25519 key pair.
Your identification has been saved in /etc/ssh/
Your public key has been saved in /etc/ssh/
The key fingerprint is:
SHA256:
The key's randomart image is:
+--[ED25519 256]--+
| .E . o++.o+++|
| + ...++...++|
| o o=o.o.+ .o|
| .o oo=+o . .|
| o+o .+ So. |
| =o.o .... |
|..= . o |
| o. . . |
| .. |
+----[SHA256]-----+
sudo: unable to resolve host cloudimg: Resource temporarily unavailable
Cloud-init v. 17.1 running 'modules:config' at Wed, 25 Oct 2017 13:24:39 +0000. Up 155.13 seconds.
2017-10-25 13:24:40,289 - util.py[WARNING]: Failed to run command to import ubuntu ssh ids
2017-10-25 13:24:40,291 - util.py[WARNING]: ssh-import-id failed for: ubuntu ['cyphermox']
2017-10-25 13:24:40,292 - util.py[WARNING]: Running module ssh-import-id (<module 'cloudinit.
Cloud-init v. 17.1 running 'modules:final' at Wed, 25 Oct 2017 13:24:41 +0000. Up 156.51 seconds.
ci-info: no authorized ssh keys fingerprints found for user ubuntu.
Cloud-init v. 17.1 finished at Wed, 25 Oct 2017 13:24:41 +0000. Datasource DataSourceNoCloud [seed=/
This does not seem to be caused by ssh key generation (I tried to disable it, with no keytypes enabled there is still > 150 s delay), not does it seem to be related to the resizing operation.
I suspect some other step requiring randomness to generate some kind of ID, but I don't know.
Could you run
cloud-init collect-logs
And then attach the cloud-init.tar.gz
Also, Can you provide some information on what you were running?
" cloud-init is slow to complete init on minimized images "
How can I recreate this?
One curious thing there is:
2017-10-25 13:22:07,157 - util.py[WARNING]: did not find either path /sys/class/dmi/id or dmidecode command
I suspect you have a kernel without CONFIG_DMI, which seems unfortunate or
possibly you're not on intel or arm64.
For large jumps in your log, it took ~ 9 seconds (13:22:07,337 -> 13:22:16,112) from the exit of cloud-init- local.service to get to 'cloud- init.service' printing its hello message. That is basically the time it took the network to come up.
Then we have a big jump (122 seconds): distros. ubuntu. Distro' >
13:22:16,264 main.py[DEBUG]: no di_report found in config.
13:24:38,088 stages.py[DEBUG]: Using distro class <class 'cloudinit.
Those two lines in a vm I have on a openstack look like this: distros. ubuntu. Distro' > config. cc_migrator' from '/usr/lib/ python3/ dist-packages/ cloudinit/ config/ cc_migrator. py'>) with frequency always
2017-10-11 15:08:26,685 - main.py[DEBUG]: no di_report found in config.
2017-10-11 15:08:27,031 - stages.py[DEBUG]: Using distro class <class 'cloudinit.
2017-10-11 15:08:27,032 - stages.py[DEBUG]: Running module migrator (<module 'cloudinit.
That is ~ .5 seconds, which is not fast, but not 120 seconds either.