public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings
@ 2025-08-08 12:45 Stoiko Ivanov
  2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 1/2] 8 to 9 checks: do not ask bootctl if systemd-boot is used Stoiko Ivanov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2025-08-08 12:45 UTC (permalink / raw)
  To: pve-devel

changes v3->v4
* add all needed checks for removable grub instead of referring to p-b-t
  refresh based on Fabian's feedback (thx!)
* dropped left-over return, which rendered the log_success message
  unreachable

series v3:
https://lore.proxmox.com/pve-devel/20250807203004.336616-1-s.ivanov@proxmox.com/T/#t

Stoiko Ivanov (2):
  8 to 9 checks: do not ask bootctl if systemd-boot is used.
  8 to 9 checks: check for removable grub-install

 PVE/CLI/pve8to9.pm | 50 +++++++++++++++++++++++++++++++---------------
 1 file changed, 34 insertions(+), 16 deletions(-)

-- 
2.39.5



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


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

* [pve-devel] [PATCH manager v4 1/2] 8 to 9 checks: do not ask bootctl if systemd-boot is used.
  2025-08-08 12:45 [pve-devel] [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Stoiko Ivanov
@ 2025-08-08 12:45 ` Stoiko Ivanov
  2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 2/2] 8 to 9 checks: check for removable grub-install Stoiko Ivanov
  2025-08-08 13:45 ` [pve-devel] applied: [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2025-08-08 12:45 UTC (permalink / raw)
  To: pve-devel

The current logic of deciding if systemd-boot was manually setup by
the user (without proxmox-boot-tool), by checking
`bootctl is-installed` yields a false-positive after upgrading:
* systems which have the package installed (e.g. from our isos after
  8.0), but do not use proxmox-boot-tool (LVM installs) will get
  systemd-boot installed to /boot/efi upon upgrade
* after upgrading the check says that it's been explicitly setup.

Rather warn if the package is installed (unless proxmox-boot-tool is
used and the upgrade is still not done) in any case - as the number
of systems which have it setup manually are probably far lower than
those that upgrade without explicitly checking pve8to9.

Additionally increase the log from a warn to a fail, as issues with
boot-loaders yield unbootable systems, and move the (probably rare)
case of manual systemd-boot setups to the upgrade-guide
in our wiki, which is also linked in the output.

Finally fix a typo (s/remoing/removing/).

Reported-by: Daniel Herzig <d.herzig@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 PVE/CLI/pve8to9.pm | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm
index dc3bf9ea..db155184 100644
--- a/PVE/CLI/pve8to9.pm
+++ b/PVE/CLI/pve8to9.pm
@@ -1561,7 +1561,7 @@ sub check_bootloader {
     if (!-d '/sys/firmware/efi') {
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
             log_info(
-                "systemd-boot package installed on legacy-boot system is not necessary, consider remoing it"
+                "systemd-boot package installed on legacy-boot system is not necessary, consider removing it"
             );
             return;
         }
@@ -1575,25 +1575,18 @@ sub check_bootloader {
             return;
         }
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
-            log_warn("systemd-boot meta-package installed this will cause issues on upgrades of"
+            log_fail("systemd-boot meta-package installed this will cause issues on upgrades of"
                 . " boot-related packages. Install 'systemd-boot-efi' and 'systemd-boot-tools' explicitly"
                 . " and remove 'systemd-boot'");
             return;
         }
     } else {
         if (-f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
-            my $exit_code = eval {
-                run_command(['bootctl', 'is-installed', '--quiet', '--graceful'], noerr => 1);
-            };
-            if ($exit_code != 0) {
-                log_warn(
-                    "systemd-boot meta-package installed but the system does not seem to use it"
-                        . " for booting. This can cause problems on upgrades of other boot-related packages."
-                        . " Consider removing 'systemd-boot'");
-            } else {
-                log_info("systemd-boot used as bootloader and fitting meta-package installed.");
-                return;
-            }
+            log_fail(
+                "systemd-boot meta-package installed. This will cause problems on upgrades of other"
+                    . " boot-related packages. Remove 'systemd-boot' See"
+                    . " https://pve.proxmox.com/wiki/Upgrade_from_8_to_9#sd-boot-warning for more information."
+            );
         }
         if (!-f "/usr/share/doc/grub-efi-amd64/changelog.Debian.gz") {
             log_warn("System booted in uefi mode but grub-efi-amd64 meta-package not installed,"
-- 
2.39.5



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


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

* [pve-devel] [PATCH manager v4 2/2] 8 to 9 checks: check for removable grub-install
  2025-08-08 12:45 [pve-devel] [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Stoiko Ivanov
  2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 1/2] 8 to 9 checks: do not ask bootctl if systemd-boot is used Stoiko Ivanov
@ 2025-08-08 12:45 ` Stoiko Ivanov
  2025-08-08 13:45 ` [pve-devel] applied: [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2025-08-08 12:45 UTC (permalink / raw)
  To: pve-devel

some upgrades result in unbootable systems, which can be traced back
to grub being installed in BOOTX64.efi, but not being upgraded by
grub-install. Refer the cases to the output of
`proxmox-boot-tool refresh` as it has a sensible check logic for those
cases. Some affected systems printed the warning of proxmox-boot-tool,
but it was lost in the large output of the dist-upgrade.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 PVE/CLI/pve8to9.pm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm
index db155184..a8b4c718 100644
--- a/PVE/CLI/pve8to9.pm
+++ b/PVE/CLI/pve8to9.pm
@@ -1569,6 +1569,7 @@ sub check_bootloader {
         return;
     }
 
+    my $boot_ok = 1;
     if (-f "/etc/kernel/proxmox-boot-uuids") {
         if (!$upgraded) {
             log_skip("not yet upgraded, systemd-boot still needed for bootctl");
@@ -1587,13 +1588,37 @@ sub check_bootloader {
                     . " boot-related packages. Remove 'systemd-boot' See"
                     . " https://pve.proxmox.com/wiki/Upgrade_from_8_to_9#sd-boot-warning for more information."
             );
+            $boot_ok = 0;
         }
         if (!-f "/usr/share/doc/grub-efi-amd64/changelog.Debian.gz") {
             log_warn("System booted in uefi mode but grub-efi-amd64 meta-package not installed,"
                 . " new grub versions will not be installed to /boot/efi! Install grub-efi-amd64."
             );
-            return;
-        } else {
+            $boot_ok = 0;
+        }
+        if (-f "/boot/efi/EFI/BOOT/BOOTX64.efi") {
+            my $removable_update = 0;
+            my $exit_code = eval {
+                run_command(
+                    ['debconf-show', '--db', 'configdb', 'grub-efi-amd64', 'grub-pc'],
+                    outfunc => sub {
+                        my ($line) = @_;
+                        if ($line =~ m|grub2/force_efi_extra_removable: +true$|) {
+                            $removable_update = 1;
+                        }
+                    },
+                    noerr => 1,
+                );
+            };
+            log_warn(
+                "Removable bootloader found at '/boot/efi/EFI/BOOT/BOOTX64.efi', but GRUB packages"
+                    . " not set up to update it!\nRun the following command:\n"
+                    . "echo 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u\n"
+                    . "Then reinstall GRUB with 'apt install --reinstall grub-efi-amd64'")
+                if !$removable_update;
+            $boot_ok = 0;
+        }
+        if ($boot_ok) {
             log_pass("bootloader packages installed correctly");
         }
     }
-- 
2.39.5



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


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

* [pve-devel] applied: [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings
  2025-08-08 12:45 [pve-devel] [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Stoiko Ivanov
  2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 1/2] 8 to 9 checks: do not ask bootctl if systemd-boot is used Stoiko Ivanov
  2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 2/2] 8 to 9 checks: check for removable grub-install Stoiko Ivanov
@ 2025-08-08 13:45 ` Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2025-08-08 13:45 UTC (permalink / raw)
  To: pve-devel, Stoiko Ivanov


On Fri, 08 Aug 2025 14:45:38 +0200, Stoiko Ivanov wrote:
> changes v3->v4
> * add all needed checks for removable grub instead of referring to p-b-t
>   refresh based on Fabian's feedback (thx!)
> * dropped left-over return, which rendered the log_success message
>   unreachable
> 
> series v3:
> https://lore.proxmox.com/pve-devel/20250807203004.336616-1-s.ivanov@proxmox.com/T/#t
> 
> [...]

Applied, thanks!

with a small follow-up, and also cherry-picked onto stable-8

[1/2] 8 to 9 checks: do not ask bootctl if systemd-boot is used.
      commit: c34544e4162b74effcc79d000506d82b9bd4a4bc
[2/2] 8 to 9 checks: check for removable grub-install
      commit: 567cf37fac5fabb9901b85ae8cd25145e1745974

Best regards,
-- 
Fabian Grünbichler <f.gruenbichler@proxmox.com>


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

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

end of thread, other threads:[~2025-08-08 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-08 12:45 [pve-devel] [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Stoiko Ivanov
2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 1/2] 8 to 9 checks: do not ask bootctl if systemd-boot is used Stoiko Ivanov
2025-08-08 12:45 ` [pve-devel] [PATCH manager v4 2/2] 8 to 9 checks: check for removable grub-install Stoiko Ivanov
2025-08-08 13:45 ` [pve-devel] applied: [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal