From a0f747932d0ef321355f62205d2e47b93ddc06dd Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 19 Jun 2017 11:35:14 +1000 Subject: [PATCH] Install systemd earlier for Stretch Debian Stretch released as stable recently, and the init system is less tightly specified in the base dependencies (for some info, see [1]). It seems, probably unintentionally, that in the previous release systemd-sysv was brought in by debootstrap, but that is no longer happening. Add systemd as an early dependency of debian-minimal. Remove the package-installs.yaml as that happens too late (other things need to know the init system to write out service files, etc and probe for systemd utils before package-installs). As mentioned, I do not believe the "only install systemd on testing" idea was actually working here, because it was being brought in during the initial debootstrap. Update some documentation to explain what's going on [1] https://lists.debian.org/debian-boot/2015/05/msg00156.html Change-Id: Id67c0cf08728407d234976f9807d3bd71d12f758 --- .../elements/debian-minimal/README.rst | 2 ++ .../debian-minimal/package-installs.yaml | 2 -- .../elements/debian-minimal/pkg-map | 14 -------------- .../root.d/75-debian-minimal-baseinstall | 18 +++++++++++++++--- .../elements/debian-systemd/README.rst | 3 +++ .../elements/debian-upstart/README.rst | 3 +++ 6 files changed, 23 insertions(+), 19 deletions(-) delete mode 100644 diskimage_builder/elements/debian-minimal/pkg-map diff --git a/diskimage_builder/elements/debian-minimal/README.rst b/diskimage_builder/elements/debian-minimal/README.rst index bc1253a0..f7bd9eb8 100644 --- a/diskimage_builder/elements/debian-minimal/README.rst +++ b/diskimage_builder/elements/debian-minimal/README.rst @@ -11,4 +11,6 @@ setting can be found in the element's ``environment.d`` directory in the variable ``DIB_RELEASE``. If a different release of Debian should be created, the variable ``DIB_RELEASE`` can be set appropriately. +Note that this element installs ``systemd-sysv`` as the init system + .. element_deps:: diff --git a/diskimage_builder/elements/debian-minimal/package-installs.yaml b/diskimage_builder/elements/debian-minimal/package-installs.yaml index 9e08e6a5..bc0d6838 100644 --- a/diskimage_builder/elements/debian-minimal/package-installs.yaml +++ b/diskimage_builder/elements/debian-minimal/package-installs.yaml @@ -2,5 +2,3 @@ linux-image-amd64: arch: amd64 linux-image-686: arch: i386 -systemd: -systemd-sysv: diff --git a/diskimage_builder/elements/debian-minimal/pkg-map b/diskimage_builder/elements/debian-minimal/pkg-map deleted file mode 100644 index 281ae60d..00000000 --- a/diskimage_builder/elements/debian-minimal/pkg-map +++ /dev/null @@ -1,14 +0,0 @@ -{ - "release": { - "debian": { - "testing": { - "systemd": "systemd", - "systemd-sysv": "systemd-sysv" - } - } - }, - "default": { - "systemd": "", - "systemd-sysv": "" - } -} diff --git a/diskimage_builder/elements/debian-minimal/root.d/75-debian-minimal-baseinstall b/diskimage_builder/elements/debian-minimal/root.d/75-debian-minimal-baseinstall index 7c967e69..ceb51bf1 100755 --- a/diskimage_builder/elements/debian-minimal/root.d/75-debian-minimal-baseinstall +++ b/diskimage_builder/elements/debian-minimal/root.d/75-debian-minimal-baseinstall @@ -16,6 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# dib-lint: disable=safe_sudo + if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then set -x fi @@ -54,13 +56,23 @@ $apt_get update $apt_get clean $apt_get dist-upgrade -y -$apt_get install -y busybox sudo +to_install="" + +# pre-stretch (9.0) 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. +to_install+="systemd-sysv " + +# default required +to_install+="busybox 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 diff --git a/diskimage_builder/elements/debian-systemd/README.rst b/diskimage_builder/elements/debian-systemd/README.rst index 59623a2b..01653199 100644 --- a/diskimage_builder/elements/debian-systemd/README.rst +++ b/diskimage_builder/elements/debian-systemd/README.rst @@ -4,4 +4,7 @@ debian-systemd You may want to use `systemd` instead of the classic sysv init system. In this case, include this element in your element list. +Note that this works with the ``debian`` element, not the +``debian-minimal`` element. + .. element_deps:: diff --git a/diskimage_builder/elements/debian-upstart/README.rst b/diskimage_builder/elements/debian-upstart/README.rst index 73a61295..64aaaab3 100644 --- a/diskimage_builder/elements/debian-upstart/README.rst +++ b/diskimage_builder/elements/debian-upstart/README.rst @@ -5,4 +5,7 @@ By default Debian will use sysvinit for booting. If you want to experiment with Upstart, or have need of it due to a need for upstart jobs, this element will build the image with upstart as the init system. +Note that this works with the ``debian`` element, not the +``debian-minimal`` element. + .. element_deps::