2

When customizing an Ubuntu 16.04 image for use with MAAS 2.0 there are no instructions available.

It looks like other people have had success but there are no steps available to repeat their success.

Steps I have tried are:

Get a copy of a known working image:

wget http://images.maas.io/ephemeral-v2/daily/xenial/amd64/20160914/root-image.gz

or from here: /var/lib/maas/boot-resources/cache

Mount the image to customize

gunzip root-image.gz
mkdir /tmp/image
mount root-image /tmp/image

Customize the image as you desire, umount and gzip it

umount /tmp/image
gzip root-image

Import this into MAAS

maas admin boot-resources create name="custom/my-custom-image" architecture="amd64/generic" subarches="generic" content@=/root/root-image.gz
maas admin boot-resources import

Next you deploy a node with this image but in my case this fails with the following output.

Cloud-init v. 0.7.8 running 'modules:config' at Mon, 26 Sep 2016 18:17:20 +0000. Up 14.84 seconds.
--2016-09-26 18:17:32--  http://10.40.0.250:5248/images/custom/amd64/generic/my-custom-image/uploaded/root-tgz
Connecting to 10.40.0.250:5248... connected.
HTTP request sent, awaiting response... 200 OK
Length: 211170553 (201M) [text/html]
Saving to: 'STDOUT'

     0K .....                                                  0% 19.0M=0.02s


Cannot write to '-' (Success).
Unexpected error while running command.
Command: ['chroot', '/tmp/tmpoa1mrw83/target', 'dpkg-query', '--list']
Exit code: 127
Reason: -
Stdout: ''
Stderr: "chroot: failed to run command 'dpkg-query': No such file or directory\n"
Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'curthooks']
Exit code: 3
Reason: -
Stdout: b'Unexpected error while running command.\nCommand: [\'chroot\', \'/tmp/tmpoa1mrw83/target\', \'dpkg-query\', \'--list\']\nExit code: 127\nReason: -\nStdout: \'\'\nStderr: "chroot: failed to run command \'dpkg-query\': No such file or directory\\n"\n'
Stderr: ''
Unexpected error while running command.

This is related to: MAAS 2.0 importing custom images does not work

closed as unclear what you're asking by Panther, Elder Geek, TheWanderer, waltinator, Zanna Sep 27 '16 at 7:55

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You skipped a lot of steps in "Customize the image as you desire, umount and gzip it" lots of room for problems. I am not familiar with MAAS but there is a lot of work involved in customizing an image, general instructions here - help.ubuntu.com/community/LiveCDCustomization and also the debian live scripts – Panther Sep 26 '16 at 18:54
  • In my case it was a very simple change. Added a new user. I have just made a little progress. I replaced the root-tgz file in /var/lib/maas/boot-resources/current/ubuntu/amd64/generic/xenial/daily with my customized version and it works just fine. – Nepoc Sep 26 '16 at 20:08
0

My solution to the above turns out to be related to the file format.

This:

Customize the image as you desire, umount and gzip it

umount /tmp/image
gzip root-image

Should be:

Customize the image as you desire then:

cd /tmp/image
tar -cf /root/root-tgz ./*
gzip /root/root-tgz
mv /root/root-tgz.gz /root/root-tgz

(The last step there is optional)

I also changed the boot-resources create to:

maas admin boot-resources create name="custom/my-custom-image" architecture="amd64/generic" filetype=tgz title="My Custom Image" content@=/root/root-tgz

Not the answer you're looking for? Browse other questions tagged or ask your own question.