Merge ~xnox/grub:initrdless-docs into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Dimitri John Ledkov
Status: Merged
Merge reported by: Dimitri John Ledkov
Merged at revision: debed1566641ca456bf6810d3d7e0a17a6c306c9
Proposed branch: ~xnox/grub:initrdless-docs
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 164 lines (+92/-2)
6 files modified
debian/.git-dpm (+2/-2)
debian/changelog (+9/-0)
debian/grub-common.service (+14/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu-add-initrd-less-boot-messages.patch (+56/-0)
util/grub.d/10_linux.in (+10/-0)
Reviewer Review Type Date Requested Status
David Krauser (community) Approve
Steve Langasek Pending
Ubuntu Core Development Team Pending
Review via email: mp+392866@code.launchpad.net

This proposal supersedes a proposal from 2020-10-27.

Commit message

Add more messages about initrdless boot.

See https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1901553

To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

The general concept is to show something:

1) upon update-grub
2) before initrdless boot is attempted (grub output might not be visible)
3) before initrdfull fallback is attempted (grub output might not be visible)
4) log kmsg/journal from running system when fallback got triggered (should be visible)

Revision history for this message
David Krauser (davidkrauser) :
review: Needs Information
Revision history for this message
Dimitri John Ledkov (xnox) :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

@CPC as discussed before we wanted to leave more breadcrumbs for users to be able to understand when initrdless boot is attempted and/or fails.

Is this the right UX that you were requested in the summer of 2020 during our meeting in the midcycle?

Do you still want these changes?

Revision history for this message
David Krauser (davidkrauser) wrote :

@xnox, yes it is, and yes we do - thank you :-)

review: Approve

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 63f5a6e..b8d04a8 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-26335cb229a6b969449f80dc6c5aed949ee1d86c
8-26335cb229a6b969449f80dc6c5aed949ee1d86c
9+50b137848fd25a580fcd76760802af16e4e961fa
10+50b137848fd25a580fcd76760802af16e4e961fa
11 578bb115fbd47e1c464696f1f8d6183e5443975d
12 578bb115fbd47e1c464696f1f8d6183e5443975d
13 grub2_2.04.orig.tar.xz
14diff --git a/debian/changelog b/debian/changelog
15index 2284047..a9de8cc 100644
16--- a/debian/changelog
17+++ b/debian/changelog
18@@ -1,3 +1,12 @@
19+grub2 (2.04-1ubuntu36) UNRELEASED; urgency=medium
20+
21+ * 10_linux: emit messages when initrdless boot is configured, attempted
22+ and fails triggering fallback. LP: #1901553
23+ * grub-common.service: port init.d script to systemd unit. Add warning
24+ message, when initrdless boot fails triggering fallback. LP: #1901553
25+
26+ -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 27 Oct 2020 13:07:20 +0000
27+
28 grub2 (2.04-1ubuntu35) groovy; urgency=medium
29
30 * postinst.in, grub-multi-install: fix logic of skipping installing onto
31diff --git a/debian/grub-common.service b/debian/grub-common.service
32new file mode 100644
33index 0000000..1395ad9
34--- /dev/null
35+++ b/debian/grub-common.service
36@@ -0,0 +1,14 @@
37+[Unit]
38+Description=Record successful boot for GRUB
39+
40+[Service]
41+Type=simple
42+Restart=no
43+RemainAfterExit=yes
44+ExecStartPre=/bin/sh -c '[ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv; mkdir -p /boot/grub'
45+ExecStart=grub-editenv /boot/grub/grubenv unset recordfail
46+ExecStartPost=/bin/sh -c 'if grub-editenv /boot/grub/grubenv list | grep -q initrdless_boot_fallback_triggered=1; then echo "<3>grub: GRUB_FORCE_PARTUUID set, initrdless boot paniced, fallback triggered."; fi'
47+StandardOutput=kmsg
48+
49+[Install]
50+WantedBy=multi-user.target
51\ No newline at end of file
52diff --git a/debian/patches/series b/debian/patches/series
53index ebb7077..f6fbf31 100644
54--- a/debian/patches/series
55+++ b/debian/patches/series
56@@ -109,3 +109,4 @@ ubuntu-recovery-dis_ucode_ldr.patch
57 grub-install-backup-and-restore.patch
58 ubuntu-linuxefi-arm64.patch
59 ubuntu-dejavu-font-path.patch
60+ubuntu-add-initrd-less-boot-messages.patch
61diff --git a/debian/patches/ubuntu-add-initrd-less-boot-messages.patch b/debian/patches/ubuntu-add-initrd-less-boot-messages.patch
62new file mode 100644
63index 0000000..188bb69
64--- /dev/null
65+++ b/debian/patches/ubuntu-add-initrd-less-boot-messages.patch
66@@ -0,0 +1,56 @@
67+From 50b137848fd25a580fcd76760802af16e4e961fa Mon Sep 17 00:00:00 2001
68+From: Dimitri John Ledkov <xnox@ubuntu.com>
69+Date: Mon, 26 Oct 2020 11:38:34 +0000
70+Subject: Ubuntu: add initrd-less-boot informational messages
71+
72+Add additional messages when initrd-less boot is attempted or
73+fails. As otherwise it is not obvious why boot seems to panic and
74+reboot by default.
75+
76+Patch-Name: ubuntu-add-initrd-less-boot-messages.patch
77+---
78+ util/grub.d/10_linux.in | 10 ++++++++++
79+ 1 file changed, 10 insertions(+)
80+
81+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
82+index 49e627228f..47daf51eed 100644
83+--- a/util/grub.d/10_linux.in
84++++ b/util/grub.d/10_linux.in
85+@@ -160,6 +160,12 @@ if [ "$vt_handoff" = 1 ]; then
86+ fi
87+
88+ if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
89++ gettext_printf "GRUB_FORCE_PARTUUID is set, will attempt initrdless boot\n" >&2
90++ cat << EOF
91++#
92++# GRUB_FORCE_PARTUUID is set, will attempt initrdless boot
93++# Upon panic fallback to booting with initrd
94++EOF
95+ echo "set partuuid=${GRUB_FORCE_PARTUUID}"
96+ fi
97+
98+@@ -245,6 +251,8 @@ EOF
99+ linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
100+ fi
101+ message="$(gettext_printf "Loading initial ramdisk ...")"
102++ initrdlessfail_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, initrdless boot failed. Attempting with initrd.")"
103++ initrdlesstry_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, attempting initrdless boot.")"
104+ initrd_path=
105+ for i in ${initrd}; do
106+ initrd_path="${initrd_path} ${rel_dirname}/${i}"
107+@@ -256,6 +264,7 @@ EOF
108+ if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
109+ sed "s/^/$submenu_indentation/" << EOF
110+ if [ "\${initrdfail}" = 1 ]; then
111++ echo '$(echo "$initrdlessfail_msg" | grub_quote)'
112+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
113+ EOF
114+ if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
115+@@ -266,6 +275,7 @@ EOF
116+ sed "s/^/$submenu_indentation/" << EOF
117+ initrd $(echo $initrd_path)
118+ else
119++ echo '$(echo "$initrdlesstry_msg" | grub_quote)'
120+ linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
121+ EOF
122+ if [ -n "$initrd_path_only_early" ]; then
123diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
124index 49e6272..47daf51 100644
125--- a/util/grub.d/10_linux.in
126+++ b/util/grub.d/10_linux.in
127@@ -160,6 +160,12 @@ if [ "$vt_handoff" = 1 ]; then
128 fi
129
130 if [ x"$GRUB_FORCE_PARTUUID" != x ]; then
131+ gettext_printf "GRUB_FORCE_PARTUUID is set, will attempt initrdless boot\n" >&2
132+ cat << EOF
133+#
134+# GRUB_FORCE_PARTUUID is set, will attempt initrdless boot
135+# Upon panic fallback to booting with initrd
136+EOF
137 echo "set partuuid=${GRUB_FORCE_PARTUUID}"
138 fi
139
140@@ -245,6 +251,8 @@ EOF
141 linux_root_device_thisversion="PARTUUID=${GRUB_FORCE_PARTUUID}"
142 fi
143 message="$(gettext_printf "Loading initial ramdisk ...")"
144+ initrdlessfail_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, initrdless boot failed. Attempting with initrd.")"
145+ initrdlesstry_msg="$(gettext_printf "GRUB_FORCE_PARTUUID set, attempting initrdless boot.")"
146 initrd_path=
147 for i in ${initrd}; do
148 initrd_path="${initrd_path} ${rel_dirname}/${i}"
149@@ -256,6 +264,7 @@ EOF
150 if test -n "${initrd}" && [ x"$GRUB_FORCE_PARTUUID" != x ]; then
151 sed "s/^/$submenu_indentation/" << EOF
152 if [ "\${initrdfail}" = 1 ]; then
153+ echo '$(echo "$initrdlessfail_msg" | grub_quote)'
154 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
155 EOF
156 if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then
157@@ -266,6 +275,7 @@ EOF
158 sed "s/^/$submenu_indentation/" << EOF
159 initrd $(echo $initrd_path)
160 else
161+ echo '$(echo "$initrdlesstry_msg" | grub_quote)'
162 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
163 EOF
164 if [ -n "$initrd_path_only_early" ]; then

Subscribers

People subscribed via source and target branches