Jump to content











Photo
- - - - -

Get rid of the timeout countdown before booting the previous MBR


  • Please log in to reply
22 replies to this topic

#1 melshafei

melshafei
  • Members
  • 5 posts
  •  
    Egypt

Posted 04 June 2019 - 06:27 PM

I think me and system admins all around the world are very grateful to this forum, we owe our success in our career -I'm for sure- to the geniuses on this from like Steve(steve6375), Wonko and others.

 

I used Steve tutorial from rmprepusb.com website to achieves Grub4dos silent boot from the previous MBR

 

 

If you want to entirely suppress the 'Press F10 to start...' message and the Timeout message and just have the 3..2..1..0 countdown displayed, the following grub4dos commands will patch the disk that grub4dos is installed on, to suppress these messages (omit !BAT if you are typing this into the console):
 
!BAT
cat --locate="Press " --number=2 --replace=\0\0 (hd0)+20 > nul
cat --locate=" to start GRUB," --number=1 --replace=\0\0 (hd0)+20 > nul
cat --locate="Timeout : " --number=1 --replace=\0\0 (hd0)+20 > nul
cat --locate="F10" --number=1 --replace=\0\0 (hd0)+20 > nul
cat --locate="hot-key" --number=1 --replace=\0\0 (hd0)+20 > nul

 

and I had a very beautiful silent boot but I hope for more silent and seamless boot without the time-out countdown, I tried to achieve this by patching the grubinst.exe in a Hex Editor -which I'm very new to- but I failed, I gut the countdown  numbers written beside each other along the line (07 05 04 03 02 01 ).

 

I hop you can guide me and direct me to the right way to achieve this.



#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2019 - 06:40 PM

Are you referring to the menu entry timeout?

Recent versions of grub4dos display this on the same line as the menu entry itself.

You can change the position and color of the timeout numbers using the command

setmenu --timeout=x=y=color

e.g.

setmenu --timeout=0=37=0

should set the timeout counter off the screen (line 37) 

 

If this is not what you mean, please explain how we can see this counter?

 

https://www.rmprepus...commands-primer


Edited by steve6375, 04 June 2019 - 06:43 PM.


#3 melshafei

melshafei
  • Members
  • 5 posts
  •  
    Egypt

Posted 04 June 2019 - 06:50 PM

I'm very happy and appreciative for your reply

 

I meant the countdown that you set when you install Grub4dos like this:

 

grubinst.exe --boot-prevmbr-first --time-out=7 --hot-key=0x1e61 --key-name=A  (hd0)



#4 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2019 - 06:56 PM

So you want a timeout, but you don't want the countdown to be visible?



#5 melshafei

melshafei
  • Members
  • 5 posts
  •  
    Egypt

Posted 04 June 2019 - 06:58 PM

Yes, that's exactly what I'm hoping for.



#6 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2019 - 08:25 PM

That is difficult to do because it uses a print_decimal call to print the number.

You cannot look for a string.

You could look for specific code bytes, but these may change from version to version.

 

You should be able to suppress ALL output by patching the print_message subroutine in the stage1 loader code...

cat --locate=\x2e\xac\x3c\x00\x75\xf6\xc3  --number=1 --replace=\xc3 (hd0)0+1 > nul


#7 melshafei

melshafei
  • Members
  • 5 posts
  •  
    Egypt

Posted 04 June 2019 - 08:32 PM

I'll try this right away and report back to you once I tested it



#8 melshafei

melshafei
  • Members
  • 5 posts
  •  
    Egypt

Posted 04 June 2019 - 08:52 PM

Yeah that works like a charm, l don't know how could I thank you enough?

I'm really depends on your tutorials, and tools like Easy2Boot on my day to day work tasks .



#9 mac57mac57

mac57mac57

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 28 January 2022 - 02:25 PM

Hi All, I am interested in what I thought the original post in this thread asked for: completely suppressing the offer to boot the prior MBR. I just want the menu.lst driven menu to show up - no countdown related to the prior MBR at all.

 

I settled out all the details of my menu.lst while booting grub off a floppy disk. There was no countdown and it behaved just like I wanted except that coming from a floppy it was quite slow. However, once I moved the setup to my HDD, the previous MBR offer and countdown showed up. I would like to disable it entirely and have GRUB4DOS boot directly into the menu.lst driven menu.

 

I have tried repeating the bootlace with the --no-backup-mbr option, but it did not make any difference. Then I tried reducing the countdown to such a small value that it would not be an issue, by again repeating the bootlace but with the --time-out=1 option. This also had no impact, with the "previous MBR" countdown still showing up with a timeout of "5".

 

Does anyone know how to reliably defeat the complete offer to boot the previous MBR?



#10 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 28 January 2022 - 05:48 PM

I think the easiest (if you are familiar with a hex/disk editor) would be to change the flags (control bytes, actually bits) in the grub4dos MBR on disk.

 

The --no-backup-mbr option in bootlace is to avoid (I believe) overwritiing the 2nd sector on disk (but in your case it already contains the copy of the MBR from your previous install),

 

Maybe what you can do is (to keep the possibility of booting the previous MBR) is to change the order it is called to after looking for GRLDR, i.e. set the bit7 to 1:

 

 

Six bytes can be used to control the boot process of GRLDR.MBR.

Offset Length Description
====== ====== ==============================================================
5ah 1 bit0=1: disable the search for GRLDR on floppy
bit0=0: enable the search for GRLDR on floppy

bit1=1: disable the boot of PREVIOUS MBR with invalid
partition table(usually an OS boot sector)
bit1=0: enable the boot of PREVIOUS MBR with invalid
partition table(usually an OS boot sector)

bit2=1: disable the feature of unconditional entrance to
the command-line(See below `--duce')
bit2=0: enable the feature of unconditional entrance to
the command-line(See below `--duce')

bit3=1: disable geometry tune(See below `--chs-no-tune')
bit3=0: enable geometry tune(See below `--chs-no-tune')

bit4 - bit6: reserved

bit7=1: try to boot PREVIOUS MBR after the search for GRLDR
bit7=0: try to boot PREVIOUS MBR before the search for GRLDR

 

or try again bootlace with the --boot-prevmbr-last option:

 

 

--boot-prevmbr-first try to boot PREVIOUS MBR before the search for GRLDR.

--boot-prevmbr-last try to boot PREVIOUS MBR after the search for GRLDR.

 

About the timeout, check the actual value of byte at offset 05bh;

 

 

5bh 1 timeout in seconds to wait for a key press. 0xff stands for waiting all the time(endless).

maybe the bootlace command for *whatever reasons* didn't write there 1.

 

:duff:

Wonko



#11 mac57mac57

mac57mac57

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 28 January 2022 - 08:22 PM

Thanks Wonko, I will give this a try. I have Norton Utilities 8 on the DOS side of this machine, and it has a program called DISKEDIT which should let me directly manipulate the MBR.

 

Alternately I suppose I could use the GRUB4DOS command line's "dd" command to save off the MBR, make the same change with a hex editor but in the saved off file and then use "dd" again to write it back. 

 

I'll report back how this all goes.



#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 29 January 2022 - 08:57 AM

JFYI (shameless plug and I am NOT saying that you "should" use these) you can do everything from within grub4dos:

http://reboot.pro/in...showtopic=22554

http://reboot.pro/in...showtopic=22562

 

If you (are bold/confident enough to) use (good ol') Norton Diskedit you should have no issues using Sectedit.g4b (though it is still experimental it works just fine for this kind of edits).

 

To change a single byte, even catedit would do:

http://reboot.pro/in...showtopic=18783

 

As a side note, the dd in grub4dos has the limit that it cannot create new files, you can use (if you have a suitable FAT filesystem available) the fat external command to create one before the dd (or create from *whatever* OS a 512 bytes file) or use an unused sector for the backup of the MBR, usually sector LBA 62 is used.

 

Besides the fun of it, making a backup of the current MBR with whatever tools you are familiar with is advised (better be safe than sorry ;))

 

:duff:

Wonko 



#13 mac57mac57

mac57mac57

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 02 February 2022 - 05:47 PM

Thanks Wonko!

 

So... if I have understood this properly, and all I really want to try is changing the "previous MBR" timeout from 5 seconds to 1 second, then I need to change the MBR byte at offset 0x5B (or 5BH in the alternate hex notation) to 0x05... or is it the ASCII equivalent, 0x35? Is this all correct?

 

In which case, using your catedit command, the following command would do it?

 

    catedit.g4b (hd0,0) 5B 5      ...or... catedit.g4b (hd0,0) 5B 35

 

This will not mess up any checksums anywhere, will it?  ... resulting in a non bootable disk?

 

Thanks!


Edited by mac57mac57, 02 February 2022 - 05:48 PM.


#14 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 February 2022 - 09:16 AM

No, there are no checksums in the grub4dos MBR (or if there are they exclude those "setting bytes").

 

If you want to try the catedit.g4b (or sectedit.g4b has better interaction/visual feedback and is - loosely - very similar to (good ol' Norton Diskedit[1]) you need to get familia with common grub4dos syntax.

 

(hd0,0) means first disk hd0, first partition 0

 

But you want to edit the first sector of the whole disk (the MBR), i.e. the extent at offset 0, 1 sector in length.

That will be:

(hd0)0+1

you will find many examples where the same object is referenced to as (hd0)+1 as grub4dos parses a + sign just after the closing bracket as  0+

 

Then hex numbers in grub4dos are generically written with the 0x prefix, so an hex offset would be 0x5B (or decimal 91) but catedit, being essentially a "string based" tool, uses a string, so the hex number 0x5 (value) is to be written as "05" (hex string) as the actual byte value that is written to target.

 

So your command should be:

catedit.g4b (hd0)0+1 0x5B 05

or - actually to reduce it to 1:

catedit.g4b (hd0)0+1 0x5B 01

 

But - expecially during tests - you'd better use the interactive sectedit.g4b, as this way you can also inspect what the current value is.

 

Or run:

cat --hex --skip=0x5b --length=1 (hd0)+1

to check the value before or (say)

cat --hex --length=96 (hd0)+1

to see the first 96 bytes of the MBR (i.e. to see that setting byte "in context")

 

And before anything else do run:

dd if=(hd0)+1 of=(hd0)62+1 bs=512 count=1

to have a backup copy of the MBR "just in case" (of course provided that your first partition starts at LBA 63)

 

:duff:

Wonko

 

[1] in the release thread deomsh posted a screenshot where you can see how it looks like:

http://reboot.pro/up...-1632316755.png



#15 mac57mac57

mac57mac57

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 03 February 2022 - 10:05 PM

Thanks again Wonko. I probably never would have gotten that syntax right on my own.

 

As it happens, with your correct syntax in hand, I tried SectEdit and then CatEdit but neither would execute - GRUB responded with something about an unrecognized command. A little Google'ing around revealed that I needed GRUB4DOS 0.4.6 in order to execute batch files. I had installed 0.4.4!

 

Today, I upgraded to 0.4.6, which included a new bootlace with the "--no-backup-mbr" option. This unexpectedly solved the problem! The offer to boot the prior MBR and its annoying 5 second countdown has disappeared. The bootlace "--no-backup-mbr" option actually did what it was supposed to!

 

SO... I don't NEED to play with SectEdit or CatEdit, but both look really interesting and I am going to have a go at them anyway.

 

Thanks again for all your help!


Edited by mac57mac57, 03 February 2022 - 10:05 PM.


#16 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 04 February 2022 - 01:04 AM

If dealing with grub4dos (for MBR) you can use BootIce to install it, it has 0.4.5c and 0.4.6a versions into its internal code, but if you put BootIce program into a folder and also copy into that folder let's say last released grldr.mbr & grldr.pbr files from 0.4.6a version, just by selecting to apply 0.4.6a version the program will search for a new version to install into same folder first, it there is not any available, then uses the internal one.

 

In fact I always disable install MS NT6 MBR to the second sector.

 

Also it is capable to edit the internal menu.lst of grub4dos for MBR.

 

See attached pictures as a guide, just select your favorite options on the red arrows.

 

alacran

Attached Thumbnails

  • Install grub4dos.png
  • Edit internal menu.lst.png

  • wimb likes this

#17 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 February 2022 - 12:28 PM

I hadn't thought (my bad :blink: ) to ask you about the version you were using, the 0.4.4 is very, very old, has no scripting support and very likely the particular 0.4.4 version you found is a largely deprecated development/beta/buggy version, not even the "final" 0.4.4 2009-10-16 one that is nowhere to be found if not here on reboot.pro (kept available for "retro" experiments), and is anyway some 12 (twelve) years old:

 

http://reboot.pro/in...ds&showfile=175

 

Anyway, happy :) you are now up-to-date and successful in your tweaking.

 

:duff:

Wonko



#18 mac57mac57

mac57mac57

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 05 February 2022 - 01:29 PM

Thanks again Wonko. Unfortunately, such a simple and happy ending must have been too easy for GRUB4DOS to accept. While I can now successfully boot either of the machines two hard drives, one with Windows 95 and one with DOS 6.22/WFWG 3.11, NEITHER version of Windows "sees" the A:\ 3.5" floppy when booted by GRUB4DOS 0.4.6. Oddly, DOS can access it just fine. Windows 95 went so far as to reassign the A: drive letter to the CDROM! If I boot the same two hard drives with GRUB4DOS 0.4.4 (via the floppy - still have the original floppy based setup I used to test out GRUB4DOS 0.4.4) BOTH versions of Windows DO see the floppy. VERY strange.

Does this suggest anything to anyone? Do I need extra GRUB4DOS commands in 0.4.6 to map the floppy ... or some such thing?

For now, I have had to return to my 0.4.4 floppy setup so that I can access and use the A: drive. It works just fine, but floppies are slooooow to boot from.

Thanks!

Edited by mac57mac57, 05 February 2022 - 01:31 PM.


#19 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 05 February 2022 - 01:56 PM

Run BootIce, open your grld (from v0.4.6a) file located into your Mass Storage device and edit it to your needs, please see attached picture of what BootIce shows for you.  Deleting all into the red rectangle should work for your needs.

 

alacran

Attached Thumbnails

  • grld edition.png

  • wimb likes this

#20 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 05 February 2022 - 04:34 PM

Well, in any case do make a new grub4dos floppy with the "final" 0.4.4 version I pointed you too and leave alone anything earlier[0].

 

You can easily test grub4dos from DOS.

 

Basically grub4dos comes in two "flavours":
1) grldr whis is what you are currently booting (what you actually wrote to the MBR - and following 17 sectors - is grldr.mbr, which essentially finds and loads grldr)

2) grub.exe which is "exactly" the same as grldr, but cleverly packed in a way that it is at the same time a DOS executable AND a Linux Elf one.

 

So right now you are booting to grldr.mbr that looks for the first instance of grldr (both 0.4.6 version) on the same disk and chainloads it.

From this you can boot to DOS.

From this booted DOS, you can load grub.exe (*any* grub.exe)

 

So you can have on your hard disk partition (let's say C:\ ) the 0.4.6 grub4dos and the 0.4.4. (latest 0.4.4 version[0]) grub.exe, besides your menu.lst.

If, from DOS, you run grub.exe it will load (again) the same menu.lst that you loaded on boot and brought you to DOS, if now you choose the Windows and you find the floppy drive as A;\ then the issue is specifically with the grub4dos 0.4.6 you are using.

 

As well, grldr is a chainloadable file, so you can have (still to simplify) in C:\044\ a grldr from 0.4.4, you boot normally (to 0.4.6) then, instead of choosing a menu.lst entry, you press "c" for command line and issue the commands:

chainloader /044/grldr

boot

 

Once again you should be at the menu.lst, choose the windows, and check if the floppy is present.

 

 The 0.4.6 grldr.mbr that you have now installed should be :unsure: capable of loading the 0.4.4 grldr, so if the tests above are successful, try replacing the grldr in root with the one from 0.4.4 should work without needing to re-run bootlace or "reinstalling" grub4dos.

 

I would not be surprised that 0.4.6a in some version introduced a "regression bug" like the one you described, as floppies (real ones) are nowadays pretty rare and it is entirely possible that noone had the occasion to experience it.

 

But you can choose among:

0.4.4 2009-10-16

latest version of grub4dos 0.4.5c (or even previous versions)

previous versions of 0.4.6a

 

So, maybe you will need some patience, but you will surely find a suitable version or combo.

 

@alacran

Those settings are ONLY "search paths" for menu.lst, they have nothing to do with the issue at hand.

 

:duff:

Wonko

 

 

 

 

[0] advised, but if your current, probably older, version works in your setup, let it be.



#21 mac57mac57

mac57mac57

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 07 February 2022 - 11:19 PM

Hi All, I *think* this story finally has a happy ending. Wonko, I read through your very comprehensive response (thank you!) and ultimately found that replacing the 0.4.6 GRLDR file on my boot partition with the 0.4.4 GRLDR file resolved the issue of loss of the A:\ floppy in both versions of Windows (Win95 and WFWG 3.11).

 

In effect, upgrading to the 0.4.6 MBR resolved the "previous MBR" offer and countdown issue, and then downgrading to the 0.4.4 GRLDR resolved the resulting "missing A:\ floppy" issue. Its a strange two-step to get to the desired end result, but it works!

 

I am guessing that we can conclude that something is amiss with 0.4.6 and floppies?

 

As always, thanks for all the help!



#22 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 08 February 2022 - 01:01 PM

Hi All, I *think* this story finally has a happy ending. Wonko, I read through your very comprehensive response (thank you!) and ultimately found that replacing the 0.4.6 GRLDR file on my boot partition with the 0.4.4 GRLDR file resolved the issue of loss of the A:\ floppy in both versions of Windows (Win95 and WFWG 3.11).

 

In effect, upgrading to the 0.4.6 MBR resolved the "previous MBR" offer and countdown issue, and then downgrading to the 0.4.4 GRLDR resolved the resulting "missing A:\ floppy" issue. Its a strange two-step to get to the desired end result, but it works!

 

I am guessing that we can conclude that something is amiss with 0.4.6 and floppies?

 

As always, thanks for all the help!

You are welcome :).

 

About the guess, yes and no.

Meaning that there is a "third factor", which is your specific BIOS.

 

It is perfectly possible that (good ol') 0.4.4 talked to BIOS "this way" whilst the better/newer 0.4.6 talks with it in "this other way" (and they don't understand each other), it is strange as - as said - there is no real reason why anything should have been changed in the "floppy" part since 0.4.4, but a regression bug of some kind is still possible.

 

Anyway, from your 0.4.4 you should be able to chainload the 0.4.6 grldr (placed in a subdirectory) or - from a booted DOS - run the 0.4.6 grub.exe, so you can have both, the 0.4.4 for "normal operation" and the 0.4.6 in case of need.

 

To better understand if there is some difference between the two in the way they "see" the floppy, you can try issuing the 

map --status

command in both and see if you can see any difference, if the output is the same, there must be something wrong in the way Windows reads the map, as DOS as you say is fine).

 

You can try:

map (fd0) (fd1)

map --hook

to see if it makes any difference in the 3.1 or 95

 

Or try mapping a floppy image, like:

map /myimage.ima (fd0)

map --hook

 

If you want to delve deeper in the issue (or even if you don't, use it as a handy tool if needed) maybe (just maybe) good ol' Letter Assigner may help with Windows drive letter assignment.  

 

http://web.archive.o...s.com/LetAssig/

 

:duff:

Wonko



#23 Leolo

Leolo

    Newbie

  • Members
  • 24 posts
  •  
    Spain

Posted 11 November 2022 - 03:16 PM

If dealing with grub4dos (for MBR) you can use BootIce to install it, it has 0.4.5c and 0.4.6a versions into its internal code, but if you put BootIce program into a folder and also copy into that folder let's say last released grldr.mbr & grldr.pbr files from 0.4.6a version, just by selecting to apply 0.4.6a version the program will search for a new version to install into same folder first, it there is not any available, then uses the internal one.

 

Sir, I believe that's not true (at least in Windows 10 x64). BootIce ignores the files grldr.mbr and grldr.pbr that I've copied into its folder. It doesn't read them and doesn't apply their contents into the target USB drive.

 

I've created two USB drives (one using bootice.exe alone in a folder, and the other using bootice.exe together with the latest grldr.mbr and grldr.pbr from 26th of october 2022) and then inspected the sectors of both drives using an Hex Editor. They are binarily identical. The only bytes that show any differences are those related to serial numbers (which Windows randomizes every time you re-partition or format a drive)

 

It would be great if BootIce was able to do what you suggest, but unfortunately it doesn't :(






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users