[pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used
Stoiko Ivanov
s.ivanov at proxmox.com
Mon Aug 18 21:40:26 CEST 2025
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 <s.ivanov at proxmox.com>
---
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
More information about the pbs-devel
mailing list