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

Proposed by Diogo Matsubara
Status: Merged
Approved by: Diogo Matsubara
Approved revision: no longer in the source branch.
Merged at revision: 1460
Proposed branch: lp:~matsubara/maas/ephemeral-img-debugging-doc
Merge into: lp:~maas-committers/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
Nick Veitch 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.
Revision history for this message
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.

Revision history for this message
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

Revision history for this message
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
Revision history for this message
Julian Edwards (julian-edwards) wrote :

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

Revision history for this message
Diogo Matsubara (matsubara) wrote :

Thanks Julian!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'docs/troubleshooting.rst'
--- docs/troubleshooting.rst 2012-11-27 15:32:02 +0000
+++ docs/troubleshooting.rst 2013-04-06 00:02:19 +0000
@@ -117,3 +117,86 @@
117 #. If you are still getting "404 - Page not found" errors, check that the MAAS117 #. If you are still getting "404 - Page not found" errors, check that the MAAS
118 web interface has been installed in the right place. There should be a file118 web interface has been installed in the right place. There should be a file
119 present called /usr/share/maas/maas/urls.py119 present called /usr/share/maas/maas/urls.py
120
121**Debugging ephemeral image**
122=============================
123
124Backdoor (add a login) to ephemeral images
125------------------------------------------
126
127If you cannot login to an instance, you might have to "backdoor it" in order
128to see what is going wrong. Scott Moser wrote a simple utility that injects a
129user and password into an image. Here's how to add a 'backdoor' user with a
130password to your images.
131
132
133``bzr branch lp:~maas-maintainers/maas/backdoor-image``
134
135``imgs=$(echo var/lib/maas/ephemeral/*/*/*/*/*.img)
136for img in $imgs; do
137 [ -f "$img.dist" ] || cp -a --sparse=always $img $img.dist
138done
139
140for img in $imgs; do
141 sudo ./backdoor-image -v --user=backdoor --password-auth --password=ubuntu
142done``
143
144Inside the ephemeral image
145--------------------------
146
147Important files for debugging (Someone is likely to ask you for these
148things to help debug):
149
150``/var/log/cloud-init.log``
151``/var/log/boot.log``
152``/var/log/cloud-init-output.log``
153
154After enlistment or commissioning, the user-data from maas instructs the system
155to power off. To stop that from happening, you can just create a file in /tmp.
156
157
158``touch /tmp/block-poweroff``
159
160MAAS credentials
161----------------
162
163MAAS credentials can be found in 2 places:
164
165 #. from the cmdline you'll see a 'url=' or 'cloud-config-url=' parameter
166 You can get the cloud-config from that url, which will have credentials.
167
168 ``sed -n 's,.*url=\([^ ]*\).*,\1,p' /proc/cmdline
169 http://10.55.60.194/MAAS/metadata/latest/enlist-preseed/?op=get_enlist_preseed``
170
171 #. from /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url. The file was pulled
172 from url= parameter by cloud-init
173
174 ``sudo cat /etc/cloud/cloud.cfg.d/91_kernel_cmdline``
175
176MAAS datasource
177---------------
178
179The cloud-init datasource for MAAS can be invoked as a 'main' for debugging
180purposes. To do so, you need to know the url for the MAAS datasource and a
181config file that contains credentials.
182
183
184 ``cfg=$(echo /etc/cloud/cloud.cfg.d/*_cmdline_url.cfg)``
185 ``echo $cfg /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url.cfg``
186
187Now get the metadata_url from there.
188
189 ``url=$(sudo awk '$1 == "metadata_url:" { print $2 }' $cfg)``
190 ``echo $url http://10.55.60.194/MAAS/metadata/enlist``
191
192Invoke the client /usr/share/pyshared/cloudinit/sources/DataSourceMAAS.py
193The client has --help Usage also, but here is an example of how to use it:
194
195 ``maasds="/usr/share/pyshared/cloudinit/sources/DataSourceMAAS.py"``
196 ``sudo python $maasds --config=$cfg get $url``
197 == http://10.55.60.194/MAAS/metadata/enlist ==
198 2012-03-01
199 latest
200
201 ``sudo python $maasds --config=$cfg get $url/latest/meta-data/local-hostname``
202 maas-enlisting-node