public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
@ 2026-04-22 18:30 Jill Ravaliya
  2026-04-22 22:06 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Jill Ravaliya @ 2026-04-22 18:30 UTC (permalink / raw)
  To: masahiroy; +Cc: linux-kbuild, Nathan Chancellor, nicolas

From 1d7c7d8bf70c3d2b2abbb5ead3c654978ead419a Mon Sep 17 00:00:00 2001
From: jillravaliya <jillravaliya@gmail.com>
Date: Wed, 22 Apr 2026 23:37:39 +0530
Subject: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb

The 'builddeb' script generates maintainer scripts for Debian-based
distributions. Currently, it invokes post-installation hooks via
run-parts but unconditionally exits with code 0. This masks failures
from downstream hooks (e.g., initramfs generation or DKMS).

On systems with modular storage drivers (CONFIG_BLK_DEV_NVME=m), an
unnoticed failure in an early hook can prevent the initrd from being
correctly updated. This results in a successful package installation
exit code despite a broken boot configuration, leading to a
'VFS: unknown-block(0,0)' panic on reboot.

This patch ensures that failures in 'run-parts' are correctly
propagated, allowing the package manager to abort the installation
upon hook failure.

Signed-off-by: jillravaliya <jillravaliya@gmail.com>
Link: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2141741
---
 scripts/package/builddeb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 3627ca227..6ea768f08 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -98,7 +98,12 @@ install_maint_scripts () {
  hookdirs="\$hookdirs \$dir/${script}.d"
  done
  hookdirs="\${hookdirs# }"
- test -n "\$hookdirs" && run-parts --arg="${KERNELRELEASE}"
--arg="/${installed_image_path}" \$hookdirs
+ if [ -n "\$hookdirs" ]; then
+                    if ! run-parts --arg="\${KERNELRELEASE}"
--arg="/\${installed_image_path}" \$hookdirs; then
+                         echo "E: Post-install hooks failed." >&2
+                         exit 1
+                    fi
+                fi
  exit 0
  EOF
  chmod 755 "${pdir}/DEBIAN/${script}"
-- 
2.51.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-22 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 18:30 [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb Jill Ravaliya
2026-04-22 22:06 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox