all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] pve8to9: only allow systemd-boot when it is actually used before upgrade
Date: Thu, 14 Aug 2025 14:08:07 +0200	[thread overview]
Message-ID: <20250814120807.2653672-1-s.ivanov@proxmox.com> (raw)

On some (non-standard) setups having systemd-boot installed, causes
issues, even if the system is using proxmox-boot-tool (p-b-t) for booting.
The currently observed edge-case is:
before the upgrade:
* system is booted with grub (w/o secure boot), using p-b-t, results
  in the ESP not being mounted on /boot/efi

after the upgrade:
* systemd-gpt-auto-generator(8) is active, and mounts the (single) ESP
  on /efi (because grub w/o secure-boot sets the needed efivar+it is
  not mounted)
* the next upgrade of systemd-boot causes systemd-boot to be
  installed on the ESP, but it will not get any kernels configured,
  since we disabled the /etc/kernel/postinst.d/zz-systemd-boot in
  PVE8.

so this patch further restricts the case were having systemd-boot
installed to the cases where p-b-t says it's used for booting.

Additionally raise the level from info to warn in the legacy-boot
case. and add a log_pass message that was added to the equivalent
check in pbs3to4[0]

[0] https://lore.proxmox.com/pbs-devel/20250811091135.127299-1-s.ivanov@proxmox.com/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
tested minimally on a system with btrfs raid1 and combinations of
`p-b-t init /dev/sdX2 grub`, and `p-b-t init /dev/sdX2`
 PVE/CLI/pve8to9.pm | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm
index b639e212..a321f550 100644
--- a/PVE/CLI/pve8to9.pm
+++ b/PVE/CLI/pve8to9.pm
@@ -1560,7 +1560,7 @@ sub check_bootloader {
 
     if (!-d '/sys/firmware/efi') {
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
-            log_info(
+            log_warn(
                 "systemd-boot package installed on legacy-boot system is not necessary, consider removing it"
             );
             return;
@@ -1572,8 +1572,25 @@ sub check_bootloader {
     my $boot_ok = 1;
     if (-f "/etc/kernel/proxmox-boot-uuids") {
         if (!$upgraded) {
-            log_skip("not yet upgraded, systemd-boot still needed for bootctl");
-            return;
+            my $sd_boot_used = 0;
+            eval {
+                run_command(
+                    ['proxmox-boot-tool', 'status'],
+                    outfunc => sub {
+                        my ($line) = @_;
+                        if ($line =~ m#configured with:.* (uefi|systemd-boot) \(versions:#) {
+                             $sd_boot_used = 1;
+                        }
+                    },
+                    errfunc => sub { },
+                    noerr => 1,
+                );
+            };
+
+            if ($sd_boot_used) {
+                log_skip("not yet upgraded, systemd-boot still needed for bootctl");
+                return;
+            }
         }
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
             log_fail("systemd-boot meta-package installed this will cause issues on upgrades of"
@@ -1581,6 +1598,7 @@ sub check_bootloader {
                 . " and remove 'systemd-boot'");
             return;
         }
+        log_pass("bootloader packages installed correctly");
     } else {
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
             log_fail(
-- 
2.39.5



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


             reply	other threads:[~2025-08-14 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 12:08 Stoiko Ivanov [this message]
2025-08-14 12:17 ` [pve-devel] applied: " Fabian Grünbichler

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=20250814120807.2653672-1-s.ivanov@proxmox.com \
    --to=s.ivanov@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 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