all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [RFC proxmox-kernel-helper] zz-proxmox-boot: check removable status
@ 2025-03-04 10:55 Fabian Grünbichler
  2025-03-04 15:11 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2025-03-04 10:55 UTC (permalink / raw)
  To: pve-devel

if a fallback bootloader is installed, but the Grub packages are not set
up to manage it, inform the user about it. this setup is problematic if
the fallback bootloader is used as boot option (now or in the future),
so it's best to fix it up before a problem occurs.

for proxmox-boot-tool managed ESPs, we always install both when
(re)initing the ESPs, this only affects setup with a regular,
always-mounted, single ESP, such as ext4 on top of LVM.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
not sure whether this is the place we want to do this check in,
suggestions for that or wording welcome ;)

 src/proxmox-boot/zz-proxmox-boot | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/proxmox-boot/zz-proxmox-boot b/src/proxmox-boot/zz-proxmox-boot
index 09f9171..b5bd57d 100755
--- a/src/proxmox-boot/zz-proxmox-boot
+++ b/src/proxmox-boot/zz-proxmox-boot
@@ -243,6 +243,34 @@ check_grub_efi_package() {
 	warn "Install 'grub-efi-amd64' to get updates."
 }
 
+check_grub_efi_removable_status() {
+	# not booted in EFI, no need to care about removable bootloader
+	if [ ! -d /sys/firmware/efi ]; then
+		return
+	fi
+
+	# no removable bootloader
+	if [ ! -f "/boot/efi/EFI/BOOT/BOOTX64.efi" ]; then
+		return
+	fi
+
+	debconf_value="$(debconf-show --db configdb grub-efi-amd64 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
+		return
+	fi
+
+	echo ""
+	echo "Removable bootloader at '/boot/efi/EFI/BOOT/BOOTX64.efi' found, 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 "Followed by re-installing Grub with 'apt install --reinstall grub-efi-amd64'"
+	echo ""
+}
+
 set -- $DEB_MAINT_PARAMS
 mode="${1#\'}"
 mode="${mode%\'}"
@@ -257,6 +285,7 @@ case $0:$mode in
 		update_esps
 		disable_systemd_boot_hook
 		check_grub_efi_package
+		check_grub_efi_removable_status
 	;;
 	 */postrm.d/*:|*/postrm.d/*:remove)
 		reexec_in_mountns "$@"
@@ -265,6 +294,7 @@ case $0:$mode in
 		update_esps
 		disable_systemd_boot_hook
 		check_grub_efi_package
+		check_grub_efi_removable_status
 	;;
 esac
 
-- 
2.39.5



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

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

* [pve-devel] applied: [RFC proxmox-kernel-helper] zz-proxmox-boot: check removable status
  2025-03-04 10:55 [pve-devel] [RFC proxmox-kernel-helper] zz-proxmox-boot: check removable status Fabian Grünbichler
@ 2025-03-04 15:11 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-03-04 15:11 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

Am 04.03.25 um 11:55 schrieb Fabian Grünbichler:
> if a fallback bootloader is installed, but the Grub packages are not set
> up to manage it, inform the user about it. this setup is problematic if
> the fallback bootloader is used as boot option (now or in the future),
> so it's best to fix it up before a problem occurs.
> 
> for proxmox-boot-tool managed ESPs, we always install both when
> (re)initing the ESPs, this only affects setup with a regular,
> always-mounted, single ESP, such as ext4 on top of LVM.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> not sure whether this is the place we want to do this check in,
> suggestions for that or wording welcome ;)
> 
>  src/proxmox-boot/zz-proxmox-boot | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
>

applied, with minor wording changes as follow-up, thanks!


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

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

end of thread, other threads:[~2025-03-04 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04 10:55 [pve-devel] [RFC proxmox-kernel-helper] zz-proxmox-boot: check removable status Fabian Grünbichler
2025-03-04 15:11 ` [pve-devel] applied: " Thomas Lamprecht

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