From e9e7ac2ee1dc2bd4ff89c438cc60efeea3ea8091 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Sat, 17 Feb 2018 13:09:39 -0500 Subject: [PATCH] Install systemd earlier for Ubuntu Bionic Like we did in https://review.openstack.org/475206 we need to install systemd sooner because of the new world order of containers. Change-Id: Ia60d751fee3af6f8d72ad664107acb337360feca Signed-off-by: Paul Belanger --- .../elements/ubuntu-minimal/README.rst | 3 +++ .../root.d/75-ubuntu-minimal-baseinstall | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/elements/ubuntu-minimal/README.rst b/diskimage_builder/elements/ubuntu-minimal/README.rst index f492ca3b..44e70127 100644 --- a/diskimage_builder/elements/ubuntu-minimal/README.rst +++ b/diskimage_builder/elements/ubuntu-minimal/README.rst @@ -11,4 +11,7 @@ setting can be found in the element's ``environment.d`` directory in the variable ``DIB_RELEASE``. If a different release of Ubuntu should be created, the variable ``DIB_RELEASE`` can be set appropriately. +Note that this element installs ``systemd-sysv`` as the init system for +18.04+. + .. element_deps:: diff --git a/diskimage_builder/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall b/diskimage_builder/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall index 24c80fa4..1835e197 100755 --- a/diskimage_builder/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall +++ b/diskimage_builder/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall @@ -41,13 +41,25 @@ $apt_get update $apt_get clean $apt_get dist-upgrade -y -$apt_get install -y busybox sudo +to_install="" + +# pre-bionic (18.04) brought this in via debootstrap, but init +# dependencies have narrowed in the container world, so now we add it +# explicitly here so it's brought in early. +if [ $DIB_RELEASE != "trusty" ] && [ $DIB_RELEASE != "xenial" ]; then + to_install+="systemd-sysv " +fi + +# default required +to_install+="busybox sudo " # dib-lint: safe_sudo if [ "$DIB_PYTHON_VERSION" == "2" ]; then - $apt_get install -y python + to_install+="python " elif [ "$DIB_PYTHON_VERSION" == "3" ]; then - $apt_get install -y python3 + to_install+="python3 " else echo "ERROR: DIB_PYTHON_VERSION is '$DIB_PYTHON_VERSION' but needs to be 2 or 3" exit 1 fi + +$apt_get install -y $to_install