From 06366f571731acafdb3858859951f294fef7d358 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 20 Jan 2026 11:58:17 +0000 Subject: [PATCH] switch-root: Ensure sysctl is run again after switching root Dracut normally copies all sysctl config to the initrd, but we may want to exclude platform-specific config because the initrd is shared between platforms. That config can be picked up from the OEM sysext after switching root. Signed-off-by: James Le Cuirot --- dracut/99switch-root/module-setup.sh | 5 +++++ dracut/99switch-root/rerun.conf | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 dracut/99switch-root/rerun.conf diff --git a/dracut/99switch-root/module-setup.sh b/dracut/99switch-root/module-setup.sh index 251b3b6..2592747 100755 --- a/dracut/99switch-root/module-setup.sh +++ b/dracut/99switch-root/module-setup.sh @@ -13,4 +13,9 @@ install() { "${systemdsystemunitdir}/initrd-parse-etc.service.d/override.conf" inst_simple "${moddir}/nocgroup.conf" \ "/etc/systemd/system.conf.d/nocgroup.conf" + + # Ensure sysctl is run again after switching root to pick up any sysctl + # files that are deliberately missing from the initrd. + inst_simple "${moddir}/rerun.conf" \ + "${systemdsystemunitdir}/systemd-sysctl.service.d/rerun.conf" } diff --git a/dracut/99switch-root/rerun.conf b/dracut/99switch-root/rerun.conf new file mode 100644 index 0000000..74ae991 --- /dev/null +++ b/dracut/99switch-root/rerun.conf @@ -0,0 +1,2 @@ +[Service] +RemainAfterExit=no