divert grub when calling into lb chroot

UbuntuStudio image builds have recently begun failing as a result of adding a
grub theme customization to their flavor, which they then try to apply by
running update-grub from their maintainer scripts.  This fails with:

  Setting up plymouth-theme-ubuntustudio (0.57) ...
  update-alternatives: using /usr/share/plymouth/themes/ubuntustudio-logo/ubuntustudio-logo.plymouth to provide /usr/share/plymouth/themes/default.plymouth (default.plymouth) in auto mode
  update-alternatives: using /usr/share/plymouth/themes/ubuntustudio-text/ubuntustudio-text.plymouth to provide /usr/share/plymouth/themes/text.plymouth (text.plymouth) in auto mode
  update-initramfs: diverted by livecd-rootfs (will be called later)
  /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
  dpkg: error processing package plymouth-theme-ubuntustudio (--configure):
   installed plymouth-theme-ubuntustudio package post-installation script subprocess returned error exit status 1

Packages providing grub themes should be able to call update-grub from their
maintainer scripts, and they should be able to be installed under
livecd-rootfs.  It's surprising to me that this hasn't been a problem before
now for any flavors.

We know that grub-probe should not be called as part of an image build, so
just use our standard helper function to divert it before running the chroot
stage and undivert it after.
snap-tool-base-none
Steve Langasek 6 years ago
parent 3cebce2fb9
commit ea5f01942f

4
debian/changelog vendored

@ -4,6 +4,10 @@ livecd-rootfs (2.568) UNRELEASED; urgency=medium
* Make sure snap-tool exits with non-zero exit status, if a problem
occurred.
[ Steve Langasek ]
* divert grub when calling into lb chroot, to avoid any problems from
grub-probe.
-- Tobias Koch <tobias.koch@canonical.com> Wed, 27 Feb 2019 10:16:46 +0100
livecd-rootfs (2.567) disco; urgency=medium

@ -261,12 +261,14 @@ EOF
chmod +x chroot/usr/bin/man
fi
divert_grub chroot
if [ -n "${PASSES}" ]; then
PATH="config/:$PATH" lb chroot_layered "$@"
else
divert_update_initramfs
lb chroot "$@"
fi
undivert_grub chroot
# Let all configuration non multi-layered project here.
# If those are moving to a multi-layer layout, this needs to be

Loading…
Cancel
Save