[Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Eph
Level 1
Level 1
Posts: 26
Joined: Wed Oct 27, 2021 1:57 pm

[Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by Eph »

I'm running Mint Cinnamon 20.3 Edge on a Framework laptop. By default the grub menu was appearing for 30 seconds.

I edited /etc/default/grub setting

Code: Select all

GRUB_TIMEOUT=10
saved grub, ran

Code: Select all

sudo update-grub
and rebooted.

Result, no change. Still waiting 30 seconds for the grub menu to go away.

I got some ideas from this recent thread:
viewtopic.php?f=46&t=362992&hilit=GRUB_ ... MEOUT+uefi
and it seems that /boot/grub/grub.cfg overrides the requested timeout if the machine (like the Framework) is UEFI based.

I was able to get the desired result by editing this bit of /boot/grub/grub.cfg (which we're not supposed to do) and changing the 30 second timeout to 10 seconds.

Code: Select all

if [ $grub-platform = efi ]; then
  set timeout=30
  if [ x$feature-timeout-style = xy ] ;  then
    set timeout-style=menu
  fi
fi
The downside of my solution is ignoring the categorical warning in /boot/grub/grub.cfg NOT to edit the file, and my fix is overwritten if I run

Code: Select all

sudo update-grub
So my questions are:
1) Is there a cleaner way to do this?
2) Why the hardcoded 30 second delay for UEFI machines?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
senjoz
Level 5
Level 5
Posts: 902
Joined: Tue Jun 09, 2020 3:55 am
Location: Kamnik

Re: why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by senjoz »

Eph wrote: Mon Jan 24, 2022 9:37 pm

Code: Select all

if [ $grub-platform = efi ]; then
  set timeout=30
  if [ x$feature-timeout-style = xy ] ;  then
    set timeout-style=menu
  fi
fi
My installations of LM 20.3 do not have that part in /etc/default/grub. All installations are on the machines with only uefi booting.

sudo update-grub runs scripts in /etc/grub.d. Those scripts build /etc/default/grub. In the script /etc/grub.d/00_header there is also next:

Code: Select all

if [ "$recordfail_broken" = 1 ]; then
  cat << EOF
  if [ \$grub_platform = efi ]; then
  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
  if [ x\$feature_timeout_style = xy ] ; then
    set timeout_style=menu
  fi
fi
EOF
fi
and

Code: Select all

if ! check_writable; then
    recordfail_broken=1
  fi
Probably your problem is related to that script. Search in the script for check_writable. Maybe you can get more information from that part of the script.

Regards, Jože
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by smurphos »

For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
Eph
Level 1
Level 1
Posts: 26
Joined: Wed Oct 27, 2021 1:57 pm

Re: why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by Eph »

Thanks for the replies. I followed smurphos' link and found this comment on the original Ubuntu bug report:

https://bugs.launchpad.net/ubuntu/+sour ... omments/16

I'm surprised that Ubuntu would mangle the logic of a key component like grub and not fix it for two years and running.

I suppose this will be fixed someday. In the meanwhile, grub is sufficiently wobbly already that I don't think I want to mess with rewriting the scripts that update-grub uses to create /etc/default/grub. I'll just use my current approach editing /boot/grub/grub.cfg, the file we're not supposed to edit. I feel safer knowing it will be safely overwritten when things change. (And if need be, I can always put it back if things change but the bug remains unfixed.)
Agentl074
Level 3
Level 3
Posts: 111
Joined: Wed Dec 01, 2021 7:21 pm

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by Agentl074 »

I just manually created an 'Edge' of sorts by installing the regular Mint Cinnamon 20.3 and loading kernel 5.11. 5.13 snowballs on AMD machines, so we have to wait until a better kernel is available for LTS or other....

This is the route I would advise.
Indiana University Alumnus, CompTIA A+
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by deepakdeshp »

Agentl074 wrote: Wed Jan 26, 2022 5:38 pm I just manually created an 'Edge' of sorts by installing the regular Mint Cinnamon 20.3 and loading kernel 5.11. 5.13 snowballs on AMD machines, so we have to wait until a better kernel is available for LTS or other....

This is the route I would advise.
I quote from an article

Kernel 5.15 for Ubuntu 20.04:
The mainline kernel was build against Ubuntu 21.10, so it won’t install in Ubuntu 20.04 LTS. However, for those insist on installing the new kernel, this project is available along with an Ubuntu PPA. Use it at your own risk!

You may run command in terminal to add the PPA:

sudo add-apt-repository ppa:tuxinvader/lts-mainline
Once the Kernel 5.15 package is updated, use command to install it:

sudo apt install linux-generic-5.15
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
User avatar
AZgl1800
Level 20
Level 20
Posts: 11184
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes Sweeping down the Plains
Contact:

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by AZgl1800 »

I just installed LM20.3 Cinnamon a week ago, and the Default is 10 seconds.

I rarely ever, let it go, I just hit Enter Key and boot up 'now'
LM21.3 Cinnamon ASUS FX705GM | Donate to Mint https://www.patreon.com/linux_mint
Image
User avatar
Unis_Torvalds
Level 1
Level 1
Posts: 29
Joined: Tue Oct 25, 2016 11:50 pm

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by Unis_Torvalds »

@Eph
Thanks for asking this question. I too have the thirty-second timeout and have long wondered why editing /etc/default/grub doesn't change it.
JeremyB
Level 21
Level 21
Posts: 13880
Joined: Fri Feb 21, 2014 8:17 am

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by JeremyB »

deepakdeshp wrote: Wed Jan 26, 2022 8:13 pm
Agentl074 wrote: Wed Jan 26, 2022 5:38 pm I just manually created an 'Edge' of sorts by installing the regular Mint Cinnamon 20.3 and loading kernel 5.11. 5.13 snowballs on AMD machines, so we have to wait until a better kernel is available for LTS or other....

This is the route I would advise.
I quote from an article

Kernel 5.15 for Ubuntu 20.04:
The mainline kernel was build against Ubuntu 21.10, so it won’t install in Ubuntu 20.04 LTS. However, for those insist on installing the new kernel, this project is available along with an Ubuntu PPA. Use it at your own risk!

You may run command in terminal to add the PPA:

sudo add-apt-repository ppa:tuxinvader/lts-mainline
Once the Kernel 5.15 package is updated, use command to install it:

sudo apt install linux-generic-5.15
The mainline may not work but the 5.15 from the normal Ubuntu repos for 20.04 should be fine as I needed it on Mint 20 for my touchpad to work. If I remember correctly the edge kernel package was enabled by default on Ubuntu desktop installs, but it wasn't if you installed a beta release

I haven't seen the 30 second grub timeout on my UEFI laptops
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by deepakdeshp »

Is it that when there is only one os ,Mint 21 or Ubuntu 22.04 then the grub isn't visible?
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
SSWAS
Level 1
Level 1
Posts: 21
Joined: Fri Nov 04, 2022 6:37 am

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by SSWAS »

This is really Strange sometimes when I Boot only the logo comes and not Grub meny but when the menu comes and I click on the operation system it works I mean the display there you can choose recovery mode and regular startup if you know what I mean so it seems that the problem is not the menu loading on Boot because then it only shows the logo and terms Black but when I press control with shows up and it works..

Code: Select all

Sourcing file /etc/default/grub

Sourcing file /etc/default/grub.d/50_linuxmint.cfg' Sourcing file /etc/default/grub.d/init-select.cfg' Generating grub configuration file

Found linux image: /boot/vmlinuz-5.15.0-52-generic

Found initrd image: /boot/initrd.img-5.15.0-52-generic

Found linux image: /boot/vmlinuz-5.15.0-41-generic

Found initrd image: /boot/initrd.img-5.15.0-41-generic The ZFS modules are not loaded.

Try running '/sbin/modprobe zfs' as root to load them. Some pools couldn't be imported and will be ignored: The ZFS modules are not loaded.

Try running '/sbin/modprobe zfs as root to load them.

The ZFS modules are not loaded.

Try running '/sbin/modprobe zfs' as root to load them.

The ZFS modules are not loaded.

Try running '/sbin/modprobe zfs' as root to load them.

Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. done
And in recover mode when I try to update it this is what it says
deepakdeshp
Level 20
Level 20
Posts: 12341
Joined: Sun Aug 09, 2015 10:00 am

Re: [Solved] Why is grub timeout hardcoded to 30 seconds for EFI based machines?

Post by deepakdeshp »

SSWAS wrote: Sat Nov 05, 2022 5:31 am This is really Strange sometimes when I Boot only the logo comes and not Grub meny but when the menu comes and I click on the operation system it works I mean the display there you can choose recovery mode and regular startup if you know what I mean so it seems that the problem is not the menu loading on Boot because then it only shows the logo and terms Black but when I press control with shows up and it works..

Please create a new thread for your problem.
If I have helped you solve a problem, please add [SOLVED] to your first post title, it helps other users looking for help.
Regards,
Deepak

Mint 21.1 Cinnamon 64 bit with AMD A6 / 8GB
Mint 21.1 Cinnamon AMD Ryzen3500U/8gb
Locked

Return to “Installation & Boot”