Merge lp:~matsubara/maas/ephemeral-img-debugging-doc into lp:maas/trunk

Proposed by Diogo Matsubara on 2013-01-18
Status: Merged
Approved by: Diogo Matsubara on 2013-04-05
Approved revision: 1427
Merged at revision: 1460
Proposed branch: lp:~matsubara/maas/ephemeral-img-debugging-doc
Merge into: lp:maas/trunk
Diff against target: 90 lines (+83/-0)
1 file modified
docs/troubleshooting.rst (+83/-0)
To merge this branch: bzr merge lp:~matsubara/maas/ephemeral-img-debugging-doc
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve on 2013-04-05
Nick Veitch 2013-01-18 Pending
Review via email: mp+143927@code.launchpad.net

Commit message

Adds to the official troubleshooting documentation, information on how to debug the ephemeral images.

Description of the change

This branch adds to the official troubleshooting documentation, information on how to debug the ephemeral images.

It's based on the instructions sent by Scott Moser to the maas-devel mailing list[1]. Please feel free to suggest better wording and proper rest syntax. I think it's the first time I wrote a rst file. :-)

Cheers,

Diogo

[1] https://lists.launchpad.net/maas-devel/msg00808.html

To post a comment you must log in.
Julian Edwards (julian-edwards) wrote :

It's the weekend so I'm not reviewing this officially yet, but if we're going
to document a backdoor image, then it should not be a junk branch on ~smoser
as that looks rather unprofessional.

Let's make an official branch under ~maas-maintainers instead.

1425. By Diogo Matsubara on 2013-01-22

change backdoor-image instructions to point to ~maas-maintainers branch

Diogo Matsubara (matsubara) wrote :

Thanks Julian, I created the branch under ~maas-maintainers and updated the docs to point to lp:~maas-maintainers/maas/backdoor-image

Julian Edwards (julian-edwards) wrote :

43 +to poweroff. To stop that from happening, you can just touch a file in /tmp.

s/poweroff/power off/

and

s/touch a/create a/

81 +The client has --help Usage also, but here is an example on how to use it:

s/on/of/

Everything else looks great.

review: Approve
Julian Edwards (julian-edwards) wrote :

(sorry for the delay in reviewing, I assumed Nick would do it but I guess everyone moved on now)

1426. By Diogo Matsubara on 2013-04-05

apply review comments

1427. By Diogo Matsubara on 2013-04-05

forgot one

Diogo Matsubara (matsubara) wrote :

Thanks Julian!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/troubleshooting.rst'
2--- docs/troubleshooting.rst 2012-11-27 15:32:02 +0000
3+++ docs/troubleshooting.rst 2013-04-06 00:02:19 +0000
4@@ -117,3 +117,86 @@
5 #. If you are still getting "404 - Page not found" errors, check that the MAAS
6 web interface has been installed in the right place. There should be a file
7 present called /usr/share/maas/maas/urls.py
8+
9+**Debugging ephemeral image**
10+=============================
11+
12+Backdoor (add a login) to ephemeral images
13+------------------------------------------
14+
15+If you cannot login to an instance, you might have to "backdoor it" in order
16+to see what is going wrong. Scott Moser wrote a simple utility that injects a
17+user and password into an image. Here's how to add a 'backdoor' user with a
18+password to your images.
19+
20+
21+``bzr branch lp:~maas-maintainers/maas/backdoor-image``
22+
23+``imgs=$(echo var/lib/maas/ephemeral/*/*/*/*/*.img)
24+for img in $imgs; do
25+ [ -f "$img.dist" ] || cp -a --sparse=always $img $img.dist
26+done
27+
28+for img in $imgs; do
29+ sudo ./backdoor-image -v --user=backdoor --password-auth --password=ubuntu
30+done``
31+
32+Inside the ephemeral image
33+--------------------------
34+
35+Important files for debugging (Someone is likely to ask you for these
36+things to help debug):
37+
38+``/var/log/cloud-init.log``
39+``/var/log/boot.log``
40+``/var/log/cloud-init-output.log``
41+
42+After enlistment or commissioning, the user-data from maas instructs the system
43+to power off. To stop that from happening, you can just create a file in /tmp.
44+
45+
46+``touch /tmp/block-poweroff``
47+
48+MAAS credentials
49+----------------
50+
51+MAAS credentials can be found in 2 places:
52+
53+ #. from the cmdline you'll see a 'url=' or 'cloud-config-url=' parameter
54+ You can get the cloud-config from that url, which will have credentials.
55+
56+ ``sed -n 's,.*url=\([^ ]*\).*,\1,p' /proc/cmdline
57+ http://10.55.60.194/MAAS/metadata/latest/enlist-preseed/?op=get_enlist_preseed``
58+
59+ #. from /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url. The file was pulled
60+ from url= parameter by cloud-init
61+
62+ ``sudo cat /etc/cloud/cloud.cfg.d/91_kernel_cmdline``
63+
64+MAAS datasource
65+---------------
66+
67+The cloud-init datasource for MAAS can be invoked as a 'main' for debugging
68+purposes. To do so, you need to know the url for the MAAS datasource and a
69+config file that contains credentials.
70+
71+
72+ ``cfg=$(echo /etc/cloud/cloud.cfg.d/*_cmdline_url.cfg)``
73+ ``echo $cfg /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url.cfg``
74+
75+Now get the metadata_url from there.
76+
77+ ``url=$(sudo awk '$1 == "metadata_url:" { print $2 }' $cfg)``
78+ ``echo $url http://10.55.60.194/MAAS/metadata/enlist``
79+
80+Invoke the client /usr/share/pyshared/cloudinit/sources/DataSourceMAAS.py
81+The client has --help Usage also, but here is an example of how to use it:
82+
83+ ``maasds="/usr/share/pyshared/cloudinit/sources/DataSourceMAAS.py"``
84+ ``sudo python $maasds --config=$cfg get $url``
85+ == http://10.55.60.194/MAAS/metadata/enlist ==
86+ 2012-03-01
87+ latest
88+
89+ ``sudo python $maasds --config=$cfg get $url/latest/meta-data/local-hostname``
90+ maas-enlisting-node