* [pve-devel] [PATCH kernel-helper/manager] check for fitting grub-meta package on uefi systems
@ 2023-10-04 12:05 Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 1/2] proxmox-boot-tool: do not exit early in kernel-hook Stoiko Ivanov
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stoiko Ivanov @ 2023-10-04 12:05 UTC (permalink / raw)
To: pve-devel
The following patchset is a followup to the one for the installer:
https://lists.proxmox.com/pipermail/pve-devel/2023-September/059270.html
As suggested by Thomas - adding the check to proxmox-kernel-helper seems
like a good idea. While adding it to d/postinst I thought that this might
not be the best place - and that getting the warning upon every
kernel-upgrade would be better vs. upon every upgrade of
proxmox-kernel-helper (which are far less often).
(Can gladly send the version with d/postinst as well)
If the pve-manager patch gets applied - I'd push the equivalent change to
pmg and provide one for pbs.
Tested on legacy and uefi VMs installed with pve-8.0 iso and
grub-efi-amd64 (and systemd-boot) removed vs. installed.
proxmox-kernel-helper:
Stoiko Ivanov (2):
proxmox-boot-tool: do not exit early in kernel-hook
proxmox-boot-tool: check if correct grub metapackage is installed
src/proxmox-boot/zz-proxmox-boot | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
pve-manager
Stoiko Ivanov (1):
pve7to8: check for proper grub meta-package for bootmode
PVE/CLI/pve7to8.pm | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH 1/2] proxmox-boot-tool: do not exit early in kernel-hook
2023-10-04 12:05 [pve-devel] [PATCH kernel-helper/manager] check for fitting grub-meta package on uefi systems Stoiko Ivanov
@ 2023-10-04 12:05 ` Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 2/2] proxmox-boot-tool: check if correct grub metapackage is installed Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 1/1] pve7to8: check for proper grub meta-package for bootmode Stoiko Ivanov
2 siblings, 0 replies; 6+ messages in thread
From: Stoiko Ivanov @ 2023-10-04 12:05 UTC (permalink / raw)
To: pve-devel
update_esps is called first in the actual execution below - exiting
early does not work for systems that don't use proxmox-boot-tool if a
check added later needs to work there too.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/proxmox-boot/zz-proxmox-boot | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/proxmox-boot/zz-proxmox-boot b/src/proxmox-boot/zz-proxmox-boot
index 793882b..1adc1b1 100755
--- a/src/proxmox-boot/zz-proxmox-boot
+++ b/src/proxmox-boot/zz-proxmox-boot
@@ -44,7 +44,7 @@ fi
update_esps() {
if [ ! -f "${ESP_LIST}" ]; then
warn "No ${ESP_LIST} found, skipping ESP sync."
- exit 0
+ return
fi
if [ -f /etc/kernel/cmdline ]; then
# we can have cmdline files with multiple or no new line at all, handle both!
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH 2/2] proxmox-boot-tool: check if correct grub metapackage is installed
2023-10-04 12:05 [pve-devel] [PATCH kernel-helper/manager] check for fitting grub-meta package on uefi systems Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 1/2] proxmox-boot-tool: do not exit early in kernel-hook Stoiko Ivanov
@ 2023-10-04 12:05 ` Stoiko Ivanov
2023-10-09 7:07 ` Friedrich Weber
2023-10-04 12:05 ` [pve-devel] [PATCH 1/1] pve7to8: check for proper grub meta-package for bootmode Stoiko Ivanov
2 siblings, 1 reply; 6+ messages in thread
From: Stoiko Ivanov @ 2023-10-04 12:05 UTC (permalink / raw)
To: pve-devel
this part of the hook applies only to systems not using pbt for
bootmangement.
Currently our ISO installs grub-pc unconditionally - and never the
conflicting grub-efi-amd64. Both packages are responsible for
running grub-install (for the appropriate disks) upon an upgrade of
grub.
This results in grub currently not getting updated on uefi-booted
systems (which do not use proxmox-boot-tool).
The patch causes a warning to be printed to notify the user.
Also considered putting the check+warning in d/postinst - but this way
it will get triggered more often (upon every
kernel-upgrade/update-initramfs, instead of only on
proxmox-kernel-helper updates, which are less often), increasing the
chances of being noticed.
checking for the changelog-presence was chosen, over `dpkg-query` for
the status, for consistency with the similar patch for pve7to8 (and
potentially a small speed-gain).
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/proxmox-boot/zz-proxmox-boot | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/proxmox-boot/zz-proxmox-boot b/src/proxmox-boot/zz-proxmox-boot
index 1adc1b1..0d08dbf 100755
--- a/src/proxmox-boot/zz-proxmox-boot
+++ b/src/proxmox-boot/zz-proxmox-boot
@@ -215,6 +215,23 @@ disable_systemd_boot_hook() {
}
+check_grub_efi_package() {
+
+ if [ -f "${ESP_LIST}" ]; then
+ return
+ fi
+
+ if [ ! -d /sys/firmware/efi ]; then
+ return
+ fi
+
+ if [ ! -f /usr/share/doc/grub-efi-amd64/changelog.Debian.gz ]; then
+ return
+ fi
+ warn "uefi-booted system, without grub-efi-amd64 package - /boot/efi will not be updated"
+
+}
+
set -- $DEB_MAINT_PARAMS
mode="${1#\'}"
mode="${mode%\'}"
@@ -228,6 +245,7 @@ case $0:$mode in
BOOT_KVERS="$(boot_kernel_list "$@")"
update_esps
disable_systemd_boot_hook
+ check_grub_efi_package
;;
*/postrm.d/*:|*/postrm.d/*:remove)
reexec_in_mountns "$@"
@@ -235,6 +253,7 @@ case $0:$mode in
BOOT_KVERS="$(boot_kernel_list)"
update_esps
disable_systemd_boot_hook
+ check_grub_efi_package
;;
esac
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH 1/1] pve7to8: check for proper grub meta-package for bootmode
2023-10-04 12:05 [pve-devel] [PATCH kernel-helper/manager] check for fitting grub-meta package on uefi systems Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 1/2] proxmox-boot-tool: do not exit early in kernel-hook Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 2/2] proxmox-boot-tool: check if correct grub metapackage is installed Stoiko Ivanov
@ 2023-10-04 12:05 ` Stoiko Ivanov
2023-10-09 7:11 ` Friedrich Weber
2 siblings, 1 reply; 6+ messages in thread
From: Stoiko Ivanov @ 2023-10-04 12:05 UTC (permalink / raw)
To: pve-devel
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 <s.ivanov@proxmox.com>
---
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..2e2304ea 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH 2/2] proxmox-boot-tool: check if correct grub metapackage is installed
2023-10-04 12:05 ` [pve-devel] [PATCH 2/2] proxmox-boot-tool: check if correct grub metapackage is installed Stoiko Ivanov
@ 2023-10-09 7:07 ` Friedrich Weber
0 siblings, 0 replies; 6+ messages in thread
From: Friedrich Weber @ 2023-10-09 7:07 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
On 04/10/2023 14:05, Stoiko Ivanov wrote:
> diff --git a/src/proxmox-boot/zz-proxmox-boot b/src/proxmox-boot/zz-proxmox-boot
> index 1adc1b1..0d08dbf 100755
> --- a/src/proxmox-boot/zz-proxmox-boot
> +++ b/src/proxmox-boot/zz-proxmox-boot
> @@ -215,6 +215,23 @@ disable_systemd_boot_hook() {
>
> }
>
> +check_grub_efi_package() {
> +
> + if [ -f "${ESP_LIST}" ]; then
> + return
> + fi
> +
> + if [ ! -d /sys/firmware/efi ]; then
> + return
> + fi
> +
> + if [ ! -f /usr/share/doc/grub-efi-amd64/changelog.Debian.gz ]; then
> + return
> + fi
If I understand correctly, this check needs to be inverted, since we do
want to warn if grub-efi-amd64 is *not* installed? (only noticed because
my UEFI-based test machine did not print the warning below on upgrade)
> + warn "uefi-booted system, without grub-efi-amd64 package - /boot/efi will not be updated"
> +
> +}
> +
> set -- $DEB_MAINT_PARAMS
> mode="${1#\'}"
> mode="${mode%\'}"
> @@ -228,6 +245,7 @@ case $0:$mode in
> BOOT_KVERS="$(boot_kernel_list "$@")"
> update_esps
> disable_systemd_boot_hook
> + check_grub_efi_package
> ;;
> */postrm.d/*:|*/postrm.d/*:remove)
> reexec_in_mountns "$@"
> @@ -235,6 +253,7 @@ case $0:$mode in
> BOOT_KVERS="$(boot_kernel_list)"
> update_esps
> disable_systemd_boot_hook
> + check_grub_efi_package
> ;;
> esac
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH 1/1] pve7to8: check for proper grub meta-package for bootmode
2023-10-04 12:05 ` [pve-devel] [PATCH 1/1] pve7to8: check for proper grub meta-package for bootmode Stoiko Ivanov
@ 2023-10-09 7:11 ` Friedrich Weber
0 siblings, 0 replies; 6+ messages in thread
From: Friedrich Weber @ 2023-10-09 7:11 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
On 04/10/2023 14:05, 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"
> );
Nit: The message is printed in one line, might be a bit more readable
with a newline (or full stop/exclamation mark) after "not installed".
> + return;
> + } else {
> + log_pass("bootloader packages installed correctly");
> }
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-10-09 7:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 12:05 [pve-devel] [PATCH kernel-helper/manager] check for fitting grub-meta package on uefi systems Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 1/2] proxmox-boot-tool: do not exit early in kernel-hook Stoiko Ivanov
2023-10-04 12:05 ` [pve-devel] [PATCH 2/2] proxmox-boot-tool: check if correct grub metapackage is installed Stoiko Ivanov
2023-10-09 7:07 ` Friedrich Weber
2023-10-04 12:05 ` [pve-devel] [PATCH 1/1] pve7to8: check for proper grub meta-package for bootmode Stoiko Ivanov
2023-10-09 7:11 ` Friedrich Weber
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