Merge ~mwhudson/grub/+git/ubuntu:lp-1429327 into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Michael Hudson-Doyle
Status: Merged
Merge reported by: Julian Andres Klode
Merged at revision: e1f87e63aa5af824e8ecafc88b504dee14438ff5
Proposed branch: ~mwhudson/grub/+git/ubuntu:lp-1429327
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 115 lines (+82/-2)
4 files modified
debian/.git-dpm (+2/-2)
debian/changelog (+10/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu-boot-from-multipath-dependent-symlink.patch (+69/-0)
Reviewer Review Type Date Requested Status
Steve Langasek Approve
Review via email: mp+370971@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) :
review: Approve
Revision history for this message
Julian Andres Klode (juliank) wrote :

The patch seems to be in the target branch, so marking as merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/.git-dpm b/debian/.git-dpm
2index 685daef..d0221b3 100644
3--- a/debian/.git-dpm
4+++ b/debian/.git-dpm
5@@ -1,6 +1,6 @@
6 # see git-dpm(1) from git-dpm package
7-82f1d75cd9d0415c3aef23adcc715fc3abc5fd78
8-82f1d75cd9d0415c3aef23adcc715fc3abc5fd78
9+fe950b01df1486d0f2a1a73a7492e2e40a41de1e
10+fe950b01df1486d0f2a1a73a7492e2e40a41de1e
11 578bb115fbd47e1c464696f1f8d6183e5443975d
12 578bb115fbd47e1c464696f1f8d6183e5443975d
13 grub2_2.04.orig.tar.xz
14diff --git a/debian/changelog b/debian/changelog
15index 88dd6e0..15224fc 100644
16--- a/debian/changelog
17+++ b/debian/changelog
18@@ -1,3 +1,13 @@
19+grub2 (2.04-1ubuntu4) UNRELEASED; urgency=medium
20+
21+ * d/patches/ubuntu-boot-from-multipath-dependent-symlink.patch: when / is
22+ multipathed there will be multiple paths to the partition, so using
23+ root=UUID= exposes the boot process to udev races. In addition
24+ grub-probe --target device / in this case reports /dev/dm-1 or similar --
25+ better to use a symlink that depends on the multipath name. (LP: #1429327)
26+
27+ -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 06 Aug 2019 12:37:18 +1200
28+
29 grub2 (2.04-1ubuntu3) eoan; urgency=medium
30
31 [ Mathieu Trudel-Lapierre ]
32diff --git a/debian/patches/series b/debian/patches/series
33index 900d3d4..7b5e184 100644
34--- a/debian/patches/series
35+++ b/debian/patches/series
36@@ -65,3 +65,4 @@ ubuntu-fix-lzma-decompressor-objcopy.patch
37 ubuntu-clear-invalid-initrd-spacing.patch
38 ubuntu-temp-keep-auto-nvram.patch
39 ubuntu-add-devicetree-command-support.patch
40+ubuntu-boot-from-multipath-dependent-symlink.patch
41diff --git a/debian/patches/ubuntu-boot-from-multipath-dependent-symlink.patch b/debian/patches/ubuntu-boot-from-multipath-dependent-symlink.patch
42new file mode 100644
43index 0000000..8d67512
44--- /dev/null
45+++ b/debian/patches/ubuntu-boot-from-multipath-dependent-symlink.patch
46@@ -0,0 +1,69 @@
47+From fe950b01df1486d0f2a1a73a7492e2e40a41de1e Mon Sep 17 00:00:00 2001
48+From: Michael Hudson-Doyle <michael.hudson@canonical.com>
49+Date: Tue, 6 Aug 2019 12:31:47 +1200
50+Subject: UBUNTU: Boot from multipath-dependent symlink when / is multipathed.
51+
52+If / is multipathed, there will be multiple paths to the partition, so
53+using root=UUID= exposes the boot process to udev races. In addition
54+grub-probe --target device / in this case reports /dev/dm-1 or similar
55+-- better to use a symlink that depends on the multipath name.
56+
57+Signed-off-by: Michael Hudson-Doyle <michael.hudson@ubuntu.com>
58+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1429327
59+Patch-Name: ubuntu-boot-from-multipath-dependent-symlink.patch
60+---
61+ util/grub.d/10_linux.in | 41 +++++++++++++++++++++++++++++++++++++++++
62+ 1 file changed, 41 insertions(+)
63+
64+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
65+index d6937cfef..8f3fbc41f 100644
66+--- a/util/grub.d/10_linux.in
67++++ b/util/grub.d/10_linux.in
68+@@ -65,6 +65,47 @@ esac
69+ # older kernels.
70+ GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
71+
72++# get_dm_field_for_dev /dev/dm-0 uuid -> get the device mapper UUID for /dev/dm-0
73++# get_dm_field_for_dev /dev/dm-1 name -> get the device mapper name for /dev/dm-1
74++# etc
75++get_dm_field_for_dev () {
76++ dmsetup info -c --noheadings -o $2 $1 2>/dev/null
77++}
78++
79++# Is $1 a multipath device?
80++is_multipath () {
81++ local dmuuid dmtype
82++ dmuuid="$(get_dm_field_for_dev $1 uuid)"
83++ if [ $? -ne 0 ]; then
84++ # Not a device mapper device -- or dmsetup not installed, and as
85++ # multipath depends on kpartx which depends on dmsetup, if there is no
86++ # dmsetup then there are not going to be any multipath devices.
87++ return 1
88++ fi
89++ # A device mapper "uuid" is always <type>-<uuid>. If <type> is of the form
90++ # part[0-9] then <uuid> is the device the partition is on and we want to
91++ # look at that instead. A multipath node always has <type> of mpath.
92++ dmtype="${dmuuid%%-*}"
93++ if [ "${dmtype#part}" != "$dmtype" ]; then
94++ dmuuid="${dmuuid#*-}"
95++ dmtype="${dmuuid%%-*}"
96++ fi
97++ if [ "$dmtype" = "mpath" ]; then
98++ return 0
99++ else
100++ return 1
101++ fi
102++}
103++
104++if test -e "${GRUB_DEVICE}" && is_multipath "${GRUB_DEVICE}"; then
105++ # If / is multipathed, there will be multiple paths to the partition, so
106++ # using root=UUID= exposes the boot process to udev races. In addition
107++ # GRUB_DEVICE in this case will be /dev/dm-0 or similar -- better to use a
108++ # symlink that depends on the multipath name.
109++ GRUB_DEVICE=/dev/mapper/"$(get_dm_field_dev $GRUB_DEVICE name)"
110++ GRUB_DISABLE_LINUX_UUID=true
111++fi
112++
113+ # btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
114+ # and mounting btrfs requires user space scanning, so force UUID in this case.
115+ if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \

Subscribers

People subscribed via source and target branches