all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks
@ 2025-08-18 19:40 Stoiko Ivanov
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 1/3] pbs3to4: fix logic error and typo in log message Stoiko Ivanov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stoiko Ivanov @ 2025-08-18 19:40 UTC (permalink / raw)
  To: pbs-devel

this series fixes 1 glitch (wrong negation for systemd-boot on legacy
systems), carries over the changes from pve8to9 commit 7e168453 and
reworks the decision-tree to make it (hopefully) simpler and clearer

minimally tested on 2 VMs I had running.

Stoiko Ivanov (3):
  pbs3to4: fix logic error and typo in log message
  pbs3to4: use boolean variable for systemd-boot installation state
  pbs3to4: bootloader: only allow systemd-boot before upgrade when used

 src/bin/pbs3to4.rs | 65 +++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 29 deletions(-)

-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pbs-devel] [PATCH proxmox-backup 1/3] pbs3to4: fix logic error and typo in log message
  2025-08-18 19:40 [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
@ 2025-08-18 19:40 ` Stoiko Ivanov
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 2/3] pbs3to4: use boolean variable for systemd-boot installation state Stoiko Ivanov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stoiko Ivanov @ 2025-08-18 19:40 UTC (permalink / raw)
  To: pbs-devel

/usr/share/doc/systemd-boot/changelog.Debian.gz existing indicates
that system-boot is installed (the `!` was in error).

additionally fix a typo in the log message.

Fixes:  94cc9903 ("bin: pbs3to4: adapt boot-loader checks to trixie")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/bin/pbs3to4.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bin/pbs3to4.rs b/src/bin/pbs3to4.rs
index 2e6ea933..5df960a3 100644
--- a/src/bin/pbs3to4.rs
+++ b/src/bin/pbs3to4.rs
@@ -207,7 +207,7 @@ impl Checker {
             .log_info("Checking bootloader configuration...")?;
 
         if !Path::new("/sys/firmware/efi").is_dir() {
-            if !Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
                 self.output.log_info(
                     "systemd-boot package installed on legacy-boot system is not \
                     necessary, consider removing it",
@@ -215,7 +215,7 @@ impl Checker {
                 return Ok(());
             }
             self.output
-                .log_skip("System booted in legacy-mode - no need for additional pacckages.")?;
+                .log_skip("System booted in legacy-mode - no need for additional packages.")?;
             return Ok(());
         }
 
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pbs-devel] [PATCH proxmox-backup 2/3] pbs3to4: use boolean variable for systemd-boot installation state
  2025-08-18 19:40 [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 1/3] pbs3to4: fix logic error and typo in log message Stoiko Ivanov
@ 2025-08-18 19:40 ` Stoiko Ivanov
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used Stoiko Ivanov
  2025-08-21 14:18 ` [pbs-devel] superseded: [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
  3 siblings, 0 replies; 5+ messages in thread
From: Stoiko Ivanov @ 2025-08-18 19:40 UTC (permalink / raw)
  To: pbs-devel

while it's not saving too much run-time wise (each branch stats the
file only once), it's a bit easier to read.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/bin/pbs3to4.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/bin/pbs3to4.rs b/src/bin/pbs3to4.rs
index 5df960a3..e700c832 100644
--- a/src/bin/pbs3to4.rs
+++ b/src/bin/pbs3to4.rs
@@ -206,8 +206,10 @@ 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();
+
         if !Path::new("/sys/firmware/efi").is_dir() {
-            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            if sd_boot_installed {
                 self.output.log_info(
                     "systemd-boot package installed on legacy-boot system is not \
                     necessary, consider removing it",
@@ -227,7 +229,7 @@ impl Checker {
                     .log_skip("not yet upgraded, systemd-boot still needed for bootctl")?;
                 return Ok(());
             }
-            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            if sd_boot_installed {
                 self.output.log_fail(
                     "systemd-boot meta-package installed. This will cause issues on upgrades of \
                     boot-related packages.\n\
@@ -237,7 +239,7 @@ impl Checker {
                 return Ok(());
             }
         } else {
-            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            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\
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used
  2025-08-18 19:40 [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 1/3] pbs3to4: fix logic error and typo in log message Stoiko Ivanov
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 2/3] pbs3to4: use boolean variable for systemd-boot installation state Stoiko Ivanov
@ 2025-08-18 19:40 ` Stoiko Ivanov
  2025-08-21 14:18 ` [pbs-devel] superseded: [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
  3 siblings, 0 replies; 5+ messages in thread
From: Stoiko Ivanov @ 2025-08-18 19:40 UTC (permalink / raw)
  To: 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 <s.ivanov@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pbs-devel] superseded: [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks
  2025-08-18 19:40 [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
                   ` (2 preceding siblings ...)
  2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used Stoiko Ivanov
@ 2025-08-21 14:18 ` Stoiko Ivanov
  3 siblings, 0 replies; 5+ messages in thread
From: Stoiko Ivanov @ 2025-08-21 14:18 UTC (permalink / raw)
  To: pbs-devel

superseded by:
https://lore.proxmox.com/pbs-devel/20250821141719.4130062-1-s.ivanov@proxmox.com/T/#t

On Mon, 18 Aug 2025 21:40:23 +0200
Stoiko Ivanov <s.ivanov@proxmox.com> wrote:

> this series fixes 1 glitch (wrong negation for systemd-boot on legacy
> systems), carries over the changes from pve8to9 commit 7e168453 and
> reworks the decision-tree to make it (hopefully) simpler and clearer
> 
> minimally tested on 2 VMs I had running.
> 
> Stoiko Ivanov (3):
>   pbs3to4: fix logic error and typo in log message
>   pbs3to4: use boolean variable for systemd-boot installation state
>   pbs3to4: bootloader: only allow systemd-boot before upgrade when used
> 
>  src/bin/pbs3to4.rs | 65 +++++++++++++++++++++++++---------------------
>  1 file changed, 36 insertions(+), 29 deletions(-)
> 



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-21 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-18 19:40 [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 1/3] pbs3to4: fix logic error and typo in log message Stoiko Ivanov
2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 2/3] pbs3to4: use boolean variable for systemd-boot installation state Stoiko Ivanov
2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used Stoiko Ivanov
2025-08-21 14:18 ` [pbs-devel] superseded: [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal