Announcement

Collapse
No announcement yet.

GRUB timer at 30 s

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    GRUB timer at 30 s

    I have Kubuntu 24.04 install on a new HDD for about a month.
    When I boot up, it shows the GRUB menu for 30 s. I can't remember if it did that since day 1 but it has been a while like that.

    You know, the usual GRUB menu that looks like this
    https://itsfoss.com/access-grub-virtual-machine/

    I had this line in the file /etc/default/grub
    GRUB_TIMEOUT=0

    I tried
    GRUB_TIMEOUT=3
    and then I run
    sudo update-grub​

    It succeeds and I boot up but
    it still shows the menu with a 30 s counter.

    GRUB_TIMEOUT_STYLE=menu
    so I guess the above makes the menu show up but I tried
    GRUB_TIMEOUT_STYLE=hidden

    This is the entire file.
    I have only added
    mitigations=off

    Code:
    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    GRUB_DEFAULT=0
    GRUB_TIMEOUT_STYLE=hidden
    GRUB_TIMEOUT=3
    GRUB_DISTRIBUTOR='Kubuntu'
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=50961ac8-9164-434d-8196-1556bb3d1cc0 mitigations=off"
    GRUB_CMDLINE_LINUX=""
    
    # If your computer has multiple operating systems installed, then you
    # probably want to run os-prober. However, if your computer is a host
    # for guest OSes installed via LVM or raw disk devices, running
    # os-prober can cause damage to those guest OSes as it mounts
    # filesystems to look for things.
    #GRUB_DISABLE_OS_PROBER=false
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal
    #GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    #GRUB_GFXMODE=640x480
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    ​

    In a VM, I experimented a bit with Kubuntu 24.04
    I tried
    GRUB_TIMEOUT=15
    and that works.

    I tried
    GRUB_TIMEOUT_STYLE=menu

    and that works.

    Why does it work in the VM but not my real PC?

    I always run
    sudo update-grub​
    after making a change to the grub file.

    #2
    AI Overview

    The 30-second GRUB countdown often persists despite changing
    GRUB_TIMEOUT because of GRUB_RECORDFAIL_TIMEOUT. When the system detects a boot failure, it defaults to a 30-second menu wait. To fix this, add GRUB_RECORDFAIL_TIMEOUT=5 (or desired seconds) to /etc/default/grub and run sudo update-grub.

    Here is how to resolve the issue:

    Edit the Configuration File: Open a terminal and edit the file:

    sudo nano /etc/default/grub

    Add/Modify Variables: Add the following lines to ensure the timeout is respected, even if a previous boot was considered a "failure": bash

    GRUB_TIMEOUT=5
    GRUB_RECORDFAIL_TIMEOUT=5

    Setting GRUB_RECORDFAIL_TIMEOUT to 0 makes it skip the menu immediately, while a low number like 5 gives you time to react.

    Update GRUB: Apply the changes by running:

    sudo update-grub (on Ubuntu/Mint) or sudo grub2-mkconfig -o /boot/grub2/grub.cfg (on Fedora/RHEL).

    Reboot: Restart your computer to verify the change.

    Why this happens:
    If your computer experiences a crash, hard power-off, or fails to boot properly, GRUB triggers a "record fail" state, ignoring the standard GRUB_TIMEOUT and defaulting to 30 seconds to allow for recovery. This is common on EFI systems.



























    Windows no longer obstruct my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3

      The AI is getting better, but​ not quite there

      Originally posted by Snowhog View Post
      Why this happens:
      If your computer experiences a crash, hard power-off, or fails to boot properly, GRUB triggers a "record fail" state, ignoring the standard GRUB_TIMEOUT and defaulting to 30 seconds to allow for recovery. This is common on EFI systems.
      True, but not the reason for this happening in *buntu, though the common fix is the same. It is a long standing bug/feature that mostly seems to involve lvm, btrfs, etc. It may have been done on purpose.

      The grub scripting used to fix problems on lvm causes a 30 second timeout on other filesystems that use volumes, apparently.

      One can edit the scripting, but the proposed fix is gobs easier.

      Using GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT​ instead of a specific time is also a common method, as this sets it to whatever you set your custom timeout to be so you only need to edit one value.
      Self-built: Asus PRIME B550M-K/Ryzen 5600GT/32Gb/Intel ARC B580 12Gb/KDE neon
      HP Elitedesk 800 G3 Mini: i5-7500T(35w)/32Gb/KDE Linux/Kubuntu LTS
      HP Chromebook 14: i5-1135G7/8Gb/512Gb SSD/KDE neon

      Comment


        #4
        Originally posted by Snowhog View Post
        ....GRUB_RECORDFAIL_TIMEOUT...
        If you install to btrfs, "GRUB lacks write support for btrfs, so recordfail support is disabled." So grub decides every boot is a "record fail" one, and GRUB_RECORDFAIL_TIMEOUT always applies.
        Regards, John Little

        Comment


          #5
          I have /dev/sda1 ----- 300 MB ----- FAT32 ------ /boot/efi
          /dev/sda2 ----- 10.8 TB ------ BTRFS ------ /
          /dev/sda3 ----- 98 GB ------ linuxswap ------ swap

          Does everything look fine? In my UEFI BIOS, I use UEFI mode (not legacy + UEFI)

          This is a somewhat new install. I have it for 1 or 2 months. I install it since often, my PC would not boot up from a cold boot. Sometimes, it would go to busybox, sometimes, it would repair some files. I think it was a HDD issue.
          This new install is on a new HDD.
          Now, most of the time, from a cold boot, it boot up fine. Sometimes it jams with a black screen.

          I am wondering if I have a BIOS problem. I have installed a beta BIOS to get Ryzen 3000 series support.

          //EDIT: oh ya, on my previous HDD, instead of BTRFS, I used ext4. and it had no 30 s delay.

          Comment


            #6
            Does
            everything
            look fine?
            I can't imagine what process requires 98 GB of swap, but that wouldn't have anything to do with your issue. Nor would your BIOS or boot problems have anything to do with the GRUB timeout. IME you need to address one issue at a time and resolve each on it's own.

            Please Read Me

            Comment


              #7
              Originally posted by jlittle View Post
              If you install to btrfs, "GRUB lacks write support for btrfs, so recordfail support is disabled." So grub decides every boot is a "record fail" one, and GRUB_RECORDFAIL_TIMEOUT always applies.
              One note here: I have several installs booting from the same btrfs file system and none of them require that GRUB_RECORDFAIL_TIMEOUT be set in /etc/default/grub to effect a 5 second timeout. Simply having GRUB_TIMEOUT=5 and GRUB_TIMEOUT_STYLE=menu is sufficient.


              Please Read Me

              Comment


                #8
                Originally posted by oshunluvr View Post
                One note here: I have several installs booting from the same btrfs file system and none of them require that GRUB_RECORDFAIL_TIMEOUT be set in /etc/default/grub to effect a 5 second timeout. Simply having GRUB_TIMEOUT=5 and GRUB_TIMEOUT_STYLE=menu is sufficient.
                Maybe you've never had a crash, had to do a hard power-off, or your PC has never failed to boot properly?

                On my 24.04 (btrfs), /etc/default/grub had GRUB_TIMEOUT=0 and I did not have the line GRUB_RECORDFAIL_TIMEOUT. When I boot that PC, the Grub menu displays, and a 30-second countdown starts. I never noticed the time in the countdown, as I always press Enter very shortly after the menu appears. So I tested. I added GRUB_RECORDFAIL_TIMEOUT=10, saved and ran sudo update-grub2, then rebooted. The menu appeared, still with a 30-second countdown.

                I then reset GRUB_TIMEOUT to 0 and commented GRUB_RECORDFAIL_TIMEOUT=60, saved and reran sudo update-grub2. Rebooting the PC, the Grub menu still displays a 30-second countdown. So something else is forcing the 30-second grub menu display time.
                Windows no longer obstruct my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Could be a bug or "feature" related to the "GRUB_TIMEOUT_STYLE=" setting.

                  I can definitively say I've had a hard poweroff in the past, but don't recall having a 30 second timeout afterward (and I'm not pulling the plug to find out, LOL).

                  It's possible that it occurred and I just didn't notice. However, IME with GRUB_TIMEOUT=5 and GRUB_TIMEOUT_STYLE=menu set as default I've never seen 30 boot timer during normal operation.

                  Please Read Me

                  Comment


                    #10
                    Probably this in /boot/grub/grub.cfg:

                    Code:
                    if [ $grub_platform = efi ]; then
                      set timeout=30
                      if [ x$feature_timeout_style = xy ] ; then
                        set timeout_style=menu
                      fi
                    fi​
                    set by /etc/grub.d/00_header when running update-grub:
                    Code:
                    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​
                    Should be fixed by setting GRUB_RECORDFAIL_TIMEOUT, though
                    Last edited by kubicle; Feb 26, 2026, 01:06 PM.

                    Comment


                      #11
                      EFI might be a factor as I'm not using it.

                      Please Read Me

                      Comment


                        #12
                        I tried the
                        GRUB_RECORDFAIL_TIMEOUT=3
                        and
                        sudo update-grub

                        and I rebooted, now the menu appears for 3 s, so I guess GRUB_RECORDFAIL_TIMEOUT works.

                        Comment


                          #13
                          So, on my 24.04 (PC Desktop; UEFI), adding any value to GRUB_TIMEOUT=​ is ignored.

                          Including GRUB_RECORDFAIL_TIMEOUT=​60 is ignored (but maybe I've had no crash, or had to do a hard power-off, or had my PC never fail to boot properly).

                          But changing the value of set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30} in /etc/grub.d/00_header is respected. I changed the value to -15 and saved and updated grub (sudo update-grub2), then rebooted. Now the grub menu display countdown timer is 15-seconds.
                          Windows no longer obstruct my view.
                          Using Kubuntu Linux since March 23, 2007.
                          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                          Comment

                          Users Viewing This Topic

                          Collapse

                          There are 0 users viewing this topic.

                          Working...
                          X