summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2019-05-08 16:57:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-09 16:31:55 +0100
commit7e5124a44c8d589b2dffc1d083653dc3b084d082 (patch)
treed87c208e9064a4beadea570089ce4403d558dc52 /meta/classes
parent2278d8ef6559de3e47131136e298531b4bbc48d0 (diff)
downloadpoky-7e5124a44c8d589b2dffc1d083653dc3b084d082.tar.gz
systemd: Default to non-stateless images
When creating images, for anything other than the explicitly stateless case, touch /etc/machine-id so that the images can be booted without an initramfs and with `ro` set on the kernel command line, otherwise system refuses to start: [ 7.222134] systemd[1]: No hostname configured. [ 7.227266] systemd[1]: Set hostname to <localhost>. [ 7.232622] systemd[1]: System cannot boot: Missing /etc/machine-id and /etc is mounted read-only. [ 7.241750] systemd[1]: Booting up is supported only when: [ 7.247362] systemd[1]: 1) /etc/machine-id exists and is populated. [ 7.253752] systemd[1]: 2) /etc/machine-id exists and is empty. [ 7.259757] systemd[1]: 3) /etc/machine-id is missing and /etc is writable. If IMAGE_FEATURES includes `stateless-rootfs` then systemctl-native is not run on the image leaving the image for population at runtime by systemd. (From OE-Core rev: c5fb399f5894c16cf8eeadd507dc38c29b0fd657) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/image.bbclass9
1 files changed, 4 insertions, 5 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index a23403c082..d2b2fb979e 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -33,7 +33,7 @@ INHIBIT_DEFAULT_DEPS = "1"
33# IMAGE_FEATURES may contain any available package group 33# IMAGE_FEATURES may contain any available package group
34IMAGE_FEATURES ?= "" 34IMAGE_FEATURES ?= ""
35IMAGE_FEATURES[type] = "list" 35IMAGE_FEATURES[type] = "list"
36IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password allow-empty-password allow-root-login post-install-logging" 36IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs stateless-rootfs empty-root-password allow-empty-password allow-root-login post-install-logging"
37 37
38# Generate companion debugfs? 38# Generate companion debugfs?
39IMAGE_GEN_DEBUGFS ?= "0" 39IMAGE_GEN_DEBUGFS ?= "0"
@@ -665,12 +665,11 @@ reproducible_final_image_task () {
665 fi 665 fi
666} 666}
667 667
668IMAGE_EXTRADEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
669
670systemd_preset_all () { 668systemd_preset_all () {
671 systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all 669 systemctl --root="${IMAGE_ROOTFS}" --preset-mode=enable-only preset-all
672} 670}
673 671
674IMAGE_PREPROCESS_COMMAND_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd_preset_all;', '', d)} reproducible_final_image_task; " 672IMAGE_EXTRADEPENDS += "${@ 'systemd-systemctl-native' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''}"
673IMAGE_PREPROCESS_COMMAND_append = " ${@ 'systemd_preset_all;' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and not bb.utils.contains('IMAGE_FEATURES', 'stateless-rootfs', True, False, d) else ''} reproducible_final_image_task; "
675 674
676CVE_PRODUCT = "" 675CVE_PRODUCT = ""