# Manually deploy xenial and artful on Azure using Azure CLI client. # Validate upgrade to proposed version of cloud-init # Check Tracebacks or error conditions on clean boot # Expect Traceback on ifdown ifup hostname bounce # Xenial Azure az vm create --name=my-x1 --image=Canonical:UbuntuServer:16.04-DAILY-LTS:latest --admin-username=root -g srugrp10 --admin-username=ubuntu --ssh-key-value @/root/.ssh/id_rsa.pub { "fqdns": "", "id": "/subscriptions/12aad61c-6de4-4e53-a6c6-5aff52a83777/resourceGroups/srugrp10/providers/Microsoft.Compute/virtualMachines/my-x1", "location": "eastus2", "macAddress": "00-0D-3A-02-B2-C8", "powerState": "VM running", "privateIpAddress": "10.0.0.4", "publicIpAddress": "52.225.254.16", "resourceGroup": "srugrp10", "zones": "" } root@publishing:~# vm_ip=`az vm list-ip-addresses --name my-x1 | jq -r '.[] | .virtualMachine.network.publicIpAddresses[].ipAddress'` root@publishing:~# echo $vm_ip 52.225.254.16 root@publishing:~# ssh ubuntu@$vm_ip 'dpkg-query --show cloud-init' cloud-init 17.1-46-g7acc9e68-0ubuntu1~16.04.1 root@publishing:~# ssh ubuntu@$vm_ip grep CODE /etc/os-release VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial root@publishing:~# ssh ubuntu@$vm_ip 'cat /run/cloud-init/result.json' { "v1": { "datasource": "DataSourceAzure [seed=/dev/sr0]", "errors": [] } } root@publishing:~# ssh ubuntu@$vm_ip 'grep Traceback /var/log/cloud-init*log' root@publishing:~# ssh ubuntu@$vm_ip -- sudo sed -i 's/ xenial / xenial-proposed /' /etc/apt/sources.list sed: -e expression #1, char 2: unterminated `s' command root@publishing:~# ssh ubuntu@$vm_ip "sudo sed -i 's/ xenial / xenial-proposed /' /etc/apt/sources.list" root@publishing:~# ssh ubuntu@$vm_ip -- sudo apt-get update ... Get:2 http://azure.archive.ubuntu.com/ubuntu xenial-proposed InRelease [253 kB] root@publishing:~# ssh ubuntu@$vm_ip -- sudo apt-get install cloud-init ... The following packages will be upgraded: cloud-init ... Preparing to unpack .../cloud-init_17.2-35-gf576b2a2-0ubuntu1~16.04.1_all.deb ... root@publishing:~# ssh ubuntu@$vm_ip -- sudo cloud-init init Cloud-init v. 17.2 running 'init' at Fri, 23 Feb 2018 17:24:40 +0000. Up 579.26 seconds. ci-info: ++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++ ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+ ci-info: | Device | Up | Address | Mask | Scope | Hw-Address | ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+ ci-info: | eth0 | True | 10.0.0.4 | 255.255.255.0 | . | 00:0d:3a:02:b2:c8 | ci-info: | eth0 | True | fe80::20d:3aff:fe02:b2c8/64 | . | link | 00:0d:3a:02:b2:c8 | ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . | . | ci-info: | lo | True | ::1/128 | . | host | . | ci-info: +--------+------+-----------------------------+---------------+-------+-------------------+ ci-info: ++++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++++ ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags | ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ ci-info: | 0 | 0.0.0.0 | 10.0.0.1 | 0.0.0.0 | eth0 | UG | ci-info: | 1 | 10.0.0.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U | ci-info: | 2 | 168.63.129.16 | 10.0.0.1 | 255.255.255.255 | eth0 | UGH | ci-info: | 3 | 169.254.169.254 | 10.0.0.1 | 255.255.255.255 | eth0 | UGH | ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ root@publishing:~# ssh ubuntu@$vm_ip -- sudo cloud-init status --long status: done time: Fri, 23 Feb 2018 17:24:40 +0000 detail: DataSourceAzure [seed=/dev/sr0] root@publishing:~# ssh ubuntu@$vm_ip -- grep Trace /var/log/cloud-init* root@publishing:~# ssh ubuntu@$vm_ip 'cat /run/cloud-init/result.json' { "v1": { "datasource": "DataSourceAzure [seed=/dev/sr0]", "errors": [] } } root@publishing:~# # remove cloud-init artifacts to test 'fresh' boot scenario root@publishing:~# ssh ubuntu@$vm_ip 'sudo cloud-init clean --logs --reboot' root@publishing:~# ssh-keygen -f "/root/.ssh/known_hosts" -R "52.225.254.16" # Host 52.225.254.16 found: line 33 /root/.ssh/known_hosts updated. Original contents retained as /root/.ssh/known_hosts.old root@publishing:~# ssh ubuntu@$vm_ip -- cat /run/cloud-init/result.json The authenticity of host '52.225.254.16 (52.225.254.16)' can't be established. ECDSA key fingerprint is SHA256:YIm9gDFw9cekYin5RnnRlbidH2oYBMazTzi3OF/fN6I. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '52.225.254.16' (ECDSA) to the list of known hosts. { "v1": { "datasource": "DataSourceAzure [seed=/var/lib/waagent]", "errors": [] } } root@publishing:~# ssh ubuntu@$vm_ip -- grep Trace /var/log/cloud-init* root@publishing:~# ssh ubuntu@$vm_ip -- dpkg-query --show cloud-init cloud-init 17.2-35-gf576b2a2-0ubuntu1~16.04.1 root@publishing:~# ssh ubuntu@$vm_ip -- cloud-init status --long status: done time: Fri, 23 Feb 2018 17:25:55 +0000 detail: DataSourceAzure [seed=/var/lib/waagent] root@publishing:~# # Check generalized instance data per 0cf6db36 root@publishing:~# ssh ubuntu@$vm_ip -- sudo cat /run/cloud-init/instance-data.json { "base64-encoded-keys": [ "ds/meta-data/random_seed" ], "ds": { "meta-data": { "azure_data": { "configurationsettype": "LinuxProvisioningConfiguration" }, "instance-id": "2B577730-8E1C-8D4C-B2EE-8AD03B87F3E7", "local-hostname": "my-x1", "random_seed": "T0VNMGQAAAABFVZSVFVBTE1JQ1JPU0ZUAhcABk1TRlSXAAAAQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQ==" }, "user-data": "", "vendor-data": null }, "v1": { "availability-zone": null, "cloud-name": "azure", "instance-id": "2B577730-8E1C-8D4C-B2EE-8AD03B87F3E7", "local-hostname": "my-x1", "region": null } } root@publishing:~# # End Xenial root@publishing:~# # Artful Azure root@publishing:~# az vm create --name=my-a1 --image=Canonical:UbuntuServer:17.10-DAILY:latest --admin-username=root -g srugrp10 --admin-username=ubuntu --ssh-key-value @/root/.ssh/id_rsa.pub { "fqdns": "", "id": "/subscriptions/12aad61c-6de4-4e53-a6c6-5aff52a83777/resourceGroups/srugrp10/providers/Microsoft.Compute/virtualMachines/my-a1", "location": "eastus2", "macAddress": "00-0D-3A-05-40-78", "powerState": "VM running", "privateIpAddress": "10.0.0.5", "publicIpAddress": "40.70.57.120", "resourceGroup": "srugrp10", "zones": "" } root@publishing:~# vm_ip=`az vm list-ip-addresses --name my-a1 | jq -r '.[] | .virtualMachine.network.publicIpAddresses[].ipAddress'` root@publishing:~# echo $vm_ip 40.70.57.120 root@publishing:~# ssh ubuntu@$vm_ip grep CODE /etc/os-release The authenticity of host '40.70.57.120 (40.70.57.120)' can't be established. ECDSA key fingerprint is SHA256:YqNZ5b+BROQifzSQdRwJCXvtWqiTsQviErxboIpHPz0. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '40.70.57.120' (ECDSA) to the list of known hosts. VERSION_CODENAME=artful UBUNTU_CODENAME=artful root@publishing:~# ssh ubuntu@$vm_ip 'cat /run/cloud-init/result.json' { "v1": { "datasource": "DataSourceAzure [seed=/dev/sr0]", "errors": [] } } root@publishing:~# ssh ubuntu@$vm_ip 'grep Traceback /var/log/cloud-init*log' /var/log/cloud-init.log:Traceback (most recent call last): # expected ifup/down traceback root@publishing:~# ssh ubuntu@$vm_ip -- grep Trace /var/log/cloud-init* /var/log/cloud-init.log:Traceback (most recent call last): # Check that it's expected ifup/down Traceback prior to upgrade root@publishing:~# ssh ubuntu@$vm_ip # Same Traceback we are fixing in the upgrade lp:1722668 ... Unexpected error while running command. Command: ['sh', '-xc', 'i=$interface; x=0; ifdown $i || x=$?; ifup $i || x=$?; exit $x'] # upgrade to proposed version of cloud-init root@publishing:~# ssh ubuntu@$vm_ip "sudo sed -i 's/ artful / artful-proposed /' /etc/apt/sources.list" root@publishing:~# ssh ubuntu@$vm_ip -- sudo apt-get update ... Get:2 http://azure.archive.ubuntu.com/ubuntu artful-proposed InRelease [235 kB] ... root@publishing:~# ssh ubuntu@$vm_ip -- sudo apt-get install cloud-init Reading package lists... The following packages will be upgraded: cloud-init ... Preparing to unpack .../cloud-init_17.2-35-gf576b2a2-0ubuntu1~17.10.1_all.deb ... root@publishing:~# ssh ubuntu@$vm_ip -- sudo cloud-init init Cloud-init v. 17.2 running 'init' at Fri, 23 Feb 2018 17:33:28 +0000. Up 222.03 seconds. ci-info: +++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++ ci-info: +--------+------+-----------+---------------+-------+-------------------+ ci-info: | Device | Up | Address | Mask | Scope | Hw-Address | ci-info: +--------+------+-----------+---------------+-------+-------------------+ ci-info: | eth0: | True | 10.0.0.5 | 255.255.255.0 | . | 00:0d:3a:05:40:78 | ci-info: | eth0: | True | . | . | d | 00:0d:3a:05:40:78 | ci-info: | lo: | True | 127.0.0.1 | 255.0.0.0 | . | . | ci-info: | lo: | True | . | . | d | . | ci-info: +--------+------+-----------+---------------+-------+-------------------+ ci-info: ++++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++++ ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags | ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ ci-info: | 0 | 0.0.0.0 | 10.0.0.1 | 0.0.0.0 | eth0 | UG | ci-info: | 1 | 0.0.0.0 | 10.0.0.1 | 0.0.0.0 | eth0 | UG | ci-info: | 2 | 10.0.0.0 | 0.0.0.0 | 255.255.255.0 | eth0 | U | ci-info: | 3 | 10.0.0.1 | 0.0.0.0 | 255.255.255.255 | eth0 | UH | ci-info: | 4 | 168.63.129.16 | 10.0.0.1 | 255.255.255.255 | eth0 | UGH | ci-info: | 5 | 169.254.169.254 | 10.0.0.1 | 255.255.255.255 | eth0 | UGH | ci-info: +-------+-----------------+----------+-----------------+-----------+-------+ root@publishing:~# ssh ubuntu@$vm_ip -- sudo cloud-init status --long status: done time: Fri, 23 Feb 2018 17:33:28 +0000 detail: DataSourceAzure [seed=/dev/sr0] root@publishing:~# ssh ubuntu@$vm_ip 'cat /run/cloud-init/result.json' { "v1": { "datasource": "DataSourceAzure [seed=/dev/sr0]", "errors": [] } } root@publishing:~# # remove cloud-init artifacts to test 'fresh' boot scenario root@publishing:~# ssh ubuntu@$vm_ip 'sudo cloud-init clean --logs --reboot' Connection to 40.70.57.120 closed by remote host. root@publishing:~# ssh ubuntu@$vm_ip -- cat /run/cloud-init/result.json @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:WUzCInFfohRDHEGJLvRod3sPE05pkAywiAuL2Dbtv5A. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /root/.ssh/known_hosts:34 remove with: ssh-keygen -f "/root/.ssh/known_hosts" -R "40.70.57.120" ECDSA host key for 40.70.57.120 has changed and you have requested strict checking. Host key verification failed. root@publishing:~# ssh-keygen -f "/root/.ssh/known_hosts" -R "40.70.57.120" # Host 40.70.57.120 found: line 34 /root/.ssh/known_hosts updated. Original contents retained as /root/.ssh/known_hosts.old root@publishing:~# ssh ubuntu@$vm_ip 'sudo cloud-init clean --logs --reboot' The authenticity of host '40.70.57.120 (40.70.57.120)' can't be established. ECDSA key fingerprint is SHA256:WUzCInFfohRDHEGJLvRod3sPE05pkAywiAuL2Dbtv5A. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '40.70.57.120' (ECDSA) to the list of known hosts. Connection to 40.70.57.120 closed by remote host. root@publishing:~# ssh ubuntu@$vm_ip -- cat /run/cloud-init/result.json @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is SHA256:fzR+fNcO7ROY0lFQHJazgyX4P3I1mYJ1a8/3ec4rOg4. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /root/.ssh/known_hosts:34 remove with: ssh-keygen -f "/root/.ssh/known_hosts" -R "40.70.57.120" ECDSA host key for 40.70.57.120 has changed and you have requested strict checking. Host key verification failed. root@publishing:~# ssh-keygen -f "/root/.ssh/known_hosts" -R "40.70.57.120" # Host 40.70.57.120 found: line 34 /root/.ssh/known_hosts updated. Original contents retained as /root/.ssh/known_hosts.old root@publishing:~# ssh ubuntu@$vm_ip -- cat /run/cloud-init/result.json The authenticity of host '40.70.57.120 (40.70.57.120)' can't be established. ECDSA key fingerprint is SHA256:fzR+fNcO7ROY0lFQHJazgyX4P3I1mYJ1a8/3ec4rOg4. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '40.70.57.120' (ECDSA) to the list of known hosts. { "v1": { "datasource": "DataSourceAzure [seed=/var/lib/waagent]", "errors": [] } } root@publishing:~# ssh ubuntu@$vm_ip -- cloud-init status --long status: done time: Fri, 23 Feb 2018 17:42:16 +0000 detail: DataSourceAzure [seed=/var/lib/waagent] root@publishing:~# ssh ubuntu@$vm_ip -- cloud-init status --wait # should not block status: done root@publishing:~# ssh ubuntu@$vm_ip -- grep Trace /var/log/cloud-init* root@publishing:~# ssh ubuntu@$vm_ip -- dpkg-query --show cloud-init cloud-init 17.2-35-gf576b2a2-0ubuntu1~17.10.1 root@publishing:~# # Check generalized instance data per 0cf6db36 root@publishing:~# ssh ubuntu@$vm_ip -- cat /run/cloud-init/instance-data.json cat: /run/cloud-init/instance-data.json: Permission denied root@publishing:~# ^C root@publishing:~# ssh ubuntu@$vm_ip -- sudo cat /run/cloud-init/instance-data.json { "base64-encoded-keys": [ "ds/meta-data/random_seed" ], "ds": { "meta-data": { "azure_data": { "configurationsettype": "LinuxProvisioningConfiguration" }, "instance-id": "9DE1BAB4-6B11-AA46-9632-EEFFE487C23F", "local-hostname": "my-a1", "random_seed": "T0VNMGQAAAABFVZSVFVBTE1JQ1JPU0ZUAhcABk1TRlSXAAAAQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQQ==" }, "user-data": "", "vendor-data": null }, "v1": { "availability-zone": null, "cloud-name": "azure", "instance-id": "9DE1BAB4-6B11-AA46-9632-EEFFE487C23F", "local-hostname": "my-a1", "region": null } } root@publishing:~# # End artful test