* [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; 11+ 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] 11+ 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
2026-04-30 8:54 ` Jill Ravaliya
2026-05-01 1:20 ` Jill Ravaliya
2 siblings, 0 replies; 11+ 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] 11+ messages in thread
* [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
@ 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; 11+ 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] 11+ 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; 11+ 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] 11+ messages in thread
* [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
2026-04-30 8:54 ` Jill Ravaliya
@ 2026-05-01 1:20 ` Jill Ravaliya
2026-05-15 19:30 ` Nicolas Schier
2 siblings, 1 reply; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-05-01 1:20 ` Jill Ravaliya
@ 2026-05-15 19:30 ` Nicolas Schier
2026-05-15 19:53 ` Nathan Chancellor
0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Schier @ 2026-05-15 19:30 UTC (permalink / raw)
To: Jill Ravaliya; +Cc: masahiroy, linux-kbuild, nathan
On Fri, May 01, 2026 at 06:50:18AM +0530, Jill Ravaliya wrote:
> 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.
Are you sure? On my Debian trixie, run-parts exits with 1 as soon as a
single script from the given directory exists with non-zero.
> 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
From skimming through that bug report, I don't think that the run-parts
part is the problem; but it seems to me that Ubuntu's
'55-initrd.install' script is the problem.
Kind regards,
Nicolas
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
2026-05-15 19:30 ` Nicolas Schier
@ 2026-05-15 19:53 ` Nathan Chancellor
0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2026-05-15 19:53 UTC (permalink / raw)
To: Nicolas Schier; +Cc: Jill Ravaliya, masahiroy, linux-kbuild
On Fri, May 15, 2026 at 09:30:21PM +0200, Nicolas Schier wrote:
> On Fri, May 01, 2026 at 06:50:18AM +0530, Jill Ravaliya wrote:
> > 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.
>
> Are you sure? On my Debian trixie, run-parts exits with 1 as soon as a
> single script from the given directory exists with non-zero.
...
> > This patch ensures that failures in 'run-parts' are correctly
> > propagated, allowing the package manager to abort the installation
> > upon hook failure.
Hmmm, yeah, I had missed the 'set -e' in this script, so I think this
change should be unnecessary because run-parts failures should already
be propagated up from 'set -e'. If a script in /{etc,usr/share}/kernel
does not error when it should, there is nothing we can do about that
(which appears to be the cause of the original issue). Thanks for the
review!
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] kbuild: deb-pkg: propagate hook script failures in builddeb
@ 2026-05-16 7:15 Jill Ravaliya
0 siblings, 0 replies; 11+ messages in thread
From: Jill Ravaliya @ 2026-05-16 7:15 UTC (permalink / raw)
To: nathan; +Cc: Jill Ravaliya, nsc, masahiroy, linux-kbuild
Hi Nathan, Nicolas,
You are correct. I tested locally and confirmed that
set -e in the generated postinst does catch run-parts
failures even in the && expression — execution does
not reach exit 0 when run-parts fails.
My patch is therefore redundant. I am withdrawing it.
The root cause remains 55-initrd.install silently
returning exit 0 when initrd is missing (LP#2141741),
which run-parts sees as success. That is where the
fix belongs.
This was my first patch to the kernel mailing list.
I apologize for the noise and thank you both for
taking the time to review it carefully.
Jill Ravaliya
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-05-16 7:16 UTC | newest]
Thread overview: 11+ 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
2026-04-30 8:54 ` Jill Ravaliya
2026-04-30 22:52 ` Nathan Chancellor
2026-05-01 1:20 ` Jill Ravaliya
2026-05-15 19:30 ` Nicolas Schier
2026-05-15 19:53 ` Nathan Chancellor
-- strict thread matches above, loose matches on Subject: below --
2026-05-08 10:18 Jill Ravaliya
2026-05-08 10:27 Jill Ravaliya
2026-05-08 12:01 ` Nathan Chancellor
2026-05-16 7:15 Jill Ravaliya
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.