/etc/kernel/postinst.d/zz-update-grub triggers a grub update in lxc containers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
Fix Released
|
Undecided
|
Colin Watson |
Bug Description
Before anyone points it out, this is NOT a duplicate of bug 1060404, just a different but extremely similar problem :)
So I'm doing 12.10 => 13.04 desktop upgrade testing in a container. That means setting up a full dekstop 12.10 system, including grub and kernel, then dist-upgrading that to 13.04.
In the past, this used to fail because of bug 1060404 but now that it's been fixed, I'm getting into a different problem bcause of zz-update-grub calling update-grub, bypassing the check added to grub's postinst and causing a similar error:
===
Setting up linux-image-
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/
run-parts: executing /etc/kernel/
run-parts: executing /etc/kernel/
update-initramfs: Generating /boot/initrd.
cryptsetup: WARNING: could not determine root device from /etc/fstab
run-parts: executing /etc/kernel/
run-parts: executing /etc/kernel/
run-parts: executing /etc/kernel/
/usr/sbin/
run-parts: /etc/kernel/
Failed to process /etc/kernel/
dpkg: error processing linux-image-
subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of linux-image-
linux-
Package linux-image-
dpkg: error processing linux-image-
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of linux-image-
linux-
Package linux-image-
linux-
Package linux-image-
dpkg: error processing linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 3.8.0.1.14); however:No apport report written because MaxReports is reached already
Package linux-image-generic is not configured yet.
dpkg: error processing linux-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-
linux-
linux-
linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
===
Proposed ways of fixing this as discussed in #ubuntu-devel include:
- Make update-grub exit 0 if running-
- Patch just zz-update-grub with a similar check
- Make the scripts check for the presence of the device and only then attempt to read/write to it (but limit that check to containers)
1. Patching zz-update-grub is almost certainly the wrong answer, as manual runs of update-grub(1) or, indeed, anything else that might call it that we've not noticed yet, will show exactly the same issue.
2. Exiting update-grub 0 on containers seems like a sane workaround, but probably long-term silly. And workarounds often end up as long-term tech debt.
3. Fixing it somehow magically in grub-probe sounds appealing, until we realise that there'd be no way for grub-probe to tell update-grub "well, I looked, but couldn't find anything useful for you" without either exiting non-zero (which is exactly what it does right now) or returning completely bogus info for you to later write to you grub config (ewww).
Given the above, the second option seems the simplest and sanest for now, with an enormous FIXME comment on it, mentioning that lxc is meant to get device namespaces "some day", and when that happens, this can probably be revisited. Thoughts?