Skip to content

Commit 7072d08

Browse files
authored
Merge pull request #3555 from flatcar/kai/default-confext
Switch /etc to use confext in mutable mode
2 parents ce6f63d + 01eea0f commit 7072d08

26 files changed

Lines changed: 2767 additions & 74 deletions

‎build_library/build_image_util.sh‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,35 @@ EOF
743743
if [[ $(sudo find "${root_fs_dir}/usr/share/flatcar/etc" -size +0 ! -type d 2>/dev/null | wc -l) -gt 0 ]]; then
744744
die "Unexpected non-empty files in ${root_fs_dir}/usr/share/flatcar/etc"
745745
fi
746+
# Some backwards-compat symlinks still use this folder as target,
747+
# we can't remove it yet
746748
sudo rm -rf "${root_fs_dir}/usr/share/flatcar/etc"
747749
sudo cp -a "${root_fs_dir}/etc" "${root_fs_dir}/usr/share/flatcar/etc"
748-
749-
# Remove the rootfs state as it should be recreated through the
750-
# tmpfiles and may not be present on updating machines. This
751-
# makes sure our tests cover the case of missing files in the
750+
# Now set up a default confext and enable it.
751+
# It's important to use dm-verity not only for stricter image policies
752+
# but also because it allows us the refresh to identify this image and
753+
# skip setting it up again in the final boot, which not only saves us
754+
# a daemon-reload during boot but also from /etc contents shortly
755+
# disappearing until systemd-sysext uses mount beneath for an atomic
756+
# remount. Instead of a temporary directory we first prepare it as
757+
# folder and then convert it to a DDI and remove the folder.
758+
sudo rm -rf "${root_fs_dir}/usr/lib/confexts/00-flatcar-default"
759+
sudo mkdir -p "${root_fs_dir}/usr/lib/confexts/00-flatcar-default"
760+
# Do a copy because we keep /etc for the flatcar (.tar) container and the developer container
761+
sudo cp -a "${root_fs_dir}/etc" "${root_fs_dir}/usr/lib/confexts/00-flatcar-default/etc"
762+
sudo mkdir -p "${root_fs_dir}/usr/lib/confexts/00-flatcar-default/etc/extension-release.d/"
763+
echo ID=_any | sudo tee "${root_fs_dir}/usr/lib/confexts/00-flatcar-default/etc/extension-release.d/extension-release.00-flatcar-default" > /dev/null
764+
sudo systemd-repart \
765+
--private-key="${SYSEXT_SIGNING_KEY_DIR}/sysexts.key" \
766+
--certificate="${SYSEXT_SIGNING_KEY_DIR}/sysexts.crt" \
767+
--make-ddi=confext \
768+
--copy-source="${root_fs_dir}/usr/lib/confexts/00-flatcar-default" \
769+
"${root_fs_dir}/usr/lib/confexts/00-flatcar-default.raw"
770+
sudo rm -rf "${root_fs_dir}/usr/lib/confexts/00-flatcar-default"
771+
772+
# Remove the rootfs state as it should be recreated through tmpfiles
773+
# (and for /etc we use a confext) and may not be present on updating machines.
774+
# This makes sure our tests cover the case of missing files in the
752775
# rootfs and don't rely on the new image. Not done for the developer
753776
# container.
754777
if [[ -n "${image_kernel}" ]]; then

‎build_sysext‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ all_fields=(
288288
'ID=flatcar'
289289
"${version_field}"
290290
"ARCHITECTURE=${ARCH}"
291+
"EXTENSION_RELOAD_MANAGER=1"
291292
)
292293
printf '%s\n' "${all_fields[@]}" >"${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/extension-release.d/extension-release.${SYSEXTNAME}"
293294

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Switched `/etc/` from a custom overlayfs for A/B updates to using a systemd-confext extension providing the default contents by using systemd-confext in the mutable mode where `/etc/` gets used as upperdir [scripts#3555](https://github.com/flatcar/scripts/pull/3555)
2+
- Moved systemd-sysext image mounting into the initrd, so that system extensions can better define the behavior of the final system at boot without workarounds to apply settings late at boot. This means `.wants` symlinks for systemd units work as expected now and, therefore, we dropped the `ensure-sysext.service` workaround. We still recommend extensions to keep their workarounds, e.g., using `.upholds` instead of `.wants`, to better support live reloading. A skipping logic prevents an extension refresh late at boot but only if no changes were found. For extensions that are not stored on a custom filesystem, such as a separate `/var` partition, the new extension mounting from the initrd won't be able to load them early but they will be picked up late at boot through the extension refresh. This is another case where it's good if extensions keep workarounds for late loading.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- systemd (258.2)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DIST coreos-init-860090d932a0bcdf71a73619f270845a06b64af0.tar.gz 59420 BLAKE2B 4e68bf5e2f5d64a0c701cbfccf8641f362597073f599ad7e14816e6eb2167609b2312b81a40276736441f51cc1833677a985a3f8d81a21879b987028e60f8d0a SHA512 357f3ff2ac7e4f2ef412626674f8e81c71f38924b80d54fcdf23246c772373e6a6f9f940f66fcab19f09b759d547b7600c6fb97171c95db97e208392d66ce8ca
1+
DIST coreos-init-ca7b51b85e303d95a38bc6d20f459aac07439eb0.tar.gz 59695 BLAKE2B 02c67fa98ee0b97123cb322fb6eabacf7ae7a282914408a8246371552ed222cc3eb56f27d5c42230158a4f7907db9cdfd4b7f51e96995aac2a0f903ff34d034d SHA512 d1282837b52f550855e6c0990796e270c32d7b0882b062f401aff9c9eea7a7c8fba4f2a051f9c42be9316022fa8ee214dc28a8078b306577629d01d96e32d5e8

‎sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [[ ${PV} == 9999 ]]; then
1414
EGIT_REPO_URI="https://github.com/flatcar/init.git"
1515
inherit git-r3
1616
else
17-
EGIT_VERSION="860090d932a0bcdf71a73619f270845a06b64af0" # flatcar-master
17+
EGIT_VERSION="1660f54f79dbba285a64c52d3338f5566e1d770d" # flatcar-master
1818
SRC_URI="https://github.com/flatcar/init/archive/${EGIT_VERSION}.tar.gz -> ${PN}-${EGIT_VERSION}.tar.gz"
1919
S="${WORKDIR}/init-${EGIT_VERSION}"
2020
KEYWORDS="amd64 arm arm64 x86"

‎sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/systemd‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,6 @@ EOF
160160
-e '/^C!* \/etc\/pam\.d/d' \
161161
-e '/^C!* \/etc\/issue/d' || die
162162

163-
(
164-
# Some OEMs prefer chronyd, so allow them to replace
165-
# systemd-timesyncd with it.
166-
insinto "$(systemd_get_systemunitdir)/systemd-timesyncd.service.d"
167-
newins - flatcar.conf <<'EOF'
168-
# Allow sysexts to ship timesyncd replacements which can have
169-
# a Conflicts=systemd-timesyncd directive that would result
170-
# in systemd-timesyncd not being started.
171-
[Unit]
172-
After=ensure-sysext.service
173-
EOF
174-
)
175-
176163
(
177164
# Allow @mount syscalls for systemd-udevd.service
178165
insinto "$(systemd_get_systemunitdir)/systemd-udevd.service.d"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 6f4b065b626edd8a06ff0c8028173e060b5e444b Mon Sep 17 00:00:00 2001
2+
From: Kai Lueke <kailuke@microsoft.com>
3+
Date: Thu, 20 Nov 2025 23:43:55 +0900
4+
Subject: [PATCH 03/10] vpick: Don't use openat directly but resolve symlinks
5+
in given root
6+
7+
With systemd-sysext --root= all symlinks should be followed relative to
8+
the given root and direct openat usage doesn't work.
9+
Change the openat call to use the chase helper function to resolve the
10+
symlink in the given root.
11+
---
12+
src/shared/vpick.c | 4 ++--
13+
1 file changed, 2 insertions(+), 2 deletions(-)
14+
15+
diff --git a/src/shared/vpick.c b/src/shared/vpick.c
16+
index b1b2d93054..dfe58cafa5 100644
17+
--- a/src/shared/vpick.c
18+
+++ b/src/shared/vpick.c
19+
@@ -471,9 +471,9 @@ static int make_choice(
20+
if (!p)
21+
return log_oom_debug();
22+
23+
- object_fd = openat(dir_fd, best_filename, O_CLOEXEC|O_PATH);
24+
+ object_fd = chase_and_openat(toplevel_fd, p, CHASE_AT_RESOLVE_IN_ROOT, O_PATH|O_CLOEXEC, NULL);
25+
if (object_fd < 0)
26+
- return log_debug_errno(errno, "Failed to open '%s/%s': %m",
27+
+ return log_debug_errno(object_fd, "Failed to open '%s/%s': %m",
28+
empty_to_root(toplevel_path), skip_leading_slash(inode_path));
29+
30+
return pin_choice(
31+
--
32+
2.52.0
33+
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 4f4420815e5b51a481245db012a70e0d872ae368 Mon Sep 17 00:00:00 2001
1+
From 61ae07bbf1d7032eef32137b1fe299647602e3de Mon Sep 17 00:00:00 2001
22
From: David Michael <dm0@redhat.com>
33
Date: Tue, 16 Apr 2019 02:44:51 +0000
4-
Subject: [PATCH 1/8] wait-online: set --any by default
4+
Subject: [PATCH] wait-online: set --any by default
55

66
The systemd-networkd-wait-online command would normally continue
77
waiting after a network interface is usable if other interfaces are
@@ -11,22 +11,22 @@ Preserve previous Container Linux behavior for compatibility by
1111
setting the --any flag by default. See patches from v241 (or
1212
earlier) for the original implementation.
1313
---
14-
src/network/wait-online/wait-online.c | 2 +-
15-
1 file changed, 1 insertion(+), 1 deletion(-)
14+
src/network/wait-online/wait-online.c | 3 ++-
15+
1 file changed, 2 insertions(+), 1 deletion(-)
1616

1717
diff --git a/src/network/wait-online/wait-online.c b/src/network/wait-online/wait-online.c
18-
index 6f5aef903a..0acb3e76b9 100644
18+
index b1d0b9cde2..e07c11d807 100644
1919
--- a/src/network/wait-online/wait-online.c
2020
+++ b/src/network/wait-online/wait-online.c
21-
@@ -21,7 +21,7 @@ static Hashmap *arg_interfaces = NULL;
21+
@@ -24,7 +24,7 @@ static Hashmap *arg_interfaces = NULL;
2222
static char **arg_ignore = NULL;
2323
static LinkOperationalStateRange arg_required_operstate = LINK_OPERSTATE_RANGE_INVALID;
2424
static AddressFamily arg_required_family = ADDRESS_FAMILY_NO;
2525
-static bool arg_any = false;
2626
+static bool arg_any = true;
27+
static bool arg_requires_dns = false;
2728

28-
STATIC_DESTRUCTOR_REGISTER(arg_interfaces, hashmap_free_free_freep);
29-
STATIC_DESTRUCTOR_REGISTER(arg_ignore, strv_freep);
29+
STATIC_DESTRUCTOR_REGISTER(arg_interfaces, hashmap_freep);
3030
--
31-
2.52.0
31+
2.51.0
3232

0 commit comments

Comments
 (0)