public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode
@ 2023-09-28 14:05 Stoiko Ivanov
  2023-09-28 14:29 ` Stoiko Ivanov
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Stoiko Ivanov @ 2023-09-28 14:05 UTC (permalink / raw)
  To: pve-devel

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@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@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





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

* Re: [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode
  2023-09-28 14:05 [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode Stoiko Ivanov
@ 2023-09-28 14:29 ` Stoiko Ivanov
  2023-09-28 14:32   ` Thomas Lamprecht
  2023-10-02 15:15 ` Friedrich Weber
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Stoiko Ivanov @ 2023-09-28 14:29 UTC (permalink / raw)
  To: pve-devel

just realized while talking with Friedrich off-list - if this gets applied
it probably would make sense to include it in the pve7to8 (same for pbs
and pmg) checks (and also in the upgrade guides)
(mostly meant as a note to myself) 

On Thu, 28 Sep 2023 16:05:33 +0200
Stoiko Ivanov <s.ivanov@proxmox.com> wrote:

> 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@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@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





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

* Re: [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode
  2023-09-28 14:29 ` Stoiko Ivanov
@ 2023-09-28 14:32   ` Thomas Lamprecht
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-09-28 14:32 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

Am 28/09/2023 um 16:29 schrieb Stoiko Ivanov:
> just realized while talking with Friedrich off-list - if this gets applied
> it probably would make sense to include it in the pve7to8 (same for pbs
> and pmg) checks (and also in the upgrade guides)
> (mostly meant as a note to myself) 

Potentially better suited in one of our kernel or (probably even better)
boot-tool related package's postinst? As that would then cover existing
8.x systems too.




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

* Re: [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode
  2023-09-28 14:05 [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode Stoiko Ivanov
  2023-09-28 14:29 ` Stoiko Ivanov
@ 2023-10-02 15:15 ` Friedrich Weber
  2023-10-23  9:47 ` Fabian Grünbichler
  2023-11-06 17:32 ` [pve-devel] applied: " Thomas Lamprecht
  3 siblings, 0 replies; 6+ messages in thread
From: Friedrich Weber @ 2023-10-02 15:15 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

Tested-by: Friedrich Weber <f.weber@proxmox.com>

Tested patched ISO provided by Stoiko:
* installed in legacy VM
** checked that `grub-pc` is installed
** re-installing it prints "Installing for i386-pc platform"
* installed in UEFI VM
** checked that `grub-efi-amd64` is installed
** re-installing it prints "Installing for x86_64-efi platform" and
updates the mtime of /boot/efi/EFI/proxmox/grubx64.efi

On 28/09/2023 16:05, Stoiko Ivanov wrote:
> 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@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@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




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

* Re: [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode
  2023-09-28 14:05 [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode Stoiko Ivanov
  2023-09-28 14:29 ` Stoiko Ivanov
  2023-10-02 15:15 ` Friedrich Weber
@ 2023-10-23  9:47 ` Fabian Grünbichler
  2023-11-06 17:32 ` [pve-devel] applied: " Thomas Lamprecht
  3 siblings, 0 replies; 6+ messages in thread
From: Fabian Grünbichler @ 2023-10-23  9:47 UTC (permalink / raw)
  To: Proxmox VE development discussion

On September 28, 2023 4:05 pm, Stoiko Ivanov wrote:
> 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.

this paragraph confused me phrasing-wise (what it means is that the
'install_devices' variable is only defined for 'grub-pc', and thus
(still) only set for that package/namespace)

> Reported-by: Friedrich Weber <f.weber@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>

Reviewed-by: Fabian Grünbichler <f.gruenbichler@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.

did a similar test with comparing /boot before/after installing the
latest grub security update, which showed that the expected variant gets
updated (legacy if system was originally installed legacy, efi if it was
efi, both of course with no manual switch of boot mode or meta packages
in between).

as discussed off list, we might still want to improve the handling of
the "other" variant somehow, at least by detecting out-of-dateness
and/or missing meta packages somewhere after a switch over.

>  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
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




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

* [pve-devel] applied: [PATCH installer] install: install correct grub metapackage for the current boot-mode
  2023-09-28 14:05 [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode Stoiko Ivanov
                   ` (2 preceding siblings ...)
  2023-10-23  9:47 ` Fabian Grünbichler
@ 2023-11-06 17:32 ` Thomas Lamprecht
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-11-06 17:32 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

Am 28/09/2023 um 16:05 schrieb Stoiko Ivanov:
> 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@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@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(+)
> 
>

applied, with Fabian#s R-b and slight adaption to the commit message,
thanks!




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

end of thread, other threads:[~2023-11-06 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 14:05 [pve-devel] [PATCH installer] install: install correct grub metapackage for the current boot-mode Stoiko Ivanov
2023-09-28 14:29 ` Stoiko Ivanov
2023-09-28 14:32   ` Thomas Lamprecht
2023-10-02 15:15 ` Friedrich Weber
2023-10-23  9:47 ` Fabian Grünbichler
2023-11-06 17:32 ` [pve-devel] applied: " Thomas Lamprecht

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