Centos6 with cloud-init takes longer boot time

Madhavan Kumar asked:

Centos-6.6 vm image takes almost ten minutes of boot time when ran using virsh. I captured the logs using virsh console. It looks like this,

ci-info: +-------+---------------+---------------+---------------+-----------+-------+
ci-info: | Route |  Destination  |    Gateway    |    Genmask    | Interface | Flags |
ci-info: +-------+---------------+---------------+---------------+-----------+-------+
ci-info: |   0   | 192.168.122.0 |    0.0.0.0    | 255.255.255.0 |    eth0   |   U   |
ci-info: |   1   |    0.0.0.0    | 192.168.122.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: +-------+---------------+---------------+---------------+-----------+-------+
2015-04-25 05:13:41,222 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [50/120s]: unexpected error ['Timeout' object has no attribute 'response']
2015-04-25 05:14:32,278 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [101/120s]: unexpected error ['Timeout' object has no attribute 'response']
2015-04-25 05:14:51,322 - DataSourceEc2.py[CRITICAL]: Giving up on md from ['http://169.254.169.254/2009-04-04/meta-data/instance-id'] after 120 seconds
2015-04-25 05:14:51,990 - url_helper.py[WARNING]: Calling 'http://192.168.122.1//latest/meta-data/instance-id' failed [0/120s]: bad status code [404]
2015-04-25 05:14:53,008 - url_helper.py[WARNING]: Calling 'http://192.168.122.1//latest/meta-data/instance-id' failed [1/120s]: bad status code [404]
2015-04-25 05:14:54,022 - url_helper.py[WARNING]: Calling 'http://192.168.122.1//latest/meta-data/instance-id' failed [2/120s]: bad status code [404]

My image tries to get some metadata from the remote server. Once that fails, it tries to collect the information from the local gateway.

Is this to do with cloud-init? Can i configure to turn off the remote server calls?

My answer:


By default cloud-init expects to receive metadata from an Amazon EC2-compatible metadata service, such as that included with OpenStack and possibly other services.

If you aren’t running your VM under such a service, you have two options:

  1. Disable or uninstall cloud-init. This is the easiest option and if you aren’t running in a cloud service then you should do this. For example:

    systemctl mask cloud-init
    

    Or…

  2. Create a configuration drive as an ISO CD image containing the metadata which would have been obtained from the metadata service, if one had been present, and permanently attach the image to the virtual machine. You almost certainly do not need to do this.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.