Bug#694495: grub2: avoid updating when in chroot
Hector Oron
zumbi at debian.org
Mon Nov 26 22:59:25 UTC 2012
Package: grub2
Version: 2.00-7
Severity: wishlist
Tags: patch
Hello,
When attempting to generate x86 images, linux kernel tries to run grub hook and fails:
Setting up grub-pc (1.99-21ubuntu3) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Creating config file /etc/default/grub with new version
grub-probe: error: cannot find a device for / (is /dev mounted?).
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
Configuring grub-pc
-------------------
grub-probe: error: cannot find a device for / (is /dev mounted?).
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
You chose not to install GRUB to any devices. If you continue, the boot loader may not be properly configured, and when this
computer next starts up it will use whatever was previously in the boot sector. If there is an earlier version of GRUB 2 in
the boot sector, it may be unable to load modules or handle the current configuration file.
If you are already using a different boot loader and want to carry on doing so, or if this is a special environment where
you do not need a boot loader, then you should continue anyway. Otherwise, you should install GRUB somewhere.
Continue without installing GRUB? No
grub-probe: error: cannot find a device for / (is /dev mounted?).
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
You chose not to install GRUB to any devices. If you continue, the boot loader may not be properly configured, and when this
computer next starts up it will use whatever was previously in the boot sector. If there is an earlier version of GRUB 2 in
the boot sector, it may be unable to load modules or handle the current configuration file.
If you are already using a different boot loader and want to carry on doing so, or if this is a special environment where
you do not need a boot loader, then you should continue anyway. Otherwise, you should install GRUB somewhere.
Continue without installing GRUB? Yes
/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
dpkg: error processing grub-pc (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of grub-gfxpayload-lists:
grub-gfxpayload-lists depends on grub-pc (>= 1.99~20101210-1ubuntu2); however:
Package grub-pc is not configured yet.
dpkg: error processing grub-gfxpayload-lists (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub2:
grub2 depends on grub-pc (= 1.99-21ubuntu3); however:
Package grub-pc is not configured yet.
dpkg: error processing grub2 (--configure):
dependency problems - leaving unconfigured
the following patch attempts to fix this issue:
diff -Nru grub2-2.00/debian/kernel/zz-update-grub grub2-2.00/debian/kernel/zz-update-grub
--- grub2-2.00/debian/kernel/zz-update-grub 2010-12-07 10:49:25.000000000 +0100
+++ grub2-2.00/debian/kernel/zz-update-grub 2012-11-26 23:41:02.000000000 +0100
@@ -1,6 +1,13 @@
#! /bin/sh
set -e
+## fixup to avoid updating grub when in chroot.
+if `ischroot`
+then
+ echo "running in a chroot, exiting..."
+ exit 0
+fi
+
which update-grub >/dev/null 2>&1 || exit 0
set -- $DEB_MAINT_PARAMS
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (900, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 3.2.0-2-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
More information about the Pkg-grub-devel
mailing list