[pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode
Stoiko Ivanov
s.ivanov at proxmox.com
Thu Sep 28 16:05:33 CEST 2023
grub packages in debian split between:
* meta-packages, which handles (among other things) the reinstalling
grub to the actual device/ESP in case of a version upgrade (grub-pc,
grub-efi-amd64)
* bin-packages, which contain the actual boot-loaders
The bin-packages can coexist on a system, but the meta-package
conflict with each other (didn't check why, but I don't see a hard
conflict on a quick glance)
Currently our ISO installs grub-pc unconditionally (and both bin
packages, since we install the legacy bootloader also on uefi-booted
systems). This results in uefi-systems not getting a new grub
installed automatically upon upgrade.
Reported in our community-forum from users who upgraded to PVE 8.0,
and still run into an issue fixed in grub for bookworm:
https://forum.proxmox.com/threads/.123512/
Reproduced and analyzed by Friedrich.
This patch changes the installer, to install the meta-package fitting
for the boot-mode.
We do not set the debconf variable install_devices, because in my
tests a plain debian installed in uefi mode has this set, and a
`grep -ri install_devices /var/lib/dpkg/info` yields only results with
grub-pc.
Reported-by: Friedrich Weber <f.weber at proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
quickly tested by building an ISO (with the necessary modifications to
ship both packages as .deb) and installing in legacy mode and uefi mode
once.
Proxmox/Install.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 1117fc4..d775ac0 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -1057,6 +1057,12 @@ _EOD
chomp;
my $path = $_;
my ($deb) = $path =~ m/${proxmox_pkgdir}\/(.*\.deb)/;
+
+ # the grub-pc/grub-efi-amd64 packages (w/o -bin) are the ones actually updating grub
+ # upon upgrade - and conflict with each other - install the fitting one only
+ next if ($deb =~ /grub-pc_/ && $run_env->{boot_type} ne 'bios');
+ next if ($deb =~ /grub-efi-amd64_/ && $run_env->{boot_type} ne 'efi');
+
update_progress($count/$pkg_count, 0.5, 0.75, "extracting $deb");
print STDERR "extracting: $deb\n";
syscmd("chroot $targetdir dpkg $dpkg_opts --force-depends --no-triggers --unpack /tmp/pkg/$deb") == 0
--
2.39.2
More information about the pve-devel
mailing list