← Back to team overview

maas-devel team mailing list archive

Re: ephemeral image debugging

 

On Fri, Jan 18, 2013 at 3:48 PM, Diogo Matsubara <matsubara@xxxxxxxxxxxxx>wrote:

>
>
>
> On Fri, Jan 18, 2013 at 1:39 PM, Scott Moser <smoser@xxxxxxxxxx> wrote:
>
>> On Fri, 18 Jan 2013, Diogo Matsubara wrote:
>>
>> > I added these instructions to the wiki:
>> > https://wiki.canonical.com/Launchpad/MAASTesting
>>
>> As this is a public list, is there a publicly available document like
>> this?
>>
>
> Good point! The MAASTesting doc contains information about our internal QA
> lab, so it won't be useful for the general public. I agree the debugging
> info is more generally useful for any MAAS user, so I'll talk to Nick to
> have this added to the official documentation on
> http://maas.ubuntu.com/docs/troubleshooting.html
>

It's up for review:

https://code.launchpad.net/~matsubara/maas/ephemeral-img-debugging-doc/+merge/143927

Soon this will be in the official docs.

Cheers,

Diogo

 >
>> > Thanks Scott!
>> >
>> >
>> > On Thu, Jan 17, 2013 at 12:08 PM, Diogo Matsubara
>> > <matsubara@xxxxxxxxxxxxx>wrote:
>> >
>> > > Hi Scott,
>> > >
>> > > thanks for these instructions, they're very useful.
>> > > There are two small corrections to the script you sent below:
>> > >
>> > > On Thu, Dec 13, 2012 at 12:35 PM, Scott Moser <smoser@xxxxxxxxxx>
>> wrote:
>> > >
>> > >> Hey all,
>> > >>
>> > >> Whenever people have problems with enlistment or commissioning, often
>> > >> times debugging from within the ephemeral image is needed to see
>> whats
>> > >> going on.
>> > >>
>> > >> Below is a general "how to get around" guide.
>> > >>
>> > >> ### backdoor (add a login) to ephemeral images ###
>> > >> # If you cannot login to an instance, you might have to "backdoor it"
>> > >> # in order to see what is going wrong.  I wrote a simple utility
>> > >> # that injects a user and password into an image.  Heres how to
>> > >> # add a 'backdoor' user with a password to your images.
>> > >> bzr branch lp:~smoser/+junk/backdoor-image
>> > >> imgs=$(echo var/lib/maas/ephemeral/*/*/*/*/*.img)
>> > >> for img in $imgs; do
>> > >>   [ -f "$img.dist" ] || cp -a --sparse=always $img.dist
>> > >> done
>> > >>
>> > >
>> > > I assume you wanted to make a backup copy of the original image
>> files. The
>> > > cp command is missing an argument though:
>> > >
>> > >    [ -f "$img.dist" ] || cp -a --sparse=always $img $img.dist
>> > >
>> > > Is that the original intention?
>> > >
>> > >
>> > > for img in $imgs; do
>> > >>   sudo ./backdoor-image -v --user=backdoor --password-auth
>> > >> --password=ubuntu
>> > >> done
>> > >>
>> > >
>> > > Likewise here:
>> > >   sudo ./backdoor-image -v --user=backdoor --password-auth
>> > > --password=ubuntu $img
>> > >
>> > >
>> > >
>> > >>
>> > >> ### Inside the ephemeral image  ###
>> > >>
>> > >> ## Important files for debugging:
>> > >> # Someone is likely to ask you for these things to help debug
>> > >> /var/log/cloud-init.log
>> > >> /var/log/boot.log
>> > >> /var/log/cloud-init-output.log
>> > >>
>> > >> # After enlistment or commissioning, the user-data from maas
>> instructs
>> > >> # the system to poweroff.  To stop that from happening, you can just
>> > >> # touch a file in /tmp.
>> > >> touch /tmp/block-poweroff
>> > >>
>> > >> ## maas credentials:
>> > >> # maas credentials can be found in 2 places:
>> > >> # * from the cmdline you'll see a 'url=' or 'cloud-config-url='
>> parameter
>> > >> #   You can get the cloud-config from that url, which will have
>> > >> #   credentials.
>> > >> #   example:
>> > >> #    $ sed -n 's,.*url=\([^ ]*\).*,\1,p' /proc/cmdline
>> > >> #
>> > >>
>> http://10.55.60.194/MAAS/metadata/latest/enlist-preseed/?op=get_enlist_preseed
>> > >> # * from /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url
>> > >> #   The file was pulled from url= parameter by cloud-init
>> > >> #   $ sudo cat /etc/cloud/cloud.cfg.d/91_kernel_cmdline
>> > >>
>> > >> ### maas datasource ###
>> > >> # the cloud-init datasource for MAAS can be invoked as a 'main' for
>> > >> # debugging purposes. To do so, you need to know the url for the maas
>> > >> # datasource and a config file that contains credentials.
>> > >> #
>> > >> $ cfg=$(echo /etc/cloud/cloud.cfg.d/*_cmdline_url.cfg)
>> > >> $ echo $cfg
>> > >> /etc/cloud/cloud.cfg.d/91_kernel_cmdline_url.cfg
>> > >>
>> > >> # now get the metadata_url from there.
>> > >> $ url=$(sudo awk '$1 == "metadata_url:" { print $2 }' $cfg)
>> > >> $ echo $url
>> > >> http://10.55.60.194/MAAS/metadata/enlist
>> > >>
>> > >> # invoke the client
>> > >> # /usr/share/pyshared/cloudinit/sources/DataSourceMAAS.py
>> > >> # the client has --help Usage also, but here is an example on how
>> > >> # to use it.
>> > >> $ maasds="/usr/share/pyshared/cloudinit/sources/DataSourceMAAS.py"
>> > >> $ sudo python $maasds --config=$cfg get $url
>> > >> == http://10.55.60.194/MAAS/metadata/enlist ==
>> > >> 2012-03-01
>> > >> latest
>> > >>
>> > >> $ sudo python $maasds --config=$cfg get
>> > >> $url/latest/meta-data/local-hostname
>> > >> maas-enlisting-node
>> > >>
>> > >> --
>> > >> Mailing list: https://launchpad.net/~maas-devel
>> > >> Post to     : maas-devel@xxxxxxxxxxxxxxxxxxx
>> > >> Unsubscribe : https://launchpad.net/~maas-devel
>> > >> More help   : https://help.launchpad.net/ListHelp
>> > >>
>> > >
>> > > Cheers,
>> > > --
>> > > Diogo M. Matsubara
>> > >
>> >
>> >
>> >
>> > --
>> > Diogo M. Matsubara
>> >
>>
>
>
>
> --
> Diogo M. Matsubara
>



-- 
Diogo M. Matsubara

References