Bug#923612: grub-pc: grub-install failure leaves package in unrecoverable broken state

Uoti Urpala uoti.urpala at pp1.inet.fi
Sat Mar 2 19:56:48 GMT 2019


Package: grub-pc
Version: 2.02+dfsg1-11
Severity: normal

>From logs, the following events seem to have happened:

grub-pc was upgraded under unattended-upgrades. This was when the udev
bug changed disk path. Grub-pc appears to have tried installing in the
old nonexistent path; I assume this part depended on unattended-
upgrades not allowing it to use debconf to ask for a new path. Apt logs
only show "grub-install: error: cannot find a GRUB drive for ...".
After this, no core.img file existed on the machine. grub-pc.postinst
uses the existence of a core.img file to determine the kind of
installation the machine has; with it absent, the package entered a
permanently broken state where further upgrades or dpkg-reconfigure did
nothing.

There are at least two things here which can be considered bugs:

1. If there is no interactive debconf frontend available, the package
goes ahead and calls grub-install with known incorrect arguments.

2. Using the existence of core.img to determine the type of install is
too fragile when this file can be erased by a failed grub-install call,
and after this happens the package state can not be recovered by normal
means (I used a manual grub-install call to restore the file).


I haven't tried reproducing problem 1. Bug 2 can be mostly reproduced
by manually running "grub-install /dev/wtf"; after running that, you
can see that "dpkg-reconfigure grub-pc" no longer works.


BTW the grub-install manual page lists most options, then repeats the
"Install GRUB on your drive." description, and lists the same options
again.



More information about the Pkg-grub-devel mailing list