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 78E861FF185 for ; Mon, 18 Aug 2025 21:38:55 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 878AD3F741; Mon, 18 Aug 2025 21:40:39 +0200 (CEST) From: Stoiko Ivanov To: pbs-devel@lists.proxmox.com Date: Mon, 18 Aug 2025 21:40:26 +0200 Message-Id: <20250818194026.840749-4-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250818194026.840749-1-s.ivanov@proxmox.com> References: <20250818194026.840749-1-s.ivanov@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1755545993501 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.063 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" This carries over the changes from pve-manager: 7e168453 ("pve8to9: only allow systemd-boot when it is actually used before upgrade") additionally it pushes the check for systemd-boot being present to the bottom (there is an early return for the single case which is not problematic (used by p-b-t on a system still on bookworm) - and logs a failure with a link to the upgrade guide in all cases. The previous suggestion of installing systemd-boot-tools and systemd-boot-efi explicitly is not fitting when systemd-boot is not really used for booting (mostly: secure-boot enabled p-b-t setups) Signed-off-by: Stoiko Ivanov --- src/bin/pbs3to4.rs | 61 +++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/src/bin/pbs3to4.rs b/src/bin/pbs3to4.rs index e700c832..e3cd43c9 100644 --- a/src/bin/pbs3to4.rs +++ b/src/bin/pbs3to4.rs @@ -206,11 +206,12 @@ impl Checker { self.output .log_info("Checking bootloader configuration...")?; - let sd_boot_installed = Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file(); + let sd_boot_installed = + Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file(); if !Path::new("/sys/firmware/efi").is_dir() { if sd_boot_installed { - self.output.log_info( + self.output.log_warn( "systemd-boot package installed on legacy-boot system is not \ necessary, consider removing it", )?; @@ -225,29 +226,25 @@ impl Checker { if Path::new("/etc/kernel/proxmox-boot-uuids").is_file() { // PBS packages version check needs to be run before if !self.upgraded { - self.output - .log_skip("not yet upgraded, systemd-boot still needed for bootctl")?; - return Ok(()); - } - if sd_boot_installed { - self.output.log_fail( - "systemd-boot meta-package installed. This will cause issues on upgrades of \ - boot-related packages.\n\ - Install 'systemd-boot-efi' and 'systemd-boot-tools' explicitly and remove \ - 'systemd-boot'", - )?; - return Ok(()); + let mut sd_boot_used = false; + let output = std::process::Command::new("proxmox-boot-tool") + .arg("status") + .output() + .map_err(|err| { + format_err!("failed to retrieve proxmox-boot-tool status - {err}") + })?; + let re = Regex::new(r"configured with:.* (uefi|systemd-boot) \(versions:") + .expect("failed to proxmox-boot-tool status"); + if !re.is_match(std::str::from_utf8(&output.stdout)?) { + sd_boot_used = true; + } + if sd_boot_used { + self.output + .log_skip("not yet upgraded, systemd-boot still needed for bootctl")?; + return Ok(()); + } } } else { - if sd_boot_installed { - self.output.log_fail( - "systemd-boot meta-package installed. This will cause problems on upgrades of other \ - boot-related packages.\n\ - Remove the 'systemd-boot' package.\n\ - See https://pbs.proxmox.com/wiki/Upgrade_from_3_to_4#sd-boot-warning for more information." - )?; - boot_ok = false; - } if !Path::new("/usr/share/doc/grub-efi-amd64/changelog.Debian.gz").is_file() { self.output.log_warn( "System booted in uefi mode but grub-efi-amd64 meta-package not installed, \ @@ -276,12 +273,20 @@ impl Checker { boot_ok = false; } } - if boot_ok { - self.output - .log_pass("bootloader packages installed correctly")?; - } } - + if sd_boot_installed { + self.output.log_fail( + "systemd-boot meta-package installed. This will cause problems on upgrades of other \ + boot-related packages.\n\ + Remove the 'systemd-boot' package.\n\ + See https://pbs.proxmox.com/wiki/Upgrade_from_3_to_4#sd-boot-warning for more information." + )?; + boot_ok = false; + } + if boot_ok { + self.output + .log_pass("bootloader packages installed correctly")?; + } Ok(()) } -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel