Source: dracut
Version: 060+5-8
Followup-For: Bug #1071182
Tags: patch
The following patch addresses the case where /usr and possibly /etc are
mounted read-only in the initrd, and therefore fixes the error messsages
mentioned in my previous email.
From: Holger Weiss
Date: Thu, 30 May 2024 21:14:59 +0200
Subject: [PATCH] Cope with /usr and/or /etc being mounted read-only
This fixes the remaining systemd 256 compatiblity issues mentioned in:
https://github.com/dracut-ng/dracut-ng/issues/253
---
debian/changelog| 6 +
debian/patches/move-hooks-to-var.patch | 66 +
debian/patches/move-modprobe.d-to-run.patch | 156
debian/patches/series | 2 +
4 files changed, 230 insertions(+)
create mode 100644 debian/patches/move-hooks-to-var.patch
create mode 100644 debian/patches/move-modprobe.d-to-run.patch
diff --git a/debian/changelog b/debian/changelog
index ac35fdaf..905feb14 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+dracut (060+5-9) unstable; urgency=low
+
+ * cope with /usr and/or /etc being mounted read-only in the initrd
+
+ -- Holger Weiss Thu, 30 May 2024 21:08:24 +0200
+
dracut (060+5-8) unstable; urgency=low
* control: adjust breaks, replaces, Closes: #1071208, #1071244
diff --git a/debian/patches/move-hooks-to-var.patch
b/debian/patches/move-hooks-to-var.patch
new file mode 100644
index ..7388726f
--- /dev/null
+++ b/debian/patches/move-hooks-to-var.patch
@@ -0,0 +1,66 @@
+Description: Move hooks directory from /usr/lib to /var/lib
+ Since https://github.com/systemd/systemd/commit/ffc1ec73, /usr is mounted as
+ read-only in the initramfs by default.
+Author: Laszlo Gombos
+Origin: upstream, https://github.com/dracut-ng/dracut-ng
+Bug: https://github.com/dracutdevs/dracut/issues/2588
+Applied-Upstream:
https://github.com/dracut-ng/dracut-ng/commit/a45048b80c27ee5a45a380052a6d29ab1925f7f9
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/dracut-init.sh
b/dracut-init.sh
+@@ -630,7 +630,7 @@
+ dfatal "No such hook type $1. Aborting initrd creation."
+ exit 1
+ fi
+-hook="/lib/dracut/hooks/${1}/${2}-${3##*/}"
++hook="/var/lib/dracut/hooks/${1}/${2}-${3##*/}"
+ inst_simple "$3" "$hook"
+ chmod u+x "$initdir/$hook"
+ }
+--- a/dracut.sh
b/dracut.sh
+@@ -1882,7 +1882,11 @@
+
+ if [[ $kernel_only != yes ]]; then
+ mkdir -p "${initdir}/etc/cmdline.d"
+-mkdir -m 0755 "${initdir}"/lib/dracut/hooks
++mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks
++
++# symlink to old hooks location for compatibility
++ln_r /var/lib/dracut/hooks /lib/dracut/hooks
++
+ for _d in $hookdirs; do
+ # shellcheck disable=SC2174
+ mkdir -m 0755 -p "${initdir}/lib/dracut/hooks/$_d"
+--- a/modules.d/99base/module-setup.sh
b/modules.d/99base/module-setup.sh
+@@ -45,7 +45,10 @@
+
+ [ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib
+ mkdir -m 0755 -p "${initdir}"/lib/dracut
+-mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks
++mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks
++
++# symlink to old hooks location for compatibility
++ln_r /var/lib/dracut/hooks /lib/dracut/hooks
+
+ mkdir -p "${initdir}"/tmp
+
+--- a/modules.d/99shutdown/module-setup.sh
b/modules.d/99shutdown/module-setup.sh
+@@ -17,9 +17,11 @@
+ inst_multiple umount poweroff reboot halt losetup stat sleep timeout
+ inst_multiple -o kexec
+ inst "$moddir/shutdown.sh" "$prefix/shutdown"
+-[ -e "${initdir}/lib" ] || mkdir -m 0755 -p "${initdir}"/lib
+-mkdir -m 0755 -p "${initdir}"/lib/dracut
+-mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks
++mkdir -m 0755 -p "${initdir}"/var/lib/dracut/hooks
++
++# symlink to old hooks location for compatibility
++ln_r /var/lib/dracut/hooks /lib/dracut/hooks
++
+ for _d in $hookdirs shutdown shutdown-emergency; do
+ mkdir -m 0755 -p "${initdir}"/lib/dracut/hooks/"$_d"
+ done
diff --git a/debian/patches/move-modprobe.d-to-run.patch
b/debian/patches/move-modprobe.d-to-run.patch
new file mode 100644
index ..17295491
--- /dev/null
+++ b/debian/patches/move-modprobe.d-to-run.patch
@@ -0,0 +1,156 @@
+Description: Move /etc/modprobe.d to /run/modprobe.d
+ Change /etc/modprobe.d path to /run/modprobe.d in hooks, as /etc might be
+ mounted as read-only.
+Author: Laszlo Gombos
+Origin: upstream, https://github.com/dracut-ng/dracut-ng
+Applied-Upstream:
https://github.com/dracut-ng/dracut-ng/commit/424717af8e0a86dac7a9898bf161f04e35abd2c2
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/man/dracut.modules.7.asc
b/man/dracut.modules.7.asc
+@@ -181,7 +181,7 @@
+ _parse-insmodpost.sh_:
+
+ for p in $(getargs rd.driver.post=); do
+-echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
++echo "blacklist $p" >>