Bug#1017750: multiboot friendly /boot/efi/EFI/debian/grub.cfg update
Osamu Aoki
osamu at debian.org
Fri Aug 19 20:51:27 BST 2022
Package: grub-efi-amd64
Version: 2.06-3
Severity: wishlist
Currently, if you have dual boot of 2 Debian system installations, every
time grub2 of one system runs postinst, it overwrites
/boot/efi/EFI/debian/grub.cfg file in ESP pointing search.fs_uuid
pointing to lead to /boot/grub/* by UUID.
It doesn't backup existing /boot/efi/EFI/debian/grub.cfg.
If you consider this to be the result of upstream feature of update-grub
then it will be tough to be fixed.
But can you think of updating Debian postinst script to check the
existence of the /boot/efi/EFI/debian/grub.cfg file first and back it
up? This helps recovery of system and trivial to be implemented.
I prefer time-stamped string as suffix for the backup file but this can
be anything maintainer likes.
This way, we can easily select /boot/grub/* after crash without manually
typing UUID. Having at least 2 or 3 stage backups is more friendly.
-- Package-specific info:
*********************** BEGIN /proc/mounts
/dev/nvme0n1p5 / btrfs rw,relatime,ssd,space_cache,subvolid=22924,subvol=/@rootfs 0 0 <--- This is my main @rootfs
/dev/nvme0n1p5 /btrfs/main btrfs rw,relatime,ssd,space_cache,subvolid=5,subvol=/ 0 0
/dev/nvme0n1p5 /home/osamu btrfs rw,relatime,ssd,space_cache,subvolid=596,subvol=/@osamu 0 0
/dev/nvme1n1p1 /btrfs/sub btrfs rw,relatime,ssd,space_cache,subvolid=5,subvol=/ 0 0 <--- This partition holds 2nd @rootfs
/dev/nvme0n1p1 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 0 <--- ESP
*********************** END /proc/mounts
*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
.... (snip uninteresting part)
.... Followings are my custom dual boot configuration
### BEGIN /etc/grub.d/40_fixed_linux ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Debian GNU/Linux --- main SSD' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-fixed-fe3e1db5-6454-46d6-a14c-071208ebe4b1' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod btrfs
search --no-floppy --fs-uuid --set=root fe3e1db5-6454-46d6-a14c-071208ebe4b1
echo 'Loading Linux from /dev/nvme0n1p5 ...'
linux /@rootfs/vmlinuz root=UUID=fe3e1db5-6454-46d6-a14c-071208ebe4b1 ro rootflags=subvol=@rootfs quiet
echo 'Loading initial ramdisk from /dev/nvme0n1p5 ...'
initrd /@rootfs/initrd.img
}
menuentry 'Debian GNU/Linux --- sub SSD' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-fixed-51f9cd11-30b3-4d99-b2ed-fe411fa22ee6' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod btrfs
search --no-floppy --fs-uuid --set=root 51f9cd11-30b3-4d99-b2ed-fe411fa22ee6
echo 'Loading Linux from /dev/nvme1n1p1 ...'
linux /@rootfs/vmlinuz root=UUID=51f9cd11-30b3-4d99-b2ed-fe411fa22ee6 ro rootflags=subvol=@rootfs quiet
echo 'Loading initial ramdisk from /dev/nvme1n1p1 ...'
initrd /@rootfs/initrd.img
}
### END /etc/grub.d/40_fixed_linux ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###
*********************** END /boot/grub/grub.cfg
-- System Information:
Debian Release: bookworm/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 5.18.0-4-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages grub-efi-amd64 depends on:
ii debconf [debconf-2.0] 1.5.79
ii grub-common 2.06-3
ii grub-efi-amd64-bin 2.06-3
ii grub2-common 2.06-3
ii ucf 3.0043
grub-efi-amd64 recommends no packages.
grub-efi-amd64 suggests no packages.
-- debconf information:
grub2/kfreebsd_cmdline:
* grub2/linux_cmdline:
* grub2/force_efi_extra_removable: false
* grub2/update_nvram: true
* grub2/linux_cmdline_default: quiet
grub2/kfreebsd_cmdline_default: quiet
More information about the Pkg-grub-devel
mailing list