How to make Grub Silent after unexpected shutdown?

https://paste.centos.org/view/e6178428

GRUB_TIMEOUT=3
GRUB_RECORDFAIL_TIMEOUT=3
GRUB_DISTRIBUTOR=“$(sed ‘s, release .*$,g’ /etc/system-release)”
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=“console”
GRUB_CMDLINE_LINUX=“rd.lvm.lv=fedora_miwifi-rb06-srv/root rhgb quiet”
GRUB_DISABLE_RECOVERY=“true”
GRUB_ENABLE_BLSCFG=true

I didn’t notice if there was a countdown or not. But normally, when I start the computer, the Grub menu automatically picks the first option after a couple of seconds. But after power loss, it just halts on that menu. You then must connect a keyboard and press ENTER for it to go past that screen.

This line is the only one that does not exist in that file by default.
What happens if you delete that line then run
grub2-mkconfig -o /boot/grub2/grub.cfg
and cause a power failure after that command completes?

Does the restart still hang at the grub menu or does it start normally?

1 Like

I did the change. It still hangs at the grub menu after power failure.

Maybe I’ll just get rid of GRUB? What’s the easiest-to-install alternative, that has no menu at all, and automatically starts? EFIStub perhaps?

Do you have tried to let the keyboard plunged in while do the power outage simulation?

What do you mean? To keep the keyboard connected at all times, even if I don’t plan to use it ?

I recall that some systems in the past would not boot when no keyboard or mouse was attached without a special setting in bios to ignore the errors with keyboard&mouse. I seem to remember those were ps2 connections and current boards use usb mouse&keyboard, but it may be worth looking into the bios to see if there is something there that may be related; especially since most of us have not seen such a hang during boot.

But the system does start without a keyboard, when it’s a normal startup (not power failure reboot).

I agree that is perplexing. It would seem it must be something grub related then. The bios has already handed control over to the boot loader (grub) but grub does not continue.

I would approach this as a grub issue. Accordingly, with it booted up I would do the following.

  1. Delete the files /boot/efi/EFI/fedora/grub.cfg, /boot/grub2/grub.cfg, and /boot/grub2/grubenv. (you might save the originals as backups if you choose)
  2. Reinstall all grub and shim files. dnf reinstall grub2* shim* (grub2-common and grub2-efi* will reconfigure and reinstall the removed files from step 1)
  3. Verify the removed files have been recreated then reboot and see if there is a difference.

This certainly seems to be something that is not 100% standard in the way grub works for you so this suggestion is a stab in the dark to try and identify the fix.

1 Like

I did step 1 (I didn’t backup tho).
On Step 2 (sudo dnf reinstall grub* shim*) I get the following:

zsh: no matches found: grub*

What should I do to reinstall ?

Thanks

It seems I may have made an error in that command above. It has been edited.

However, the probable cause of your error could be that you are running the command in a directory that contains a file whose name begins with ‘grub’.
Try the same command but use it this way dnf reinstall 'grub2*' 'shim*' which will prevent the file system globbing of ‘grub*’

1 Like

Ok, so did all that - but the problem persisted. System would still want me to connect a keyboard after power loss, and press Enter.

HOWEVER, that has led me to find out that when there’s a keyboard already connected, GRUB doesn’t halt even after power loss. I repeated the experiment five times - without keyboard - it halts and I have to connect a keyboard and press Enter. With a keyboard connected, it doesn’t halt, and automatically starts Fedora.

The question, what may be causing this? Is there a way to set it up so that it starts even without a keyboard installed? Or a dummy dongle maybe?

Ed: Apparently a common problem:

Somebody seems to have stumbled upon a solution here:

Open /etc/grub.d/00_header and go to approximately line 238:

make_timeout ()
{
cat << EOF
if [ "\${recordfail}" = 1 ]; then
set timeout=-1
else

Make the changes, then save the file and run “sudo update-grub”:

# Manually change timeout to 0
# set timeout=${2}
set timeout=0
# End manual change

fi
EOF
}

This should eliminate the menu display […]. It also preserves the ability to display the menu by holding down the SHIFT key during boot.
[…]

Howerver, I opened up the file, and things have changed since then (it was from 2011). Anybody knows how to accomodate these changes into the modern file?

THank you!!