Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GRUB command-line with timeout

36 views
Skip to first unread message

Steve Keller

unread,
Jul 1, 2021, 2:30:05 PM7/1/21
to
When booting with GRUB, normally the menu showing several kernel
versions and/or kernel command lines appears to choose from. If no
selection is made within a few seconds (default is 5s IIRC), the
default entry is booted.

I'd prefer to be dropped into the GRUB command line instead of that
menu. But still I'd like to have the timeout after which a default
entry is boot if no command is entered at the prompt.

Can that be configured in GRUB?

Steve

David Wright

unread,
Jul 1, 2021, 3:00:04 PM7/1/21
to
‘GRUB_TIMEOUT_STYLE’

If this option is set to ‘countdown’ or ‘hidden’, then, before displaying the menu, GRUB will wait
for the timeout set by ‘GRUB_TIMEOUT’ to expire. If ESC is pressed during that time, it will display
the menu and wait for input. If a hotkey associated with a menu entry is pressed, it will
boot the associated menu entry immediately. If the timeout expires before either of these
happens, it will boot the default entry. In the ‘countdown’ case, it will show a one-line
indication of the remaining time.

Cheers,
David.

Brian

unread,
Jul 1, 2021, 3:50:04 PM7/1/21
to
On Thu 01 Jul 2021 at 20:08:40 +0200, Steve Keller wrote:

> When booting with GRUB, normally the menu showing several kernel
> versions and/or kernel command lines appears to choose from. If no
> selection is made within a few seconds (default is 5s IIRC), the
> default entry is booted.

Sounds about right.

> I'd prefer to be dropped into the GRUB command line instead of that
> menu. But still I'd like to have the timeout after which a default
> entry is boot if no command is entered at the prompt.

You want GRUB's normal operation but, at the same time, you want GRUB
to fail?

The use case is interesting. Perhaps you could explain.

> Can that be configured in GRUB?

Only with great difficulty.

--
Brian.

David Wright

unread,
Jul 1, 2021, 4:50:04 PM7/1/21
to
I agree. My (untested) partial solution still requires you to press C
to get the Grub prompt.

It does seem a recipe for confusion, though. How would you tell if
Grub said "Grub>" because you had succeeded in your quest,
or said "Grub>" because it had failed, i the normal way of things.

Cheers,
David.

David

unread,
Jul 1, 2021, 11:10:04 PM7/1/21
to
On Fri, 2 Jul 2021 at 06:47, David Wright <deb...@lionunicorn.co.uk> wrote:
> On Thu 01 Jul 2021 at 20:39:48 (+0100), Brian wrote:
> > On Thu 01 Jul 2021 at 20:08:40 +0200, Steve Keller wrote:

> > > When booting with GRUB, normally the menu showing several kernel
> > > versions and/or kernel command lines appears to choose from. If no
> > > selection is made within a few seconds (default is 5s IIRC), the
> > > default entry is booted.

> > > I'd prefer to be dropped into the GRUB command line instead of that
> > > menu. But still I'd like to have the timeout after which a default
> > > entry is boot if no command is entered at the prompt.

> > You want GRUB's normal operation but, at the same time, you want GRUB
> > to fail?

> > The use case is interesting. Perhaps you could explain.

> > > Can that be configured in GRUB?

> > Only with great difficulty.

I wonder how you think this might be achieved, because I can't
imagine any way to do this, short of patching and rebuilding grub.
Which is not what I think of as "configured" :)

Because I'd imagine that the timeout is part of the menu-key
handling code, which is unlikely to have anything to do with the
interactive-prompt key handling and parsing code.

> I agree. My (untested) partial solution still requires you to press C
> to get the Grub prompt.

I'm not able to find any means to access the parent grub prompt
that does not require a keypress ("press a key to continue" appears
after various intentional failure experiments).

It is possible to activate a nested grub prompt via a menuentry like:

menuentry "grub prompt" {
normal a_filename_that_does_not_exist
}

Which could automatically activate after a time delay. However that
is the opposite of what the OP wants.

And I can't understand why anybody would want that behaviour
anyway. One would be thinking that they've been dropped into
the interactive-prompt because of a failure, and without any
warning the system actually boots out of there? Ugh.

So, it's a "no" from me :)

Steve Keller

unread,
Jul 13, 2021, 5:30:04 AM7/13/21
to
Brian <ad...@cityscape.co.uk> writes:


> > I'd prefer to be dropped into the GRUB command line instead of that
> > menu. But still I'd like to have the timeout after which a default
> > entry is boot if no command is entered at the prompt.
>
> You want GRUB's normal operation but, at the same time, you want GRUB
> to fail?
>
> The use case is interesting. Perhaps you could explain.

Hm, I'he never considered the CLI as an indication of failure but simply
a more flexible and more powerful interface alternative compared to the
boot menu.

IIRC, in grub 0.99 things were this way.

And I am almost always in favor of comand-line interfaces, especially in
such low level situations as a boot loader.

So I'd like to be dropped into CLI but with a timeout, since I reboot the
machine in question remotely in most cases.

Steve

David Wright

unread,
Jul 13, 2021, 11:40:04 AM7/13/21
to
Let's put aside your normal case of booting remotely, when it won't
matter what was displayed on the screen before the timeout expires and
the default is booted.

So on the odd occasion, you turn on the machine and, at a mininum, are
about to type in some commands to boot the machine manually. And then
you might even log in. Having to type /one/ keystroke at the start is
just too much.

Is that what you're really saying?

Cheers,
David.

rhkr...@gmail.com

unread,
Jul 13, 2021, 3:50:05 PM7/13/21
to
On Tuesday, July 13, 2021 11:34:48 AM David Wright wrote:
> So on the odd occasion, you turn on the machine and, at a mininum, are
> about to type in some commands to boot the machine manually. And then
> you might even log in. Having to type /one/ keystroke at the start is
> just too much.
>
> Is that what you're really saying?

I'm not the OP, and I don't boot very often at all -- my machines run 24/7 for
months on end, so I don't know / remember what has to be done in GRUB to get
to the command line, but the bigger annoyance for me would be waiting for the
right moment to press that key (if there is a time window associated with when
you can press that key).

If my machine takes 15 or more seconds to get to the point when I can press
that single key, unless I am very careful and patient, I am likely to miss
that window. (Of course, I am getting older :-(

David Wright

unread,
Jul 13, 2021, 6:30:04 PM7/13/21
to
Perhaps you're confusing Grub with getting into the CMOS?

Unless you change the defaults, Grub gives you a 5-second countdown
screen, which displays the keystrokes and what they do. Any key will
stop the countdown (unless, say, you press Return which boots the
entry under the cursor). You can configure longer countdowns.

OTOH many modern screens have barely stabilised the display before
the time has expired for pressing F2/F12/whatever for the CMOS.
Hammering a key might help, but there are now modern machines where
you're meant to press two keys (like Esc F9), which is not as easy
as hammering F12 on its own.

Cheers,
David.

rhkr...@gmail.com

unread,
Jul 13, 2021, 9:30:05 PM7/13/21
to
On Tuesday, July 13, 2021 06:24:27 PM David Wright wrote:
> On Tue 13 Jul 2021 at 15:43:55 (-0400), rhkr...@gmail.com wrote:

> > I'm not the OP, and I don't boot very often at all -- my machines run
> > 24/7 for months on end, so I don't know / remember what has to be done
> > in GRUB to get to the command line, but the bigger annoyance for me
> > would be waiting for the right moment to press that key (if there is a
> > time window associated with when you can press that key).
> >
> > If my machine takes 15 or more seconds to get to the point when I can
> > press that single key, unless I am very careful and patient, I am likely
> > to miss that window. (Of course, I am getting older :-(
>
> Perhaps you're confusing Grub with getting into the CMOS?

Close enough (I would just say forgetfulness, but confusion works also ;-)

Steve Keller

unread,
Jul 17, 2021, 5:30:04 AM7/17/21
to
David Wright <deb...@lionunicorn.co.uk> writes:

> So on the odd occasion, you turn on the machine and, at a mininum, are
> about to type in some commands to boot the machine manually. And then
> you might even log in. Having to type /one/ keystroke at the start is
> just too much.
>
> Is that what you're really saying?

No, I'm not saying that anything is too much. Just that I prefer CLI
and not to see the menu. It just a matter of my own personal taste.
Not really important.

Steve
0 new messages