diff options
author | Alex Kiernan <alex.kiernan@gmail.com> | 2019-05-08 16:57:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-09 16:31:55 +0100 |
commit | 7e5124a44c8d589b2dffc1d083653dc3b084d082 (patch) | |
tree | d87c208e9064a4beadea570089ce4403d558dc52 /meta/recipes-core | |
parent | 2278d8ef6559de3e47131136e298531b4bbc48d0 (diff) | |
download | poky-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/recipes-core')
-rwxr-xr-x | meta/recipes-core/systemd/systemd-systemctl/systemctl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index d7d4e0d29a..7fdaf8ce03 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl | |||
@@ -241,6 +241,15 @@ def preset_all(root): | |||
241 | if state == "enable" or state is None: | 241 | if state == "enable" or state is None: |
242 | enable(root, service, location, services) | 242 | enable(root, service, location, services) |
243 | 243 | ||
244 | # If we populate the systemd links we also create /etc/machine-id, which | ||
245 | # allows systemd to boot with the filesystem read-only before generating | ||
246 | # a real value and then committing it back. | ||
247 | # | ||
248 | # For the stateless configuration, where /etc is generated at runtime | ||
249 | # (for example on a tmpfs), this script shouldn't run at all and we | ||
250 | # allow systemd to completely populate /etc. | ||
251 | (root / SYSCONFDIR / "machine-id").touch() | ||
252 | |||
244 | 253 | ||
245 | def mask(root, *services): | 254 | def mask(root, *services): |
246 | systemdir = root / SYSCONFDIR / "systemd" / "system" | 255 | systemdir = root / SYSCONFDIR / "systemd" / "system" |