Skip to content

Commit 1e4bc73

Browse files
committed
build_sysext: Trigger udev when sysext includes udev rules
This fixes the zfs sysext, which tried to delay udevd until after the sysext is merged, but that recently broke. We probably can't order things that way round any more. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
1 parent b802d38 commit 1e4bc73

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎build_library/sysext_mangle_flatcar-zfs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ d /etc/zfs 0755 root root -
3535
L /etc/zfs/zed.d - - - - /usr/share/zfs/etc/zfs/zed.d
3636
L /etc/zfs/zfs-functions - - - - /usr/share/zfs/etc/zfs/zfs-functions
3737
L /etc/zfs/zpool.d - - - - /usr/share/zfs/etc/zfs/zpool.d
38-
C /etc/systemd/system/systemd-udevd.service.d/10-zfs.conf - - - - /usr/lib/systemd/system/systemd-udevd.service.d/10-zfs.conf
38+
r /etc/systemd/system/systemd-udevd.service.d/10-zfs.conf - - - - -
3939
EOF
4040

41-
mkdir -p ./usr/lib/systemd/system/systemd-udevd.service.d
42-
cat <<EOF >./usr/lib/systemd/system/systemd-udevd.service.d/10-zfs.conf
43-
[Unit]
44-
After=systemd-sysext.service
45-
EOF
4641
configure_modprobe flatcar-zfs
4742
popd

‎build_sysext‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,15 @@ done
292292
EXTENSION_RELOAD_MANAGER=0
293293
[[ -d ${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/systemd ]] && EXTENSION_RELOAD_MANAGER=1
294294

295+
EXTENSION_RESTART_UNITS=()
296+
[[ -d ${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/udev/rules.d ]] && EXTENSION_RESTART_UNITS+=( systemd-udev-trigger.service )
297+
295298
grep . <<EOF | install -m0644 -D /dev/stdin "${BUILD_DIR}/${FLAGS_install_root_basename}/usr/lib/extension-release.d/extension-release.${SYSEXT_ID}"
296299
ID='flatcar'
297300
${VERSION_FIELD_OVERRIDE:-VERSION_ID}=${FLATCAR_VERSION_ID@Q}
298301
ARCHITECTURE=${ARCH@Q}
299302
EXTENSION_RELOAD_MANAGER=${EXTENSION_RELOAD_MANAGER}
303+
EXTENSION_RESTART_UNITS='${EXTENSION_RESTART_UNITS[*]}'
300304
SYSEXT_ID=${SYSEXT_ID@Q}
301305
${SYSEXT_NAME:+SYSEXT_NAME=${SYSEXT_NAME@Q}}
302306
${PVR:+SYSEXT_VERSION_ID=${PVR@Q}}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ EOF
168168

169169
[Service]
170170
SystemCallFilter=@mount
171+
EOF
172+
)
173+
174+
(
175+
insinto "$(systemd_get_systemunitdir)/systemd-udev-trigger.service.d"
176+
newins - flatcar.conf <<'EOF'
177+
# Ensure udev rules are reloaded before triggering events with them because
178+
# udevd caches its rules for 3 seconds. System extensions that include udev
179+
# rules need them immediately loaded before triggering.
180+
181+
[Service]
182+
ExecStartPre=-udevadm control --reload
171183
EOF
172184
)
173185
}

0 commit comments

Comments
 (0)