[Openstack-operators] [Openstack] diskimage-builder: prepare ubuntu 17.x images

Volodymyr Litovka doka.ua at gmx.com
Fri Feb 9 11:03:40 UTC 2018


Hi Tony,

On 2/9/18 6:01 AM, Tony Breeds wrote:
> On Thu, Feb 08, 2018 at 10:53:14PM +0200, Volodymyr Litovka wrote:
>> 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.
> 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.
good idea, but with

export DIST="ubuntu-minimal"
export DIB_RELEASE=artful

diskimage-builder fails with the following debug:

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
2018-02-09 10:33:22.427 | + source 
/tmp/in_target.d/pre-install.d/../environment.d/10-dib-init-system.bash
2018-02-09 10:33:22.427 | ++++ dirname 
/tmp/in_target.d/pre-install.d/../environment.d/10-dib-init-system.bash
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/..'
2018-02-09 10:33:22.428 | +++ dib-init-system
2018-02-09 10:33:22.429 | + set -eu
2018-02-09 10:33:22.429 | + set -o pipefail
2018-02-09 10:33:22.429 | + '[' -f /usr/bin/systemctl -o -f 
/bin/systemctl ']'
2018-02-09 10:33:22.429 | + [[ -f /sbin/initctl ]]
2018-02-09 10:33:22.429 | + [[ -f /etc/gentoo-release ]]
2018-02-09 10:33:22.429 | + [[ -f /sbin/init ]]
2018-02-09 10:33:22.429 | + echo 'Unknown init system'
2018-02-09 10:36:54.852 | + exit 1
2018-02-09 10:36:54.853 | ++ DIB_INIT_SYSTEM='Unknown init system

while earlier it find systemd

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
2018-02-09 10:33:22.223 | + source 
/tmp/dib_build.fJUf6F4d/hooks/extra-data.d/../environment.d/10-dib-init-system.bash
2018-02-09 10:33:22.223 | ++++ dirname 
/tmp/dib_build.fJUf6F4d/hooks/extra-data.d/../environment.d/10-dib-init-system.bash
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/..
2018-02-09 10:33:22.224 | +++ dib-init-system
2018-02-09 10:33:22.225 | + set -eu
2018-02-09 10:33:22.225 | + set -o pipefail
2018-02-09 10:33:22.225 | + '[' -f /usr/bin/systemctl -o -f 
/bin/systemctl ']'
2018-02-09 10:33:22.225 | + echo systemd
2018-02-09 10:33:22.226 | ++ DIB_INIT_SYSTEM=systemd
2018-02-09 10:33:22.226 | ++ export DIB_INIT_SYSTEM

it seems somewhere in the middle something happens to systemd package
> 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
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:

sudo tar -C $TARGET_ROOT --numeric-owner -xzf 
$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE

probably, the easiest hack around the issue is to change above to smth like

sudo (
mount -o loop <image> <mount point>
tar cv  <mount point> | tar xv -C $TARGET_ROOT ...
)

Will try this.

-- 
Volodymyr Litovka
   "Vision without Execution is Hallucination." -- Thomas Edison

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20180209/9e7e61e4/attachment.html>


More information about the OpenStack-operators mailing list