grub-pc debconf empty RAW_CHOICES entry causing install failure
J.A. Bezemer
j.a.bezemer at opensourcepartners.nl
Thu Mar 4 22:18:21 GMT 2021
Hi all,
Given the enormous amount of open grub-pc bugs, I won't even bother
filing a new one. Just hoping Google finds this for people in similar
situations.
Grub-pc current buster 2.02+dfsg1-20+deb10u4, and many earlier versions.
On my semi-weird setup, grub-pc.postinst does this:
+++ grub-probe -t device /
++ partition='/dev/sda1
/dev/sdb1'
[...]
+ partitions=/:
Below '# Some "partitions" may in fact be at the disk level',
this gives an empty $partition_id, which is not checked for,
and results in adding an empty entry to RAW_CHOICES
and corresponding entry "(??? MB; ???)" to CHOICES
for the grub-pc/install_devices template.
In my case, the empty entry is at the end, and the preceding entry is a
selected one. Due to debconf weirdness, a comma at the end of
RAW_CHOICES is apparently not interpreted as separator, but as part of
the last entry value, and is copied to debconf Value: value and handled
similarly again.
So I end up with grub install being attempted to
"/dev/disk/by-id/ata-whatever," INCLUDING that comma. Of course, this
will never work, and always causes grub upgrades to fail and require
manual grub-install.
Fix can be in many places, see below for one idea that works. Also
includes a case match fix that I spotted, but that wouldn't have helped
in my situation.
Best regards,
Anne Bezemer
--- grub-pc.postinst.orig 2021-03-04 22:32:55.220409342 +0100
+++ grub-pc.postinst 2021-03-04 22:33:14.616684848 +0100
@@ -550,9 +550,9 @@
# List these as well if they haven't already been listed.
for partition_pair in $partitions; do
partition_id="${partition_pair#*:}"
- if [ "${partition_id#*-part}" = "$partition_id" ]; then
+ if [ -n "$partition_id" ] && [ "${partition_id#*-part}" = "$partition_id" ]; then
case ", $ids, " in
- ", $partition_id, ") ;;
+ *", $partition_id, "*) ;;
*)
ids="${ids:+$ids, }$partition_id"
describe_disk "$(readlink -f "$partition_id")" "$partition_id"
More information about the Pkg-grub-devel
mailing list