From 7eb70becd3c91d0fdf411aeddc93d156d2fa2ecf Mon Sep 17 00:00:00 2001 From: "Jane.zhang" Date: Sun, 15 Nov 2015 23:39:07 -0800 Subject: [PATCH] Fix grub-efi-amd64-signed install failure When build ubuntu iso image, it will install grub-efi-amd64-signed and grub-efi-amd64 packages. Both of the postinst script will try to find root device and install grub which will definitely fail in such a chroot environment. So the workaround is to skip error and remove postinst script. And confirm the package be installed successfully at last. Change-Id: Ie0aecb212b22362046db55b5ad8c64c3211c28e5 Closes-Bug: #1491280 Co-Authored-By: Jane.zhang --- elements/grub2/install.d/02-grub-install-spec | 19 +++++++++++++++++++ elements/grub2/pkg-map | 7 +++++++ 2 files changed, 26 insertions(+) create mode 100755 elements/grub2/install.d/02-grub-install-spec diff --git a/elements/grub2/install.d/02-grub-install-spec b/elements/grub2/install.d/02-grub-install-spec new file mode 100755 index 000000000..3e79361af --- /dev/null +++ b/elements/grub2/install.d/02-grub-install-spec @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# grub-efi-amd64-signed in ubuntu post will try to call grub-efi-amd64 to install grub into root +# device which definitely fail at this stage +# the workaround is to skip error and remove postinst script +if [[ "ubuntu" =~ "$DISTRO_NAME" ]]; then + if ! install-packages grub-efi-amd64-signed; then + rm -f /var/lib/dpkg/info/grub-efi-amd64-signed.postinst + rm -f /var/lib/dpkg/info/grub-efi-amd64.postinst + fi + dpkg --configure grub-efi-amd64 + dpkg --configure grub-efi-amd64-signed +fi diff --git a/elements/grub2/pkg-map b/elements/grub2/pkg-map index 74a7baadf..565353322 100644 --- a/elements/grub2/pkg-map +++ b/elements/grub2/pkg-map @@ -1,4 +1,11 @@ { + "distro":{ + "ubuntu":{ + "signed_grub_efi": "", + "signed_shim_efi": "shim-signed", + "grub_bios": "grub-pc-bin" + } + }, "family":{ "debian":{ "signed_grub_efi": "grub-efi-amd64-signed",