<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Tony,<br>
<br>
this patch works for me:<br>
<br>
<tt>---
diskimage-builder/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball.orig
2018-02-09 12:20:02.117793234 +0000<br>
+++
diskimage-builder/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball
2018-02-09 13:25:48.654868263 +0000<br>
@@ -14,7 +14,9 @@<br>
<br>
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud-images.ubuntu.com}<br>
DIB_RELEASE=${DIB_RELEASE:-trusty}<br>
-BASE_IMAGE_FILE=${BASE_IMAGE_<a class="moz-txt-link-freetext" href="FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz">FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz</a>}<br>
+SUFFIX="-root"<br>
+[[ $DIB_RELEASE =~ (artful|bionic) ]] && SUFFIX=""<br>
+BASE_IMAGE_FILE=${BASE_IMAGE_<a class="moz-txt-link-freetext" href="FILE:-$DIB_RELEASE-server-cloudimg-$">FILE:-$DIB_RELEASE-server-cloudimg-$</a>{ARCH}${SUFFIX}.tar.gz}<br>
SHA256SUMS=${SHA256SUMS:-https://${DIB_CLOUD_IMAGES##http?(s)://}/$DIB_RELEASE/current/SHA256SUMS}<br>
CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE<br>
CACHED_FILE_LOCK=$DIB_LOCKFILES/$BASE_IMAGE_FILE.lock<br>
@@ -45,9 +47,25 @@<br>
fi<br>
popd<br>
fi<br>
- # Extract the base image (use --numeric-owner to avoid
UID/GID mismatch between<br>
- # image tarball and host OS e.g. when building Ubuntu image
on an openSUSE host)<br>
- sudo tar -C $TARGET_ROOT --numeric-owner -xzf
$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE<br>
+ if [ -n "$SUFFIX" ]; then<br>
+ # Extract the base image (use --numeric-owner to avoid
UID/GID mismatch between<br>
+ # image tarball and host OS e.g. when building Ubuntu image
on an openSUSE host)<br>
+ sudo tar -C $TARGET_ROOT --numeric-owner -xzf
$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE<br>
+ else<br>
+ # Unpack image to IDIR, mount it on MDIR, copy it to
TARGET_ROOT<br>
+ IDIR="/tmp/`head /dev/urandom | tr -dc A-Za-z0-9 | head -c
13 ; echo ''`"<br>
+ MDIR="/tmp/`head /dev/urandom | tr -dc A-Za-z0-9 | head -c
13 ; echo ''`"<br>
+ sudo mkdir $IDIR $MDIR<br>
+ sudo tar -C $IDIR --numeric-owner -xzf
$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE<br>
+ sudo mount -o loop -t auto
$IDIR/$DIB_RELEASE-server-cloudimg-${ARCH}.img $MDIR<br>
+ pushd $PWD 2>/dev/null<br>
+ cd $MDIR<br>
+ sudo tar c . | sudo tar x -C $TARGET_ROOT -k
--numeric-owner 2>/dev/null<br>
+ popd<br>
+ # Clean up<br>
+ sudo umount $MDIR<br>
+ sudo rm -rf $IDIR $MDIR<br>
+ fi<br>
}<br>
<br>
(</tt><br>
<br>
<br>
<div class="moz-cite-prefix">On 2/9/18 1:03 PM, Volodymyr Litovka
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:687756ea-1989-418d-73d7-614a501078d7@gmx.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
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>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Volodymyr Litovka
"Vision without Execution is Hallucination." -- Thomas Edison</pre>
</body>
</html>