How to make Grub Silent after unexpected shutdown?

Hi,

I set up a Fedora Server box, and set it up in a way so that it automatically logs in (through the OS config), and also automatically restarts after power loss, (through the BIOS). However, when there’s an unexpected power loss, and when the machine later restarts itself, it doesn’t automatically logs in. It gets stopped at the GRUB boot interface, and I have to press ENTER for it to log-in the OS.

How do I enforce grub to automatically log-in, even after such a power loss shutdown ?

Thanks,
Reg

:thinking: GRUB is not responsible of logging in.
Usually GRUB shows a menu of available OS/kernels with a countdown after that the OS boot process automatically starts.

1 Like

I think this is just a language / terminology issue — my interpretation is that the problem is that it doesn’t boot, but waits at the menu. (@regev, is that correct?)

Yep.

Normally it does boot, all automatic (including user login). But when there’s an unexpected power loss, it stops at the Grub menu, in which I have to press enter (because if I wait, it remains at the menu).

Whats the output of:

sudo cat /etc/default/grub 
sudo grub2-editenv list
1 Like

First one:

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-rb08-srv/root rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

Second:

saved_entry=2c0c8f7b253341edas0378ced6e8a812-6.1.6-200.fc37.x86_64
boot_success=1
boot_indeterminate=0

What about the efi and legacy boot options, are both enabled in BIOS? If yes, please switch the unused off to see if this changes something.

Why would these stop GRUB from automatically logging in after power loss ?

As mentioned above, Grub not logs you in. It is just a Menu who gives you options to boot from.

Grub is the boot manager, you use it to boot from EFI or the Legacy way. If you have both options on in BIOS, the system will take what it finds first. If the config is not original Fedora you can have troubles.
I could imagine that your system is smart enough to distinguish between power loss and a clean shutdown.
So to exclude that two different configs kick in I asked you to switch off the one you not need necessarily to boot from your system.

The two different locations of grub.cfg:

/boot/efi/EFI/fedora/grub.cfg
/boot/grub2/grub.cfg

p.s.
I already had problems once to boot from an usb-stick. Playing around with the BIOS (EFI/Legacy) settings solved my problem.

If using uefi to boot BOTH those grub.cfg files are used. The one under /boot/efi is a stub pointer that redirects grub to the actual config file at /boot/grub2/grub.cfg.

I suspect that the halt on boot with a power outage is related to the way the system marks /boot/grub2/grubenv as clean shutdown or not. This halt seems related to grub and the unclean shutdown and appears not to be related to the auto-login at all.

With a clean shutdown the system does not even normally show the grub menu. With a failed previous boot it deliberately displays the grub menu.

1 Like

Have you verified this behaviour? Because I’ve never seen that. Was it introduced recently? Because as far as I remember, even in the case of a power loss, my system automatically restart and it doesn’t stop indefinitely at the grub menu.

1 Like

Is there a way to force boot instead of halting at the grub menu?

I don’t have a system that I can test it on.
I think I phrased that wrong (and edited the post above), in that I believe grub is intended to display the menu after a failed or incomplete boot. Even then I am not sure it halts indefinitely. It should not halt after a power loss reboot as long as the last boot was successful.

I could see that it might display the menu and possibly halt if the power restore was interrupted with another outage so the first boot did not complete before the power was lost again.

Power outages and storms are the reason Uninterruptable Power Supplies (UPSes) were designed and are used for computers.

1 Like

Exactly, especially such computers who serve some services and should be available 7/24. In this case a no-break who keeps the system up till a certain time, should be able to power off it gracefully and while power is back bring him up normally again.

The halt should remind to search in the log files what is wrong and correct the bad behavior. At least so server software should work.

We discussed this here once already, I looked for that topic but unfortunately could not find it.

But I guess you talk about a client OS and not a server?

I’m talking about a server (and Fedora Server edition).
If I remove the power cable to the machine, when I power it up again, the GRUB menu appears [1] and the boot process automatically start after 5 seconds.


  1. For the records, as far as I can see, on Fedora Server the GRUB menu is always showed even in case of a clean shutdown/reboot ↩︎

3 Likes

Yep, i got no problems with the GRUB menu showing if 5 seconds later it was indeed automatically starting. But it doesn’t. Only after power loss, it just remains stuck at the GRUB menu, in which case I have to connect a keyboard and press ENTER for it to start. I really wish I could solve this problem so that it always automatically starts (such as in your machine), which would make my life so much easier :slight_smile: Could it be something in the BIOS ?

1 Like

But what do you see?
The grub menu without the countdown?
Instead, with a normal reboot, the countdown is there?

1 Like

Howevwer I don’t have this line in /etc/default/grub :thinking: (btw, by setting it, I don’t notice any difference in my case).
Did you tinkered with the grub configuration?
Could you post the link resulting by this command?
sudo fpaste /boot/grub2/grub.cfg

Could we also see the result of cat /etc/default/grub again please.
This is a default /etc/default/grub file on F37

$ cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true