migrating grub from BIOS to UEFI loses /etc/default/grub

Pascal Hambourg pascal at plouf.fr.eu.org
Thu May 30 14:16:53 BST 2024


Hello GRUB maintainers,

This is a digest of a thread started in the debian-boot list.
<https://lists.debian.org/debian-boot/2024/05/msg00110.html>

On 24/05/2024 at 11:08, Harald Dunkel wrote:
> if I migrate a bookworm installation from grub-pc to grub-uefi,
> then grub-pc.postrm removes /etc/default/grub on the final purge.
> 
> AFAICT /etc/default/grub is still processed for UEFI, so why
> is it deleted?

On 2024-05-24 20:36:41, Pascal Hambourg wrote:
> It is a known bug. At the very least, /etc/default/grub should be 
> removed only if it belongs to the package being purged. But it would 
> solve your issue only if postinst configure (taking ownership) happens 
> before postrm purge.
> 
> In the end I believe /etc/default/grub should be owned by grub2-common, 
> not by each grub-<target> package.

On 26/05/2024 à 16:08, Harald Dunkel wrote:
> This is a highly destructive bug. You have UEFI boot finally working,
> you just do some cleanup, and on the next reboot of your server 8
> weeks later it doesn't boot anymore. :-(

On 26/05/2024 at 18:10, Felix Zielcke wrote:
> yes, this should probably be moved to grub2-common

On 28/05/2024 at 00:16, Pascal Hambourg wrote:
> On the other hand, I doubt many users care to purge the old grub package 
> after installing another grub flavour. But I agree this should be fixed 
> anyway. There are several options:
> 
> - Remove /etc/default/grub only if it is associated with the package 
> being purged in ucf.
> 
> - Do not remove /etc/default/grub when purging package-<target> because 
> it is used by grub-install and update-grub which belong to grub2-common; 
> only remove it from ucf registry if it is associated with the package 
> being purged.
> 
> Also, it appears that grub-pc.postrm purge optionally removes files in 
> /boot/grub which may have been installed for other grub targets 
> (grub.cfg, fonts, locales, device.map, grubenv, background image cache).
> My opinion is that postrm should not touch /boot/grub at all. After all, 
> it does not remove GRUB boot image and core image nor EFI partition 
> contents.
> 
> Grub-team people, any comments ?

On 30/05/2024 at 12:07, Felix Zielcke wrote:
> I did now a MR for this:
> 
> https://salsa.debian.org/grub-team/grub/-/merge_requests/62
> 
> /boot/grub for grub-pc is only purged if debconf has
> grub-pc/postrm_purge_boot_grub == true

This value is set by a debconf question. But the user may not be aware 
of all the consequences.

> But I don't know the reason why unicode.pf2 is purged for grub-efi-
> {amd64,i386}

AFAICS it was added for symmetry with what the postinst script does for 
grub-efi-*, and at the time (2013) only grub-efi-amd64 and grub-efi-ia32 
existed. Cf. bug #697183 
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=697183>.
But I wonder if copying the fonts in /boot/grub is still useful because 
grub-install already copies them in /boot/grub/fonts.



More information about the Pkg-grub-devel mailing list