From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer 1/2] post-hook: detect last listed kernel package as installed kernel package
Date: Wed, 20 May 2026 12:22:42 +0200 [thread overview]
Message-ID: <20260520102243.129230-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260520102243.129230-1-s.sterz@proxmox.com>
this fixes an issue where the meta package was picked up as the
installed kernel package, due to a change in its architecture from
"all" to "amd64". meaning that `find_kernel_image_path` could not find
the image path, as the meta package does not provide an image itself.
that in turn caused the whole proxmox-post-hook to fail.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
proxmox-post-hook/src/main.rs | 37 +++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/proxmox-post-hook/src/main.rs b/proxmox-post-hook/src/main.rs
index 90c1d01..97c36ef 100644
--- a/proxmox-post-hook/src/main.rs
+++ b/proxmox-post-hook/src/main.rs
@@ -427,6 +427,8 @@ mod detail {
// ii |all|proxmox-kernel-6.8
// un ||proxmox-kernel-6.8.8-2-pve
// ii |amd64|proxmox-kernel-6.8.8-2-pve-signed
+ let mut to_return = Err(anyhow!("failed to find installed kernel package"));
+
for pkg in kernel_pkgs.lines() {
let parts = pkg.split('|').collect::<Vec<&str>>();
@@ -434,11 +436,11 @@ mod detail {
&& status.trim() == "ii"
&& arch.trim() == dpkg_arch
{
- return Ok(name.trim().to_owned());
+ to_return = Ok(name.trim().to_owned());
}
}
- bail!("failed to find installed kernel package")
+ to_return
}
/// Retrieves some basic information about the CPU in the running system,
@@ -536,6 +538,37 @@ ii |amd64|proxmox-kernel-6.8.8-2-pve-signed
);
}
+ #[test]
+ fn finds_correct_kernel_package_name_when_meta_package_architecture_matches() {
+ let mocked_run_cmd = |cmd: &[&str]| {
+ if cmd[0] == "dpkg" {
+ assert_eq!(cmd, &["dpkg", "--print-architecture"]);
+ Ok("amd64\n".to_owned())
+ } else {
+ assert_eq!(
+ cmd,
+ &[
+ "dpkg-query",
+ "--showformat",
+ "${db:Status-Abbrev}|${Architecture}|${Package}\\n",
+ "--show",
+ "proxmox-kernel-[0-9]*",
+ ]
+ );
+ Ok(r#"ii |amd64|proxmox-kernel-7.0
+un ||proxmox-kernel-7.0.2-5-pve
+ii |amd64|proxmox-kernel-7.0.2-5-pve-signed
+ "#
+ .to_owned())
+ }
+ };
+
+ assert_eq!(
+ find_kernel_package_name(&mocked_run_cmd).unwrap(),
+ "proxmox-kernel-7.0.2-5-pve-signed"
+ );
+ }
+
#[test]
fn finds_correct_kernel_package_name_arm64() {
let mocked_run_cmd = |cmd: &[&str]| {
--
2.47.3
next prev parent reply other threads:[~2026-05-20 10:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 10:22 [PATCH installer 0/2] fix post-hook kernel version on newer installs and improve failure tolerance Shannon Sterz
2026-05-20 10:22 ` Shannon Sterz [this message]
2026-05-20 10:22 ` [PATCH installer 2/2] post-hook: make post hook more failure tolerant Shannon Sterz
2026-05-20 11:31 ` applied: [PATCH installer 0/2] fix post-hook kernel version on newer installs and improve failure tolerance Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260520102243.129230-2-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox