From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C7F2B1FF13B for ; Wed, 20 May 2026 12:23:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 75831C29; Wed, 20 May 2026 12:23:29 +0200 (CEST) From: Shannon Sterz 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 Message-ID: <20260520102243.129230-2-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260520102243.129230-1-s.sterz@proxmox.com> References: <20260520102243.129230-1-s.sterz@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779272554978 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.113 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: GPE4LGUKXMYI7LGYVO75IBA7CTOF43JW X-Message-ID-Hash: GPE4LGUKXMYI7LGYVO75IBA7CTOF43JW X-MailFrom: s.sterz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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::>(); @@ -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