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 v4 2/2] 8 to 9 checks: check for removable grub-install
Date: Fri,  8 Aug 2025 14:45:40 +0200	[thread overview]
Message-ID: <20250808124540.1490294-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20250808124540.1490294-1-s.ivanov@proxmox.com>

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


  parent reply	other threads:[~2025-08-08 12:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-08-08 13:45 ` [pve-devel] applied: [PATCH manager v4 0/2] 8 to 9 checks: improve boot-loader warnings 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=20250808124540.1490294-3-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