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

Subscribers

People subscribed via source and target branches