[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GRUB really slow to boot




On 18/12/2021 16:08, Greg Wooledge wrote:
Today I rebooted my machine for the first time in quite a while, after
the kernel update that was released along with Debian 11.2.

When it reached the GRUB screen, I pressed Enter, and nothing happened
as far as I could see.  I was initially worried that it had stopped
seeing my USB keyboard (a thing that I've experienced with GRUB and
certain USB slots on certain machines in the past).  This keyboard
plugged into this same USB slot had worked in previous versions of GRUB
on this machine, though.

The next thing I observed was that after 5 seconds, it still hadn't
booted, nor had the coundown ("will automatically boot in 5s" or whatever)
advanced.  It appeared to be hung.

I waited a bit longer, and the 5s changed to 4s.  It just took a really
long time (like 15+ seconds for each second on the timer).

Eventually, after a minute or two, the system booted.  Everything is
working normally now, post-GRUB.

Has anyone experienced this, or does anyone have ideas about how to
prevent it happening again?  I am not interested in trial and error
for this, because it's far too annoying and disruptive.  But if there
are well-known ideas about things I could try (e.g. "grub 2.04 is known
to have bugs on Intel motherboards, revert to 2.03") then I'm game.

Not a definitive answer here, but to me, this sounds like the sort of behaviour a program would have when having to process lots of interrupts. You say that pressing Enter does nothing and that the countdown happens really slowly. Imagine you had a stuck key - something which was repeatedly sending keypresses to GRUB, but which weren't triggering the "cancel timer" branch. Something like CTRL or Shift, maybe. Or an ACPI key etc.

I see that you say you're not interested in trial-and-error and I can understand that. If you can, try using a different keyboard. Or just unplug the keyboard entirely (You may need to configure your BIOS to allow booting without the keyboard or just allow the BIOS enough time to see the keyboard and THEN unplug it before GRUB sees it).

https://sources.debian.org/src/grub2/2.04-20/grub-core/normal/menu.c/#L601 seems to be the loop of code that GRUB executes while waiting for a key. I can see some functions there that, if not written carefully, COULD take some time to return.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: