rm -rf /var/lib/cloud
/usr/bin/cloud-init init --local
/usr/bin/cloud-init init
/usr/bin/cloud-init modules --mode=config
/usr/bin/cloud-init modules --mode=final
Initialization Type | Default Behavior | Customization | Notes |
hostname initialization | During the first launch of an instance, cloud-init sets the hostname of the instance according to the hostname information in vendor_data.json . | If you create or reinstall an instance with a custom image and you want to keep the custom `hostname` settings of the image, you can set preserve_hostname in /etc/cloud/cloud.cfg to true and delete - scripts-user before creating the custom image. | If preserve_hostname is true and - scripts-user is disabled, the initialization script /var/lib/cloud/instance/scripts/runcmd inside the instance will not be executed. Disabling the configuration will also affect the initialization of other sub-items such as the installation of Tencent Cloud Observability Platform and cloud security as well as software source settings. Also, the custom script will not be executed when you create the CVM instance. |
/etc/hosts initialization | During the first launch of an instance, cloud-init initializes /etc/hosts to 127.0.0.1 $hostname by default. | If you create or reinstall an instance with a custom image and you want to keep the custom `/etc/hosts` settings of the image, of the image, you can delete the following configuration from /etc/cloud/cloud.cfg before creating the custom image: - scripts-user and - ['update_etc_hosts', 'once-per-instance'] . | After you disable - scripts-user , the initialization script /var/lib/cloud/instance/scripts/runcmd inside the instance will not be executed. Disabling the configuration will also affect the initialization of other sub-items such as the installation of Tencent Cloud Observability Platform and cloud security as well as software source settings. Also, the custom script will not be executed when you create the CVM instance.During instance restart, the /etc/hosts settings of some existing instances will be overwritten. For information about the solutions, see Modifying etc/hosts Configuration of Linux Instance. |
DNS initialization (non-DHCP scenario) | During the first launch of an instance, cloud-init sets the DNS of the instance according to the nameservers information in vendor_data.json . | If you create or reinstall an instance with a custom image and you want to keep the custom DNS settings of the image, you can delete the following configuration from /etc/cloud/cloud.cfg before creating the custom image: - resolv_conf and unverified_modules: ['resolv_conf'] . | None. |
Software source initialization | During the first launch of an instance, cloud-init sets the software source of the instance according to the write_files information in vendor_data.json. | If you create or reinstall an instance with a custom image and you want to keep the custom software source settings of the image, you can delete the following configuration from /etc/cloud/cloud.cfg before creating the custom image: - write-files . | None. |
NTP initialization | During the first launch of an instance, cloud-init sets the INTP server configuration of the instance according to the NTP Server information in vendor_data.json and starts the NTP service. | If you create or reinstall an instance with a custom image and you want to keep the custom NTP settings of the image, you can delete the following configuration from /etc/cloud/cloud.cfg before creating the custom image: - ntp . | None. |
Password initialization | During the first launch of an instance, cloud-init sets the default account password of the instance according to the chpasswd information in vendor_data.json . | If you create or reinstall an instance with a custom image and you want to keep the custom default account password of the image, you can delete the following configuration from /etc/cloud/cloud.cfg before creating the custom image: - set-passwords . | None. |
Key binding | During the first launch of an instance, cloud-init sets the default account key of the instance according to the `ssh_authorized_keys` information in vendor_data.json . | If you create or reinstall an instance with a custom image and you want to keep the custom key of the image, you can delete the following configuration from /etc/cloud/cloud.cfg before creating the custom image: - users-groups . | If you manually bind the instance to a key inside the instance, the previous key will be overwritten when you perform the key binding operation in the console. |
Network initialization (non-DHCP scenario) | During the first launch of an instance, cloud-init sets the IP, Gateway, and Mask of the instance according to the information in network_data.json . | If you create or reinstall an instance with a custom image and you want to keep the custom network information of the image, you can add the following configuration to /etc/cloud/cloud.cfg before creating the custom image: network: {config: disabled} . | None. |
Traceback (most recent call last):File "/usr/bin/cloud-init", line 5, in********raise DistributionNotFound(req)pkg_resources.DistributionNotFound: pyyaml
/usr/bin/python
and /bin/python
, are linked to Python 2. Users may change the default Python interpreter to Python 3 inside the instance by directing the symbolic links, /usr/bin/python
and /bin/python
, to Python 3. Due to compatibility issues, an error will be returned when cloud-init is run on startup./usr/bin/cloud-init
file by changing #!/usr/bin/python
or #!/bin/python
to #!/usr/bin/python2.7
./var/log/cloud-init-output.log
C:\\Program Files\\Cloudbase Solutions\\Cloudbase-Init\\log\\cloudbase-init.log
Was this page helpful?