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:- 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.
- For Ubuntu 16:
- 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.debInstall 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.
- Ubuntu 16:
- Run
apt-mark hold cloud-init. This ensures that the PowerVC cloud-init bundle is not overwritten by a different version when runningapt-get upgrade. - Do the following:
- In /lib/udev/rules.d/73-special-net-names.rules, comment out the line
containing
DRIVERS=="ibmveth". - Run
update-initramfs -u. - Modify /etc/network/interfaces to change references to
ibmvethNtoeth0. Comment outhwaddrif it is present.
- In /lib/udev/rules.d/73-special-net-names.rules, comment out the line
containing
- Obtain the RPM from /opt/ibm/powervc/images/cloud-init/ubuntu
on the PowerVC management server and install
it on the virtual
machine.
- For Ubuntu 18.04 (KVM on Power® only):
- Run
sudo apt install cloud-init. - 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.
- Run
- Modify the
cloud.cfgfile 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: falseAdd these values afterpreserve_hostnameand removedisable_ec2_metadatamodule from /etc/cloud/cloud.cfg:datasource_list: [ ConfigDrive, None ] datasource: ConfigDrive: dsmode: localEnable 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.serviceRun cloud-init status to check the cloud-init status. Make sure the status shows as Done.
- For Ubuntu 16:
- 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.
- In /etc/ssh/sshd_config, make sure
PasswordAuthenticationandChallengeResponseAuthenticationis set to yes.
Note: For troubleshooting steps related to MAC address conflict issues,
see MAC address conflict.