Merge ~ubuntu-core-dev/grub/+git/ubuntu:os-prober-auto into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Julian Andres Klode
Status: Merged
Merged at revision: 533c36f6fcf1d4c1a800e23560e82357b2351b2f
Proposed branch: ~ubuntu-core-dev/grub/+git/ubuntu:os-prober-auto
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 66 lines (+52/-0)
2 files modified
debian/patches/series (+1/-0)
debian/patches/ubuntu-os-prober-auto.patch (+51/-0)
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team Pending
Review via email: mp+415683@code.launchpad.net

This proposal supersedes a proposal from 2022-02-16.

To post a comment you must log in.
Revision history for this message
Dan Bungert (dbungert) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/patches/series b/debian/patches/series
2index 0f2405b..3962a7c 100644
3--- a/debian/patches/series
4+++ b/debian/patches/series
5@@ -109,3 +109,4 @@ no-devicetree-if-secure-boot.patch
6 0105-efilinux-Fix-integer-overflows-in-grub_cmd_initrd.patch
7 ubuntu-verifiers-last.patch
8 ubuntu-fuse3.patch
9+ubuntu-os-prober-auto.patch
10diff --git a/debian/patches/ubuntu-os-prober-auto.patch b/debian/patches/ubuntu-os-prober-auto.patch
11new file mode 100644
12index 0000000..9c141e7
13--- /dev/null
14+++ b/debian/patches/ubuntu-os-prober-auto.patch
15@@ -0,0 +1,51 @@
16+From: Julian Andres Klode <julian.klode@canonical.com>
17+Date: Wed, 16 Feb 2022 17:19:45 +0100
18+Subject: UBUNTU: os-prober: Enable on first run or if last run produced
19+ results
20+
21+To not break existing use cases, if we install alongside another OS
22+let's keep running os-prober. For this, introduce an auto mode that
23+determines whether we are (a) a new install or (b) have previously
24+added any os-prober items.
25+
26+This patch is not optimal, and it might be nicer to handle this in
27+installers and the release upgrader, but that involves touching a
28+lot more packages and means we'd also have that policy in multiple
29+places, which is detrimental if we want to change it again.
30+
31+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1955109
32+---
33+ util/grub-mkconfig.in | 2 +-
34+ util/grub.d/30_os-prober.in | 6 ++++++
35+ 2 files changed, 7 insertions(+), 1 deletion(-)
36+
37+diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
38+index a8c247a..21d28f1 100644
39+--- a/util/grub-mkconfig.in
40++++ b/util/grub-mkconfig.in
41+@@ -141,7 +141,7 @@ GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
42+ GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
43+
44+ # Disable os-prober by default due to security reasons.
45+-GRUB_DISABLE_OS_PROBER="true"
46++GRUB_DISABLE_OS_PROBER="auto"
47+
48+ # Filesystem for the device containing our userland. Used for stuff like
49+ # choosing Hurd filesystem module.
50+diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
51+index 225a3ba..5eb44d1 100644
52+--- a/util/grub.d/30_os-prober.in
53++++ b/util/grub.d/30_os-prober.in
54+@@ -43,6 +43,12 @@ EOF
55+ if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
56+ grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")"
57+ exit 0
58++elif [ "x${GRUB_DISABLE_OS_PROBER}" = "xauto" ]; then
59++ # UBUNTU: We do not want to disable os-prober on upgrades if we found items before.
60++ if test -e /boot/grub/grub.cfg && ! grep -q osprober /boot/grub/grub.cfg; then
61++ grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")"
62++ exit 0
63++ fi
64+ fi
65+
66+ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/null ; then

Subscribers

People subscribed via source and target branches