<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Tony,<br>
    <br>
    <div class="moz-cite-prefix">On 2/9/18 6:01 AM, Tony Breeds wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20180209040147.GR23143@thor.bakeyournoodle.com">
      <pre wrap="">On Thu, Feb 08, 2018 at 10:53:14PM +0200, Volodymyr Litovka wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Hi colleagues,

does anybody here know how to prepare Ubuntu Artful (17.10) image using
diskimage-builder?

diskimage-builder use the following naming style for download -
$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz

and while "-root" names are there for trusty/amd64 and xenial/amd64 distros,
these archives for artful (and bionic) are absent on
cloud-images.ubuntu.com. There are just different kinds of images, not
source tree as in -root archives.

I will appreciate any ideas or knowledge how to customize 17.10-based image
using diskimage-builder or in diskimage-builder-like fashion.
</pre>
      </blockquote>
      <pre wrap="">
You might like to investigate the ubuntu-minimal DIB element which will
build your ubuntu image from apt rather than starting with the pre-built
image.</pre>
    </blockquote>
    good idea, but with<br>
    <br>
    <tt>export DIST="ubuntu-minimal"</tt><tt><br>
    </tt><tt>export DIB_RELEASE=artful</tt><br>
    <br>
    diskimage-builder fails with the following debug:<br>
    <br>
    <tt>2018-02-09 10:33:22.426 | dib-run-parts Sourcing environment
      file
      /tmp/in_target.d/pre-install.d/../environment.d/10-dib-init-system.bash</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.427 | + source
      /tmp/in_target.d/pre-install.d/../environment.d/10-dib-init-system.bash</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.427 | ++++ dirname
      /tmp/in_target.d/pre-install.d/../environment.d/10-dib-init-system.bash</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.428 | +++
PATH='$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/tmp/in_target.d/pre-install.d/../environment.d/..'</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.428 | +++ dib-init-system</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + set -eu</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + set -o pipefail</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + '[' -f /usr/bin/systemctl -o -f
      /bin/systemctl ']'</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + [[ -f /sbin/initctl ]]</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + [[ -f /etc/gentoo-release ]]</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + [[ -f /sbin/init ]]</tt><tt><br>
    </tt><tt>2018-02-09 10:33:22.429 | + echo 'Unknown init system'</tt><tt><br>
    </tt><tt>2018-02-09 10:36:54.852 | + exit 1</tt><tt><br>
    </tt><tt>2018-02-09 10:36:54.853 | ++ DIB_INIT_SYSTEM='Unknown init
      system<br>
      <br>
    </tt>while earlier it find systemd<tt><br>
      <br>
      2018-02-09 10:33:22.221 | dib-run-parts Sourcing environment file
/tmp/dib_build.fJUf6F4d/hooks/extra-data.d/../environment.d/10-dib-init-system.bash<br>
      2018-02-09 10:33:22.223 | + source
/tmp/dib_build.fJUf6F4d/hooks/extra-data.d/../environment.d/10-dib-init-system.bash<br>
      2018-02-09 10:33:22.223 | ++++ dirname
/tmp/dib_build.fJUf6F4d/hooks/extra-data.d/../environment.d/10-dib-init-system.bash<br>
      2018-02-09 10:33:22.224 | +++
PATH=/home/doka/DIB/dib/bin:/home/doka/DIB/dib/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/tmp/dib_build.fJUf6F4d/hooks/extra-data.d/../environment.d/..<br>
      2018-02-09 10:33:22.224 | +++ dib-init-system<br>
      2018-02-09 10:33:22.225 | + set -eu<br>
      2018-02-09 10:33:22.225 | + set -o pipefail<br>
      2018-02-09 10:33:22.225 | + '[' -f /usr/bin/systemctl -o -f
      /bin/systemctl ']'<br>
      2018-02-09 10:33:22.225 | + echo systemd<br>
      2018-02-09 10:33:22.226 | ++ DIB_INIT_SYSTEM=systemd<br>
      2018-02-09 10:33:22.226 | ++ export DIB_INIT_SYSTEM<br>
      <br>
    </tt>it seems somewhere in the middle something happens to systemd
    package<tt><br>
    </tt>
    <blockquote type="cite"
      cite="mid:20180209040147.GR23143@thor.bakeyournoodle.com">
      <pre wrap="">In the meantime I'll look at how we can consume the .img file, which is
similar to what we'd need to do for Fedora</pre>
    </blockquote>
    script
diskimage-builder/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball
    contains the function get_ubuntu_tarball() which, after all checks,
    does the following:<br>
    <br>
    <tt>sudo tar -C $TARGET_ROOT --numeric-owner -xzf
      $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE</tt><br>
    <br>
    probably, the easiest hack around the issue is to change above to
    smth like<br>
    <br>
    <tt>sudo (<br>
      mount -o loop <image> <mount point><br>
      tar cv  <mount point> | tar xv -C $TARGET_ROOT ...<br>
      )<br>
    </tt><br>
    Will try this.<br>
    <blockquote type="cite"
      cite="mid:20180209040147.GR23143@thor.bakeyournoodle.com">
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Volodymyr Litovka
  "Vision without Execution is Hallucination." -- Thomas Edison</pre>
  </body>
</html>