grub ignores GRUB_TIMEOUT_STYLE when on efi+btrfs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I'm using grub2, but with a configuration that may be a bit special:
1) I'm using native UEFI boot.
2) I have / formatted using btrfs (and no external /boot).
3) / is contained inside a LUKS volume with just grub on the ESP. (with GRUB_ENABLE_
Everything works so far, but what I'm seeing on boot is this:
1) the vendor logo
2) a password prompt beneath
3) a grub menu with a countdown
4) a bootsplash with the vendor logo
I'd like 3) to be gone, so I've set GRUB_TIMEOUT_STYLE to countdown, but it does not seem to have any effect.
My /etc/default/grub looks like this:
GRUB_DEFAULT=0
# GRUB_HIDDEN_
# GRUB_HIDDEN_
GRUB_RECORDFAIL
GRUB_TIMEOUT=3
GRUB_TIMEOUT_
GRUB_DISTRIBUTO
GRUB_CMDLINE_
GRUB_CMDLINE_
GRUB_ENABLE_
My generated grub.cfg contains those two snippets which I guess are the cause:
function recordfail {
set recordfail=1
# GRUB lacks write support for btrfs, so recordfail support is disabled.
}
which is generated by the following lines in /etc/grub.
131 │ if [ "$quick_boot" = 1 ]; then
132 │ cat <<EOF
133 │ function recordfail {
134 │ set recordfail=1
135 │ EOF
136 │
137 │ check_writable () {
138 │ abstractions=
139 │ for abstraction in $abstractions; do
140 │ case "$abstraction" in
141 │ diskfilter | lvm)
142 │ cat <<EOF
143 │ # GRUB lacks write support for $abstraction, so recordfail support is disabled.
144 │ EOF
145 │ return 1
146 │ ;;
147 │ esac
148 │ done
149 │
150 │ FS="$(grub-probe --target=fs "${grubdir}")"
151 │ case "$FS" in
152 │ btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs)
153 │ cat <<EOF
154 │ # GRUB lacks write support for $FS, so recordfail support is disabled.
155 │ EOF
156 │ return 1
157 │ ;;
158 │ esac
159 │
160 │ cat <<EOF
161 │ if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
162 │ EOF
163 │ }
164 │
165 │ if ! check_writable; then
166 │ recordfail_broken=1
167 │ fi
168 │
169 │ cat <<EOF
170 │ }
171 │ EOF
172 │ fi
and
if [ "${recordfail}" = 1 ] ; then
set timeout=5
else
if [ x$feature_
set timeout_
set timeout=3
# Fallback hidden-timeout code in case the timeout_style feature is
# unavailable.
elif sleep --interruptible 3 ; then
set timeout=0
fi
fi
if [ $grub_platform = efi ]; then
set timeout=5
if [ x$feature_
set timeout_style=menu
fi
fi
which is generated by:
358 │ make_timeout ()
359 │ {
360 │ cat << EOF
361 │ if [ "\${recordfail}" = 1 ] ; then
362 │ set timeout=
363 │ else
364 │ EOF
365 │ if [ "x${3}" != "x" ] ; then
366 │ timeout="${2}"
367 │ style="${3}"
368 │ elif [ "x${1}" != "x" ] && \
369 │ ([ "$quick_boot" = 1 ] || [ "x${1}" != "x0" ]) ; then
370 │ # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.
371 │ timeout="${1}"
372 │ if [ "x${2}" != "x0" ] ; then
373 │ grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set
│ is no longer supported.")"
374 │ fi
375 │ if [ "x${GRUB_
376 │ style="hidden"
377 │ verbose=
378 │ else
379 │ style="countdown"
380 │ verbose=" --verbose"
381 │ fi
382 │ else
383 │ # No hidden timeout, so treat as GRUB_TIMEOUT_
384 │ timeout="${2}"
385 │ style="menu"
386 │ fi
387 │ cat << EOF
388 │ if [ x\$feature_
389 │ set timeout_
390 │ set timeout=${timeout}
391 │ EOF
392 │ if [ "x${style}" = "xmenu" ] ; then
393 │ cat << EOF
394 │ # Fallback normal timeout code in case the timeout_style feature is
395 │ # unavailable.
396 │ else
397 │ set timeout=${timeout}
398 │ EOF
399 │ else
400 │ cat << EOF
401 │ # Fallback hidden-timeout code in case the timeout_style feature is
402 │ # unavailable.
403 │ elif sleep${verbose} --interruptible ${timeout} ; then
404 │ set timeout=0
405 │ EOF
406 │ fi
407 │ cat << EOF
408 │ fi
409 │ fi
410 │ EOF
411 │ if [ "$recordfail_
412 │ cat << EOF
413 │ if [ \$grub_platform = efi ]; then
414 │ set timeout=
415 │ if [ x\$feature_
416 │ set timeout_style=menu
417 │ fi
418 │ fi
419 │ EOF
420 │ fi
421 │ }
I realize that I'm running into a combination of #425979, #1878107, and #1964719 here, but the timeout style was never really mentioned in any of those (and supporting at least countdown would not interfere with either uefi or btrfs support), so I thought I'd open a new bug. Feel free to mark as a duplicate of any of them. :)
Regarding the root cause, I guess saving the recordfail value in the ESP or a UEFI variable would probably work?
$ lsb_release -rd
Description: Ubuntu 20.04.4 LTS
Release: 20.04
$ apt-cache policy grub2-common
grub2-common:
Installed: 2.04-1ubuntu26.15
Candidate: 2.04-1ubuntu26.15
Version table:
*** 2.04-1ubuntu26.15 500
500 http://
100 /var/lib/
2.
500 http://
2.04-1ubuntu26 500
500 http://
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: grub2 (not installed)
ProcVersionSign
Uname: Linux 5.13.0-40-generic x86_64
ApportVersion: 2.20.11-
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: KDE
Date: Thu Apr 7 11:01:59 2022
InstallationDate: Installed on 2015-12-11 (2308 days ago)
InstallationMedia: Kubuntu 14.04.3 LTS "Trusty Tahr" - Beta amd64 (20150805)
SourcePackage: grub2
UpgradeStatus: Upgraded to focal on 2020-05-15 (691 days ago)