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

* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
  2026-04-22 18:30 [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb Jill Ravaliya
@ 2026-04-22 22:06 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2026-04-22 22:06 UTC (permalink / raw)
  To: Jill Ravaliya; +Cc: masahiroy, linux-kbuild, nicolas

Hi Jill,

Thanks for the patch!

On Thu, Apr 23, 2026 at 12:00:12AM +0530, Jill Ravaliya wrote:
> >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

Unfortunately, this patch is malformed so it cannot be applied. Please
see

  https://docs.kernel.org/process/submitting-patches.html#no-mime-no-links-no-compression-no-attachments-just-plain-text
  https://git-send-email.io/
  https://docs.kernel.org/process/email-clients.html

for information on using git send-email (the traditional way) or

  https://b4.docs.kernel.org/en/latest/contributor/overview.html
  https://github.com/ClangBuiltLinux/linux/issues/2093#issuecomment-2932754317

for information on using b4 (the new way).

Otherwise, the premise of this patch seems reasonable and I would be
happy to test it properly once it can be properly applied to the tree.

>   exit 0
>   EOF
>   chmod 755 "${pdir}/DEBIAN/${script}"
> -- 
> 2.51.1
> 

^ permalink raw reply	[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