Merge ~ubuntu-core-dev/grub/+git/ubuntu:focal13 into ~ubuntu-core-dev/grub/+git/ubuntu:focal

Proposed by Julian Andres Klode
Status: Merged
Merge reported by: Julian Andres Klode
Merged at revision: bce2941ab17540efb85faab28acdb52655450458
Proposed branch: ~ubuntu-core-dev/grub/+git/ubuntu:focal13
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:focal
Diff against target: 176 lines (+110/-5)
5 files modified
debian/changelog (+22/-0)
debian/grub-common.service (+15/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu-add-initrd-less-boot-fallback.patch (+6/-5)
debian/patches/ubuntu-add-initrd-less-boot-messages.patch (+66/-0)
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Review via email: mp+407003@code.launchpad.net

This proposal supersedes a proposal from 2021-08-12.

To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

I unapplied all patches in the focal branch already, otherwise the diff would not be readable, so real package diff is a bit larger.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index f406713..beb59a6 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,25 @@
6+grub2 (2.04-1ubuntu26.13) focal; urgency=medium
7+
8+ [ Julian Andres Klode ]
9+ * unapply all patches, stop using git-dpm
10+
11+ [ Dimitri John Ledkov ]
12+ * 10_linux: emit messages when initrdless boot is configured, attempted and
13+ fails triggering fallback. LP: #1901553
14+ * grub-common.service: port init.d script to systemd unit. Add warning
15+ message, when initrdless boot fails triggering fallback. LP: #1901553
16+ * debian/grub-common.service: change type to oneshot, add wantedby
17+ sleep.target, after sleep.target. The service will now start after resume
18+ from hybernation. (LP: #1929860)
19+ * grub-initrd-fallback.service: add wantedby sleep.target, after
20+ sleep.target. The service will now start after resume from hybernation.
21+ LP: #1929860
22+ * grub-initrd-fallback.service, debian/grub-common.service: only start units
23+ when booted with grub. Use presence of /boot/grub/grub.cfg as proxy. LP:
24+ #1925507
25+
26+ -- Julian Andres Klode <juliank@ubuntu.com> Thu, 12 Aug 2021 11:18:25 +0200
27+
28 grub2 (2.04-1ubuntu26.12) focal; urgency=medium
29
30 * Bump the version number in the replaces for grub-efi-* to account for
31diff --git a/debian/grub-common.service b/debian/grub-common.service
32new file mode 100644
33index 0000000..fcf5474
34--- /dev/null
35+++ b/debian/grub-common.service
36@@ -0,0 +1,15 @@
37+[Unit]
38+Description=Record successful boot for GRUB
39+After=sleep.target
40+ConditionPathExists=/boot/grub/grub.cfg
41+
42+[Service]
43+Type=oneshot
44+Restart=no
45+ExecStartPre=/bin/sh -c '[ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv; mkdir -p /boot/grub'
46+ExecStart=grub-editenv /boot/grub/grubenv unset recordfail
47+ExecStartPost=/bin/sh -c 'if grub-editenv /boot/grub/grubenv list | grep -q initrdless_boot_fallback_triggered=1; then echo "grub: GRUB_FORCE_PARTUUID set, initrdless boot paniced, fallback triggered."; fi'
48+StandardOutput=kmsg
49+
50+[Install]
51+WantedBy=multi-user.target sleep.target
52diff --git a/debian/patches/series b/debian/patches/series
53index 89dfb3e..1749ca3 100644
54--- a/debian/patches/series
55+++ b/debian/patches/series
56@@ -114,3 +114,4 @@ rhboot-f34-make-exit-take-a-return-code.patch
57 rhboot-f34-dont-use-int-for-efi-status.patch
58 rhboot-f34-make-pmtimer-tsc-calibration-fast.patch
59 cherry-fix-crash-on-http.patch
60+ubuntu-add-initrd-less-boot-messages.patch
61diff --git a/debian/patches/ubuntu-add-initrd-less-boot-fallback.patch b/debian/patches/ubuntu-add-initrd-less-boot-fallback.patch
62index 82abad4..270a20f 100644
63--- a/debian/patches/ubuntu-add-initrd-less-boot-fallback.patch
64+++ b/debian/patches/ubuntu-add-initrd-less-boot-fallback.patch
65@@ -11,10 +11,10 @@ Patch-Name: ubuntu-add-initrd-less-boot-fallback.patch
66 ---
67 Makefile.am | 3 ++
68 configure.ac | 10 +++++++
69- grub-initrd-fallback.service | 13 +++++++++
70+ grub-initrd-fallback.service | 14 +++++++++
71 util/grub.d/00_header.in | 27 ++++++++++++++++++
72 util/grub.d/10_linux.in | 68 +++++++++++++++++++++++++++++++++-----------
73- 5 files changed, 105 insertions(+), 16 deletions(-)
74+ 5 files changed, 106 insertions(+), 16 deletions(-)
75 create mode 100644 grub-initrd-fallback.service
76
77 diff --git a/Makefile.am b/Makefile.am
78@@ -54,14 +54,15 @@ index 8832455..1819188 100644
79 #
80 diff --git a/grub-initrd-fallback.service b/grub-initrd-fallback.service
81 new file mode 100644
82-index 0000000..fb0b76e
83+index 0000000..1a0a4e5
84 --- /dev/null
85 +++ b/grub-initrd-fallback.service
86-@@ -0,0 +1,13 @@
87+@@ -0,0 +1,14 @@
88 +[Unit]
89 +Description=GRUB failed boot detection
90 +After=local-fs.target
91 +After=grub-common.service
92++After=sleep.target
93 +
94 +[Service]
95 +Type=oneshot
96@@ -70,7 +71,7 @@ index 0000000..fb0b76e
97 +TimeoutSec=0
98 +
99 +[Install]
100-+WantedBy=multi-user.target rescue.target emergency.target
101++WantedBy=multi-user.target rescue.target emergency.target sleep.target
102 diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
103 index b7135b6..2642f66 100644
104 --- a/util/grub.d/00_header.in
105diff --git a/debian/patches/ubuntu-add-initrd-less-boot-messages.patch b/debian/patches/ubuntu-add-initrd-less-boot-messages.patch
106new file mode 100644
107index 0000000..4872bf3
108--- /dev/null
109+++ b/debian/patches/ubuntu-add-initrd-less-boot-messages.patch
110@@ -0,0 +1,66 @@
111+From: Dimitri John Ledkov <xnox@ubuntu.com>
112+Date: Mon, 26 Oct 2020 11:38:34 +0000
113+Subject: Ubuntu: add initrd-less-boot informational messages
114+
115+Add additional messages when initrd-less boot is attempted or
116+fails. As otherwise it is not obvious why boot seems to panic and
117+reboot by default.
118+---
119+ grub-initrd-fallback.service | 1 +
120+ util/grub.d/10_linux.in | 10 ++++++++++
121+ 2 files changed, 11 insertions(+)
122+
123+diff --git a/grub-initrd-fallback.service b/grub-initrd-fallback.service
124+index 1a0a4e5..59d1a62 100644
125+--- a/grub-initrd-fallback.service
126++++ b/grub-initrd-fallback.service
127+@@ -3,6 +3,7 @@ Description=GRUB failed boot detection
128+ After=local-fs.target
129+ After=grub-common.service
130+ After=sleep.target
131++ConditionPathExists=/boot/grub/grub.cfg
132+
133+ [Service]
134+ Type=oneshot
135+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
136+index 49e6272..47daf51 100644
137+--- a/util/grub.d/10_linux.in
138++++ b/util/grub.d/10_linux.in
139+@@ -160,6 +160,12 @@ if [ "$vt_handoff" = 1 ]; then
140+ fi
141+
142+ if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
143++ gettext_printf "GRUB_FORCE_PARTUUID is set, will attempt initrdless boot\n" >&2
144++ cat << EOF
145++#
146++# GRUB_FORCE_PARTUUID is set, will attempt initrdless boot
147++# Upon panic fallback to booting with initrd
148++EOF
149+ echo "set partuuid=${GRUB_FORCE_PARTUUID}"
150+ fi
151+
152+@@ -245,6 +251,8 @@ EOF
153+ linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
154+ fi
155+ message="$(gettext_printf "Loading initial ramdisk ...")"
156++ initrdlessfail_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, initrdless boot failed. Attempting with initrd.")"
157++ initrdlesstry_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, attempting initrdless boot.")"
158+ initrd_path=
159+ for i in ${initrd}; do
160+ initrd_path="${initrd_path} ${rel_dirname}/${i}"
161+@@ -256,6 +264,7 @@ EOF
162+ if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
163+ sed "s/^/$submenu_indentation/" << EOF
164+ if [ "\${initrdfail}" = 1 ]; then
165++ echo '$(echo "$initrdlessfail_msg" | grub_quote)'
166+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
167+ EOF
168+ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
169+@@ -266,6 +275,7 @@ EOF
170+ sed "s/^/$submenu_indentation/" << EOF
171+ initrd $(echo $initrd_path)
172+ else
173++ echo '$(echo "$initrdlesstry_msg" | grub_quote)'
174+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
175+ EOF
176+ if [ -n "$initrd_path_only_early" ]; then

Subscribers

People subscribed via source and target branches