Installing and configuring cloud-init on Ubuntu

Before you capture a virtual machine, you need to install the cloud-init package. This topic provides you details about cloud-init installation procedure for Ubuntu.

Note: Ubuntu 16.04 will reach end of the lifecycle support (EOS) by end of April 2021. Post the announcement of EOS, consider upgrading to PowerVC 2.0.1 which supports Ubuntu 18.04. For details about upgrading, see Upgrading PowerVC to 2.0.1.

Install cloud-init on Ubuntu

PowerVC supports cloud-init-19.1 (new version support added in PowerVC version 1.4.4.1) for Ubuntu. Follow these steps to install cloud-init on Ubuntu:
  1. Before you install cloud-init, you must install the dependencies for cloud-init from the operating system base and supplemental media, by using apt-get, or any other package manager.
  2. For Ubuntu 16:
    1. Obtain the RPM from /opt/ibm/powervc/images/cloud-init/ubuntu on the PowerVC management server and install it on the virtual machine.
      • Ubuntu 16: cloud-init_19.1-1.ibm.ubuntu.deb

        Install cloud-init by running apt-get install downloaded_path/cloud-init_19.1-1.ibm.ubuntu.deb. Make sure you provide complete Debian package path during installation.

        To uninstall any older versions, run apt-get remove cloud-init and then run apt-get purge cloud-init.

        Note: If the virtual machine already has a cloud-init Debian package installed, the existing Debian package must be uninstalled before installing the PowerVC version of the Debian package.
    2. Run apt-mark hold cloud-init. This ensures that the PowerVC cloud-init bundle is not overwritten by a different version when running apt-get upgrade.
    3. Do the following:
      1. In /lib/udev/rules.d/73-special-net-names.rules, comment out the line containing DRIVERS=="ibmveth".
      2. Run update-initramfs -u.
      3. Modify /etc/network/interfaces to change references to ibmvethN to eth0. Comment out hwaddr if it is present.

  3. For Ubuntu 18.04 (KVM on Power® only):
    1. Run sudo apt install cloud-init.
    2. Rename /etc/netplan/01-netcfg.yaml to /etc/netplan/51-netcfg.yaml.
      Note: After deploying the virtual machine, it is recommended that you navigate to this file on the virtual machine: /etc/netplan/51-netcfg.yaml, and update it with the current network information.
  4. Modify the cloud.cfg file available at /etc/cloud/cloud.cfg with the following values.
    • For Ubuntu 16:cloud-init_19.1-1.ibm.ubuntu.deb:
      Modify these values, if they exist. Add any of these values that are missing:
      disable_root: false
      
      Add these values after preserve_hostname and remove disable_ec2_metadata module from /etc/cloud/cloud.cfg:
      datasource_list: [ ConfigDrive, None ]
      datasource:
        ConfigDrive:   
          dsmode: local
      
      Enable and start the cloud-init related services by issuing the following commands:
      systemctl enable cloud-init-local.service
      systemctl enable cloud-init.service
      systemctl enable cloud-config.service
      systemctl enable cloud-final.service
      systemctl start cloud-init.service
      systemctl start cloud-init-local.service
      systemctl start cloud-config.service
      systemctl start cloud-final.service
      

      Run cloud-init status to check the cloud-init status. Make sure the status shows as Done.

  5. For Ubuntu 16, follow the steps in PowerVC cloud-init modules. You can enable and configure cloud-init custom modules and control the way cloud-init sets your hostname by modifying the cloud.cfg file as described in this topic.
  6. In /etc/ssh/sshd_config, make sure PasswordAuthentication and ChallengeResponseAuthentication is set to yes.
Note: For troubleshooting steps related to MAC address conflict issues, see MAC address conflict.