* [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
@ 2026-04-22 18:30 Jill Ravaliya
2026-04-22 22:06 ` Nathan Chancellor
` (2 more replies)
0 siblings, 3 replies; 8+ 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] 8+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-04-22 18:30 Jill Ravaliya
@ 2026-04-22 22:06 ` Nathan Chancellor
2026-04-30 8:54 ` Jill Ravaliya
2026-05-01 1:20 ` Jill Ravaliya
2 siblings, 0 replies; 8+ 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] 8+ messages in thread
* [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-04-22 18:30 Jill Ravaliya
2026-04-22 22:06 ` Nathan Chancellor
@ 2026-04-30 8:54 ` Jill Ravaliya
2026-04-30 22:52 ` Nathan Chancellor
2026-05-01 1:20 ` Jill Ravaliya
2 siblings, 1 reply; 8+ messages in thread
From: Jill Ravaliya @ 2026-04-30 8:54 UTC (permalink / raw)
To: masahiroy; +Cc: linux-kbuild, nathan, nicolas, Jill Ravaliya
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, leading to a 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
---
v2:
- Resending via git send-email to fix formatting issues.
- Refined commit message for clarity and professional tone.
---
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] 8+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-04-30 8:54 ` Jill Ravaliya
@ 2026-04-30 22:52 ` Nathan Chancellor
0 siblings, 0 replies; 8+ messages in thread
From: Nathan Chancellor @ 2026-04-30 22:52 UTC (permalink / raw)
To: Jill Ravaliya; +Cc: masahiroy, linux-kbuild, nathan, nicolas
On Thu, 30 Apr 2026 14:24:42 +0530, Jill Ravaliya <jillravaliya@gmail.com> wrote:
Hi Jill,
Thanks for a quick v2!
> 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, leading to a 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>
Please use proper name formatting here.
>
>
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index ba1defc61652..feeb9d0d3b71 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
Is the escaping of '$' correct here? Prior to this change, these values
would be expanded when the scripts were written to disk but now they
will be expanded when the script is run, which seems incorrect since
those variables will not be set in this environment.
| diff --git a/build/kbuild-7.1-rc1/debian/linux-image-7.1.0-rc1-00002-ge96b61aad8d5-dirty/DEBIAN/postinst b/build/kbuild/debian/linux-image-7.1.0-rc1-00002-ge96b61aad8d5/DEBIAN/postinst
| index d9fc953e73c6..30ef722cfebf 100755
| --- a/build/kbuild-7.1-rc1/debian/linux-image-7.1.0-rc1-00002-ge96b61aad8d5-dirty/DEBIAN/postinst
| +++ b/build/kbuild/debian/linux-image-7.1.0-rc1-00002-ge96b61aad8d5/DEBIAN/postinst
| @@ -16,5 +16,10 @@ test -d "$dir/postinst.d" || continue
| hookdirs="$hookdirs $dir/postinst.d"
| done
| hookdirs="${hookdirs# }"
| -test -n "$hookdirs" && run-parts --arg="7.1.0-rc1-00002-ge96b61aad8d5-dirty" --arg="/boot/vmlinuz-7.1.0-rc1-00002-ge96b61aad8d5-dirty" $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
Was this a leftover from testing?
> + echo "E: Post-install hooks failed." >&2
> + exit 1
> + fi
> + fi
Please fix up the indentation, as your change uses spaces but the rest
of this script uses tabs.
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-04-22 18:30 Jill Ravaliya
2026-04-22 22:06 ` Nathan Chancellor
2026-04-30 8:54 ` Jill Ravaliya
@ 2026-05-01 1:20 ` Jill Ravaliya
2 siblings, 0 replies; 8+ messages in thread
From: Jill Ravaliya @ 2026-05-01 1:20 UTC (permalink / raw)
To: masahiroy; +Cc: linux-kbuild, nathan, nicolas, Jill Ravaliya
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, leading to a 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: Jill Ravaliya <jillravaliya@gmail.com>
Link: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2141741
---
v3:
- Fix variable escaping in run-parts invocation
- Fix indentation to use tabs consistently
- Fix Signed-off-by name formatting
v2:
- Resending via git send-email to fix formatting issues.
- Refined commit message for clarity and professional tone.
---
scripts/package/builddeb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 3627ca227..21c929dd3 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] 8+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
@ 2026-05-08 10:18 Jill Ravaliya
0 siblings, 0 replies; 8+ messages in thread
From: Jill Ravaliya @ 2026-05-08 10:18 UTC (permalink / raw)
To: nathan.chancellor; +Cc: Jill Ravaliya, linux-kbuild, linux-kernel
Hi Nathan,
Just following up on the v3 patch I sent on May 1st.
Wanted to make sure it did not get lost.
Happy to make any further changes if needed.
Thanks,
Jill Ravaliya
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
@ 2026-05-08 10:27 Jill Ravaliya
2026-05-08 12:01 ` Nathan Chancellor
0 siblings, 1 reply; 8+ messages in thread
From: Jill Ravaliya @ 2026-05-08 10:27 UTC (permalink / raw)
To: nathan; +Cc: Jill Ravaliya, linux-kbuild, linux-kernel
Hi Nathan,
Just following up on the v3 patch I sent on May 1st.
Wanted to make sure it did not get lost.
Happy to make any further changes if needed.
Thanks,
Jill Ravaliya
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-05-08 10:27 Jill Ravaliya
@ 2026-05-08 12:01 ` Nathan Chancellor
0 siblings, 0 replies; 8+ messages in thread
From: Nathan Chancellor @ 2026-05-08 12:01 UTC (permalink / raw)
To: Jill Ravaliya; +Cc: linux-kbuild, linux-kernel
Hi Jill,
On Fri, May 08, 2026 at 03:57:08PM +0530, Jill Ravaliya wrote:
> Just following up on the v3 patch I sent on May 1st.
> Wanted to make sure it did not get lost.
>
> Happy to make any further changes if needed.
Nope, it did not get lost, it is still in my review queue. I am just on
vacation for another week or so, so I am not picking up any patches
until I am back to properly test, review, and respond to -next
regression reports. If I haven't responded by May 22, feel free to ping
me again.
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-05-08 12:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 10:18 [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb Jill Ravaliya
-- strict thread matches above, loose matches on Subject: below --
2026-05-08 10:27 Jill Ravaliya
2026-05-08 12:01 ` Nathan Chancellor
2026-04-22 18:30 Jill Ravaliya
2026-04-22 22:06 ` Nathan Chancellor
2026-04-30 8:54 ` Jill Ravaliya
2026-04-30 22:52 ` Nathan Chancellor
2026-05-01 1:20 ` Jill Ravaliya
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox