Merge ~mwhudson/ubiquity:lp-1847721 into ubiquity:master

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 84d9b9d25f33c9966b3ee900c605e51aa490db6f
Proposed branch: ~mwhudson/ubiquity:lp-1847721
Merge into: ubiquity:master
Diff against target: 98 lines (+26/-13)
3 files modified
d-i/source/grub-installer/grub-installer (+11/-12)
scripts/plugininstall.py (+7/-0)
ubiquity/components/grubinstaller.py (+8/-1)
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+384069@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Ah this doesn't work, I think perhaps instead of hacking grub-installer like this, it would be easier to just install the packages and run chroot /target grub-install --target=x86_64-efi in the ubiquity code. Open to input here :)

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

So this depends on our goal.

At the moment, it is not possible to install _both_ grub-efi-amd64 and grub-pc, and keep both maintained correctly.

We can install both grub-pc-bin & grub-efi-amd64-bin (& grub-efi-amd64-signed) but only one of them will be updated.

So imho, for now, if we booted in bios mode we should install grub-pc + grub-efi-amd64-bin, run grub-install --target x86_64-efi, and then install grub-efi-amd64-signed.

Revision history for this message
Steve Langasek (vorlon) wrote :

> So imho, for now, if we booted in bios mode we should install
> grub-pc + grub-efi-amd64-bin, run grub-install --target x86_64-efi,
> and then install grub-efi-amd64-signed.

We ought to be installing shim-signed, which pulls in grub-efi-amd64-signed as a dependency; and this will run grub-install --target x86_64-efi for us with the right options. Is there any reason to run grub-install --target x86_64-efi manually?

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I'm putting this review on hold for now, until we have the spec done and have a coherent implementation.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

With some updates to my grub-installer MP I can do an on-rails legacy boot install and then boot it under UEFI. I'm about to push an update towards getting other scenarios to work with some XXX comments I'd love some help with :)

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

with the recent partman-efi changes, the UI complains if you don't create an ESP even when booted in legacy mode, so I think that aspect is OK. But when booted under UEFI, the default partitioning does not create a bios_grub partition and there is no complaint if you don't create one manually. So I think I'll take the "install so legacy boot works when UEFI booted" bits out of this and my grub-installer MP and we can make that work in separate changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/d-i/source/grub-installer/grub-installer b/d-i/source/grub-installer/grub-installer
index 8879dbe..2329f0e 100755
--- a/d-i/source/grub-installer/grub-installer
+++ b/d-i/source/grub-installer/grub-installer
@@ -8,11 +8,16 @@ set -e
8if [ "$1" ]; then8if [ "$1" ]; then
9 ROOT="$1"9 ROOT="$1"
10 chroot=chroot10 chroot=chroot
11 shift
11else12else
12 ROOT=13 ROOT=
13 chroot=14 chroot=
14fi15fi
1516
17if [ "$1" ]; then
18 ARCH="$1"
19fi
20
16. /usr/share/grub-installer/functions.sh21. /usr/share/grub-installer/functions.sh
17. /usr/share/grub-installer/otheros.sh22. /usr/share/grub-installer/otheros.sh
1823
@@ -37,7 +42,7 @@ debug () {
37 [ -z "${DEBCONF_DEBUG}" ] || log "debug: $@"42 [ -z "${DEBCONF_DEBUG}" ] || log "debug: $@"
38}43}
3944
40ARCH="$(archdetect)"45ARCH="${ARCH:-$(archdetect)}"
41info "architecture: $ARCH"46info "architecture: $ARCH"
4247
43umount_dirs=48umount_dirs=
@@ -494,17 +499,7 @@ case $ARCH in
494 if [ -f /var/lib/partman/ignore_uefi ]; then499 if [ -f /var/lib/partman/ignore_uefi ]; then
495 grub_package="grub-pc"500 grub_package="grub-pc"
496 else501 else
497 grub_package="grub-efi"502 grub_package="grub-efi-amd64-signed"
498 # Override the package choice if we can figure out the
499 # right package to use directly
500 if [ -f /sys/firmware/efi/fw_platform_size ] ; then
501 SIZE=$(cat /sys/firmware/efi/fw_platform_size)
502 if [ $SIZE -eq 64 ] ; then
503 grub_package="grub-efi-amd64-signed"
504 elif [ $SIZE -eq 32 ] ; then
505 grub_package="grub-efi-ia32"
506 fi
507 fi
508 if [ ! -d /target/boot/efi ]; then503 if [ ! -d /target/boot/efi ]; then
509 # No EFI System Partition, so presumably the partitioner504 # No EFI System Partition, so presumably the partitioner
510 # believed this to be unnecessary, perhaps because we're505 # believed this to be unnecessary, perhaps because we're
@@ -1094,6 +1089,10 @@ EOF
1094 grub_install_params="$grub_install_params --force"1089 grub_install_params="$grub_install_params --force"
1095 fi1090 fi
10961091
1092 if [ "$ARCH" = "amd64/efi" ] ; then
1093 grub_install_params="$grub_install_params --target x86_64-efi"
1094 fi
1095
1097 CODE=01096 CODE=0
1098 case $ARCH:$grub_package in1097 case $ARCH:$grub_package in
1099 *:grub|*:grub-pc|*:grub-efi*|sparc:grub-ieee1275|ppc64el/*:grub-ieee1275)1098 *:grub|*:grub-pc|*:grub-efi*|sparc:grub-ieee1275|ppc64el/*:grub-ieee1275)
diff --git a/scripts/plugininstall.py b/scripts/plugininstall.py
index 53461ad..e9acdc9 100755
--- a/scripts/plugininstall.py
+++ b/scripts/plugininstall.py
@@ -945,6 +945,13 @@ class Install(install_misc.InstallBase):
945 self.db.set('grub-installer/bootdev', response)945 self.db.set('grub-installer/bootdev', response)
946 else:946 else:
947 break947 break
948 if arch == 'amd64' and subarch != 'efi':
949 dbfilter = grubinstaller.GrubInstaller(
950 None, self.db, extra_args=['amd64/efi'])
951 ret = dbfilter.run_command(auto_process=True)
952 if ret != 0:
953 raise install_misc.InstallStepError(
954 "GrubInstaller failed with code %d" % ret)
948 else:955 else:
949 raise install_misc.InstallStepError(956 raise install_misc.InstallStepError(
950 "No bootloader installer found")957 "No bootloader installer found")
diff --git a/ubiquity/components/grubinstaller.py b/ubiquity/components/grubinstaller.py
index 8c1af85..774d7cb 100644
--- a/ubiquity/components/grubinstaller.py
+++ b/ubiquity/components/grubinstaller.py
@@ -22,8 +22,15 @@ from ubiquity.filteredcommand import FilteredCommand
2222
2323
24class GrubInstaller(FilteredCommand):24class GrubInstaller(FilteredCommand):
25 def __init__(self, frontend, db=None, ui=None, extra_args=None):
26 super().__init__(frontend, db, ui)
27 self.extra_args = extra_args
28
25 def prepare(self):29 def prepare(self):
26 return (['/usr/share/grub-installer/grub-installer', '/target'],30 cmd = ['/usr/share/grub-installer/grub-installer', '/target']
31 if self.extra_args is not None:
32 cmd.extend(self.extra_args)
33 return (cmd,
27 ['^grub-installer/bootdev$', 'ERROR'],34 ['^grub-installer/bootdev$', 'ERROR'],
28 {'OVERRIDE_UNSUPPORTED_OS': '1'})35 {'OVERRIDE_UNSUPPORTED_OS': '1'})
2936

Subscribers

People subscribed via source and target branches