help-grub
[Top][All Lists]
Advanced

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

Re: Pause GRUB booting


From: Steve
Subject: Re: Pause GRUB booting
Date: Tue, 11 Apr 2017 23:27:25 +0100

If you have a USB port, why not test for a file on a USB flash drive.
Then they just have to plug in the flash drive to do a recovery.


On 11 April 2017 at 22:29, Robert Middleton <address@hidden>
wrote:

> On Tue, Apr 11, 2017 at 1:58 PM, Andrei Borzenkov <address@hidden>
> wrote:
> > 11.04.2017 18:59, Robert Middleton пишет:
> >> I'm trying to modify GRUB to pause booting if a user presses a button
> >> that is connected to a USB<->Serial converter.  This is a bit of an
> >> odd situation, so here's a quick overview:
> >>
> >> On occasion, we need to allow end-users to pause booting to allow for
> >> HDD recovery.  This can only happen before GRUB attempts to write to
> >> the HDD,
> >
> > GRUB does not write anything; the only possible write is save_env
> > command that must be called explicitly in grub.cfg.
> >
>
> Yes that's what I meant; GRUB tries to write the environment.  The
> first few bytes of the data that gets sent to disk start with
> "recordfail=1".
>
> Is there a specific time that the save_env has to be called?  For
> example, can I just re-arrange what gets generated from
> /etc/grub.d/00_header to have all save_env calls after a timeout?
>
> >> otherwise the system stays broken.  The system has no
> >> keyboard, but it does have hard buttons that send a serial message
> >> over an FTDI usb to serial converter.
> >
> > Note that right now GRUB ftdi driver only supports QEMU emulated USB
> > serial, so you will likely need to extend it.
> >
> >> I have tried editing grub.cfg
> >> to insert the FTDI module, but I don't see exactly how to read data
> >> from an arbitrary serial port and continue on if there is no data on
> >> the serial line.
> >
> > This is similar to what was requested before. I think we need to add
> > support for timeout as well as raw character to read. Actually there was
> > patch at least for timeout as far as I remember. Currently I'm afraid
> > there is no way to poll for character with timeout on CLI level.
> >
>
> I was afraid of that, but that's good to know.  One suggestion if
> anybody is going to implement this: also have the ability to wait for
> a specific string of data, not just a character.
>
> >> There are also about 6 FTDIs on the system, so
> >> knowing which one to read from is important.
> >
> > Actually GRUB supports multiple input (and output) devices so you could
> > add all of them as input device and read would poll all of them. Vut see
> > below.
> >
> > I would not know how to distinguish between 6 identical USB devices in
> > Linux either.
> >
>
> In Linux, I have several udev rules that read the device descriptors
> from the chips and create the proper symlinks.  We program the FTDI
> devices so that we know which one is which.
>
> >>  My backup plan is to
> >> pause the boot for 30 seconds each time, but I'm trying to avoid
> >> that(plus the wait still has to happen before any data gets written to
> >> the disk).
> >>
> >> Is this possible to achieve, or would it require hacking of GRUB code
> directly?
> >>
> >
> > You will need to hack code. The most obvious is to extend read to
> > timeout or return after fixed amount of characters (e.g. 1) are seen.
> > See grub-core/commands/read.c.
> >
>
> After talking with our customer, they're actually okay with just
> delaying the boot for a few seconds each time.  It's not ideal, but is
> less likely to cause problems with systems.
>
> -Robert Middleton
>
> _______________________________________________
> Help-grub mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-grub
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]