Public bug reported:

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_CRYPTODISK=y)

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_TIMEOUT=0
# GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_RECORDFAIL_TIMEOUT=5
GRUB_TIMEOUT=3
GRUB_TIMEOUT_STYLE=countdown
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash kaslr i915.alpha_support=1"
GRUB_CMDLINE_LINUX=""
GRUB_ENABLE_CRYPTODISK=y


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.d/00_header:

 131   │ if [ "$quick_boot" = 1 ]; then
 132   │     cat <<EOF
 133   │ function recordfail {
 134   │   set recordfail=1
 135   │ EOF
 136   │ 
 137   │   check_writable () {
 138   │     abstractions="$(grub-probe --target=abstraction "${grubdir}")"
 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_timeout_style = xy ] ; then
    set timeout_style=countdown
    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_timeout_style = xy ] ; then
    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=${GRUB_RECORDFAIL_TIMEOUT:-30}
 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_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
 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_STYLE=menu
 384   │     timeout="${2}"
 385   │     style="menu"
 386   │     fi
 387   │     cat << EOF
 388   │   if [ x\$feature_timeout_style = xy ] ; then
 389   │     set timeout_style=${style}
 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_broken" = 1 ]; then
 412   │   cat << EOF
 413   │ if [ \$grub_platform = efi ]; then
 414   │   set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
 415   │   if [ x\$feature_timeout_style = xy ] ; then
 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://de.archive.ubuntu.com/ubuntu focal-updates/main amd64 
Packages
        100 /var/lib/dpkg/status
     2.04-1ubuntu26.12 500
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     2.04-1ubuntu26 500
        500 http://de.archive.ubuntu.com/ubuntu focal/main amd64 Packages

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: grub2 (not installed)
ProcVersionSignature: Ubuntu 5.13.0-40.45~20.04.1-generic 5.13.19
Uname: Linux 5.13.0-40-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.23
Architecture: amd64
CasperMD5CheckResult: skip
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)

** Affects: grub2 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug focal

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1968149

Title:
  grub ignores GRUB_TIMEOUT_STYLE when on efi+btrfs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1968149/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to