public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arran Cudbard-Bell <a.cudbardb@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Arran Cudbard-Bell <a.cudbardb@gmail.com>
Subject: [PATCH proxmox-kernel-helper v2] fix #8395: proxmox-boot: select the GRUB EFI target by architecture
Date: Wed,  2 Dec 2026 10:33:04 -0500	[thread overview]
Message-ID: <20261202153304.65224-1-a.cudbardb@gmail.com> (raw)

Select the GRUB EFI target, binary suffix, removable loader name and
meta-package by dpkg architecture, because the hardcoded x86_64 values
made proxmox-boot-tool init fail on arm64 with Secure Boot and a ZFS
root.

Signed-off-by: Arran Cudbard-Bell <a.cudbardb@gmail.com>
---
 src/bin/proxmox-boot-tool        | 10 +++++-----
 src/proxmox-boot/functions       | 16 ++++++++++++++++
 src/proxmox-boot/zz-proxmox-boot | 18 +++++++++---------
 3 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/bin/proxmox-boot-tool b/src/bin/proxmox-boot-tool
index 2632f64..474d1ed 100755
--- a/src/bin/proxmox-boot-tool
+++ b/src/bin/proxmox-boot-tool
@@ -162,7 +162,7 @@ init_bootloader() {
 	mount -t vfat -o umask=0077 "$part" "$esp_mp"
 
 	if [ -z "$mode" ]; then
-		if [ -e "$esp_mp/EFI/proxmox/grubx64.efi" ]; then
+		if [ -e "$esp_mp/EFI/proxmox/grub${EFI_ARCH_SUFFIX}.efi" ]; then
 			# for reinit support
 			mode=grub
 		fi
@@ -176,18 +176,18 @@ init_bootloader() {
 			cp "/boot/$memtest" "$esp_mp/"
 		fi
 		if [ -n "$mode" ] && [ "$mode" = "grub" ]; then
-			echo "Installing grub x86_64 target.."
+			echo "Installing grub ${GRUB_EFI_TARGET} target.."
 			grub-install.real \
 				--boot-directory "${esp_mp}" \
-				--target x86_64-efi \
+				--target "${GRUB_EFI_TARGET}" \
 				--no-floppy \
 				--efi-directory "${esp_mp}" \
 				--bootloader-id 'proxmox' \
 				"/dev/$PKNAME"
-			echo "Installing grub x86_64 target (removable).."
+			echo "Installing grub ${GRUB_EFI_TARGET} target (removable).."
 			grub-install.real \
 				--boot-directory "${esp_mp}" \
-				--target x86_64-efi \
+				--target "${GRUB_EFI_TARGET}" \
 				--no-floppy \
 				--efi-directory "${esp_mp}" \
 				--removable \
diff --git a/src/proxmox-boot/functions b/src/proxmox-boot/functions
index bd9f735..b0e4636 100755
--- a/src/proxmox-boot/functions
+++ b/src/proxmox-boot/functions
@@ -14,6 +14,22 @@ PMX_ESP_DIR="EFI/proxmox"
 PMX_LOADER_CONF="loader/loader.conf"
 GRUB_PIN_SNIPPET="/etc/default/grub.d/proxmox-kernel-pin.cfg"
 
+# The GRUB EFI target and file names depend on the architecture.
+case "$(dpkg --print-architecture)" in
+	arm64)
+		GRUB_EFI_TARGET='arm64-efi'
+		EFI_ARCH_SUFFIX='aa64'
+		EFI_REMOVABLE_LOADER='BOOTAA64.EFI'
+		GRUB_EFI_PACKAGE='grub-efi-arm64'
+		;;
+	*)
+		GRUB_EFI_TARGET='x86_64-efi'
+		EFI_ARCH_SUFFIX='x64'
+		EFI_REMOVABLE_LOADER='BOOTX64.efi'
+		GRUB_EFI_PACKAGE='grub-efi-amd64'
+		;;
+esac
+
 # adapted from /etc/kernel/postinst.d/apt-auto-removal as present in
 # debian's apt package:
 #
diff --git a/src/proxmox-boot/zz-proxmox-boot b/src/proxmox-boot/zz-proxmox-boot
index f1d51fa..dd20a18 100755
--- a/src/proxmox-boot/zz-proxmox-boot
+++ b/src/proxmox-boot/zz-proxmox-boot
@@ -80,7 +80,7 @@ update_esp_func() {
 
 	# reset per ESP, an earlier GRUB ESP must not decide the mode of this one
 	grub=
-	if [ -e "${mountpoint}/EFI/proxmox/grubx64.efi" ]; then
+	if [ -e "${mountpoint}/EFI/proxmox/grub${EFI_ARCH_SUFFIX}.efi" ]; then
 		grub=1
 	fi
 	if [ -d /sys/firmware/efi ] && [ "$grub" != 1 ]; then
@@ -237,12 +237,12 @@ check_grub_efi_package() {
 		return
 	fi
 
-	if [ -f /usr/share/doc/grub-efi-amd64/changelog.Debian.gz ]; then
+	if [ -f "/usr/share/doc/${GRUB_EFI_PACKAGE}/changelog.Debian.gz" ]; then
 		return
 	fi
 
-	warn "System booted in EFI-mode but 'grub-efi-amd64' meta-package not installed!"
-	warn "Install 'grub-efi-amd64' to get updates."
+	warn "System booted in EFI-mode but '${GRUB_EFI_PACKAGE}' meta-package not installed!"
+	warn "Install '${GRUB_EFI_PACKAGE}' to get updates."
 }
 
 check_grub_efi_removable_status() {
@@ -252,11 +252,11 @@ check_grub_efi_removable_status() {
 	fi
 
 	# no removable bootloader
-	if [ ! -f "/boot/efi/EFI/BOOT/BOOTX64.efi" ]; then
+	if [ ! -f "/boot/efi/EFI/BOOT/${EFI_REMOVABLE_LOADER}" ]; then
 		return
 	fi
 
-	debconf_value="$(debconf-show --db configdb grub-efi-amd64 grub-pc | grep 'force_efi_extra_removable')"
+	debconf_value="$(debconf-show --db configdb "${GRUB_EFI_PACKAGE}" grub-pc | grep 'force_efi_extra_removable')"
 
 	# packages already set up to install a removable copy, let's trust that it works
 	if echo "${debconf_value}" | grep -qE ': true$'; then
@@ -264,12 +264,12 @@ check_grub_efi_removable_status() {
 	fi
 
 	echo ""
-	echo "Removable bootloader found at '/boot/efi/EFI/BOOT/BOOTX64.efi', but GRUB packages not set up to update it!"
+	echo "Removable bootloader found at '/boot/efi/EFI/BOOT/${EFI_REMOVABLE_LOADER}', but GRUB packages not set up to update it!"
 	echo "Run the following command:"
 	echo ""
-	echo "echo 'grub-efi-amd64 grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u"
+	echo "echo '${GRUB_EFI_PACKAGE} grub2/force_efi_extra_removable boolean true' | debconf-set-selections -v -u"
 	echo ""
-	echo "Then reinstall GRUB with 'apt install --reinstall grub-efi-amd64'"
+	echo "Then reinstall GRUB with 'apt install --reinstall ${GRUB_EFI_PACKAGE}'"
 	echo ""
 }
 
-- 
2.53.0




             reply	other threads:[~2026-12-02 15:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 15:33 Arran Cudbard-Bell [this message]
2026-12-02 21:17 ` applied: [PATCH proxmox-kernel-helper v2] fix #8395: proxmox-boot: select the GRUB EFI target by architecture Thomas Lamprecht

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=20261202153304.65224-1-a.cudbardb@gmail.com \
    --to=a.cudbardb@gmail.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 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