Re: [pve-devel] [PATCH manager v2 1/1] pve7to8: check for proper grub meta-package for bootmode

2023-10-11 Thread Friedrich Weber
On 09/10/2023 14:52, Stoiko Ivanov wrote:
> +} elsif ( ! -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."
>   );

I do like the exclamation mark, but I still think some punctuation (if
not newline) between "[...] not installed" and "new grub versions [...]"
would be good. Currently, the message reads like this:

WARN: System booted in uefi mode but grub-efi-amd64 meta-package
notinstalled new grub versions will not be installed to /boot/efi! Install
grub-efi-amd64.

which is a bit hard to parse -- the following seems easier to parse
(note the extra comma):

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.

Sorry for obsessing over the punctuation here, but I suspect there are a
lot of UEFI-booted PVE 7 installs with LVM root, so it would be good to
reduce the potential for confusion as much as possible.

The exact phrasing aside, consider this:

Tested-by: Friedrich Weber 

Can confirm that with this patch,

* pve7to8 prints the warning on UEFI-booted system with root on LVM and
grub-pc installed
* pve7to8 does *not* print the warning on
** the same system when grub-efi-amd64 is installed
** UEFI-booted system with root on ZFS (using systemd-boot)
** legacy-booted system with root on LVM or ZFS


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



[pve-devel] [PATCH manager v2 1/1] pve7to8: check for proper grub meta-package for bootmode

2023-10-09 Thread Stoiko Ivanov
This should catch installations from our ISO on non-ZFS in uefi mode,
which won't get the updated grub efi binary installed upon upgrade,
because grub-pc is installed instead of grub-efi-amd64.

Adding this to pve7to8 should make this even more visible, than the
corresponding patch for promxox-kernel-helper (warnings printed during
regular package upgrades might be overlooked more easily than
a yellow line in the major upgrade checkscript)

The if/else order was chosen to limit the nesting level of the long
messages.

Signed-off-by: Stoiko Ivanov 
---
 PVE/CLI/pve7to8.pm | 39 +++
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/PVE/CLI/pve7to8.pm b/PVE/CLI/pve7to8.pm
index d1a71eff..ff7825b3 100644
--- a/PVE/CLI/pve7to8.pm
+++ b/PVE/CLI/pve7to8.pm
@@ -1302,29 +1302,36 @@ sub check_time_sync {
 
 sub check_bootloader {
 log_info("Checking bootloader configuration...");
-if (!$upgraded) {
-   log_skip("not yet upgraded, no need to check the presence of 
systemd-boot");
-   return;
-}
 
-if (! -f "/etc/kernel/proxmox-boot-uuids") {
-   log_skip("proxmox-boot-tool not used for bootloader configuration");
+if (! -d '/sys/firmware/efi') {
+   log_skip("System booted in legacy-mode - no need for additional 
packages");
return;
 }
 
-if (! -d "/sys/firmware/efi") {
-   log_skip("System booted in legacy-mode - no need for systemd-boot");
-   return;
-}
-
-if ( -f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
-   log_pass("systemd-boot is installed");
-} else {
+if ( -f "/etc/kernel/proxmox-boot-uuids") {
+   if (!$upgraded) {
+   log_skip("not yet upgraded, no need to check the presence of 
systemd-boot");
+   return;
+   }
+   if ( -f "/usr/share/doc/systemd-boot/changelog.Debian.gz") {
+   log_pass("bootloader packages installed correctly");
+   return;
+   }
log_warn(
"proxmox-boot-tool is used for bootloader configuration in uefi 
mode"
-   . "but the separate systemd-boot package, existing in Debian 
Bookworm  is not installed"
-   . "initializing new ESPs will not work until the package is 
installed"
+   . " but the separate systemd-boot package, existing in Debian 
Bookworm is not installed"
+   . " initializing new ESPs will not work until the package is 
installed"
+   );
+   return;
+} elsif ( ! -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 {
+   log_pass("bootloader packages installed correctly");
 }
 }
 
-- 
2.39.2



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