# 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-68-gca3ae67-0ubuntu1~16.10.1
# pid1 has the cmdline shown
$ lxc exec $name -- cat /proc/1/cmdline; echo
/sbin/initcc:{'datasource_list':['MAAS']}end_cc
# 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 14:57:42,046 - __init__.py[DEBUG]: Searching for local data source in: []
2017-02-10 14:57:42,074 - handlers.py[DEBUG]: finish: init-local: SUCCESS: searching for local datasources
2017-02-10 14:57:43,805 - __init__.py[DEBUG]: Searching for network data source in: ['DataSourceMAAS']
2017-02-10 14:57:43,805 - handlers.py[DEBUG]: start: init-network/search-MAAS: searching for network data from DataSourceMAAS
2017-02-10 14:57:43,832 - handlers.py[DEBUG]: finish: init-network: SUCCESS: searching for network datasources
$ name="$ release- test" daily:$ release $name
$ lxc init ubuntu-
# change pid 1's command line, which is used by cloud-init "cc:{'datasourc e_list' : ['MAAS']}end_cc" cmd=/sbin/ init $cmdline"
# instead of kernel command line inside a container.
$ cmdline=
$ lxc config set $name raw.lxc "lxc.init_
$ lxc start $name
# sleep
$ sleep 10
## show info about instance gca3ae67- 0ubuntu1~ 16.10.1
$ lxc exec $name -- dpkg-query --show cloud-init
cloud-init 0.7.8-68-
# pid1 has the cmdline shown {'datasource_ list':[ 'MAAS'] }end_cc
$ lxc exec $name -- cat /proc/1/cmdline; echo
/sbin/initcc:
$ lxc exec $name -- cat /run/cloud- init/result. json var/lib/ cloud/seed/ nocloud- net][dsmode= net]",
{
"v1": {
"datasource": "DataSourceNoCloud [seed=/
"errors": []
}
}
$ lxc file pull $name/etc/ cloud/build. info -
build_name: server
serial: 20170207
## enable proposed, update archive. ubuntu. com/ubuntu; apt/sources. list.d/ proposed. list 16.10.1
$ m=http://
$ echo "deb $m $release-proposed main" | lxc file push - $name/etc/
$ 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~
# 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 search- MAAS: searching for network data from DataSourceMAAS
2017-02-10 14:57:42,046 - __init__.py[DEBUG]: Searching for local data source in: []
2017-02-10 14:57:42,074 - handlers.py[DEBUG]: finish: init-local: SUCCESS: searching for local datasources
2017-02-10 14:57:43,805 - __init__.py[DEBUG]: Searching for network data source in: ['DataSourceMAAS']
2017-02-10 14:57:43,805 - handlers.py[DEBUG]: start: init-network/
2017-02-10 14:57:43,832 - handlers.py[DEBUG]: finish: init-network: SUCCESS: searching for network datasources