In order to verify this on xenial, we'll configure a container to have cloud-config like MAAS uses on the init command's command line. Basically, instead of invokin /sbin/init for pid 1, we will use:
/sbin/init cc:{'datasource_list':['MAAS']}end_cc This is equivalent to booting a full system with the above on the kernel command line. When inside a container, cloud-init uses pid 1's cmdline (/proc/1/cmdline) rather than the kernel's cmdline (/proc/cmdline). Because of this bug, the system will find the NoCloud datasource that lxc provides even though we told it on the command line to only look at MAAS. Then, we will update the system with proposed, clean the system to mimic a pristine "first boot" and reboot. The second time, the system will fail to find the NoCloud datasource becaus it correctly responded to the command line arguments telling it to only look for MAAS datasource. $ release=xenial $ name="$release-test" $ lxc init ubuntu-daily:$release $name # change pid 1's command line, which is used by cloud-init # instead of kernel command line inside a container. $ cmdline="cc:{'datasource_list': ['MAAS']}end_cc" $ lxc config set $name raw.lxc "lxc.init_cmd=/sbin/init $cmdline" $ lxc start $name # sleep $ sleep 10 ## show info about instance $ lxc exec $name -- dpkg-query --show cloud-init cloud-init 0.7.8-49-g9e904bb-0ubuntu1~16.04.4 # pid1 has the cmdline shown $ lxc exec $name -- cat /proc/1/cmdline; echo /sbin/initcc:{'datasource_list':['MAAS']}end_cc $ cat /run/cloud-init/result.json { "v1": { "datasource": "DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]", "errors": [] } } $ lxc file pull $name/etc/cloud/build.info - build_name: server serial: 20170209 ## enable proposed, update $ m=http://archive.ubuntu.com/ubuntu; $ echo "deb $m $release-proposed main" | lxc file push - $name/etc/apt/sources.list.d/proposed.list $ lxc exec $name -- sh -c 'apt-get update -q && apt-get install cloud-init' </dev/null $ lxc exec $name -- dpkg-query --show cloud-init cloud-init 0.7.9-0ubuntu1~16.04.2 # clean up to make it look like first boot. $ lxc exec $name -- sh -c 'cd /var/lib/cloud; for d in *; do [ "$d" = "seed" ] || rm -vRf "$d"; done' $ lxc exec $name -- sh -c 'rm -f /var/log/cloud*' $ lxc restart $name $ sleep 10 $ lxc exec $name -- cat /run/cloud-init/result.json { "v1": { "datasource": null, "errors": [ "No instance datasource found.", "Can not apply stage config, no datasource found! Likely bad things to come!", "Can not apply stage final, no datasource found! Likely bad things to come!" ] } } $ lxc exec $name -- grep -i "Searching for" /var/log/cloud-init.log 2017-02-10 05:23:16,420 - __init__.py[DEBUG]: Searching for local data source in: [] 2017-02-10 05:23:16,841 - handlers.py[DEBUG]: finish: init-local: SUCCESS: searching for local datasources 2017-02-10 05:23:19,358 - __init__.py[DEBUG]: Searching for network data source in: ['DataSourceMAAS'] ** Tags removed: verification-needed ** Tags added: verification-done-xenial ** Tags removed: verification-needed-xenial ** Tags added: verification-needed-yakkety -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1582323 Title: Commissioning fails when competing cloud metadata resides on disk To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-init/+bug/1582323/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs