Hello David and Thomas, 

On Sun, 21 Jul 2024 10:45:59 +0000 David <bouncingc...@gmail.com> wrote:

> On Sun, 21 Jul 2024 at 09:46, Thomas Schmitt <scdbac...@gmx.net> wrote:
> > ...

> So your manually written grub.cfg. would contain something like the below 
> lines
> in addition to whatever other content you need to boot the machine.
> 
> smbios --type 1 --get-byte 24 --set result
> if [ "${result}" == "REPLACEME" ] ; then
>     default=1
> else
>     default=2
> fi
> 

Many thanks, it works :-) 

Here for me the result is either 5 or 6 and I can switch between the boot 
entries by manipulating the default entry via this smbios command. The best 
thing with this solution is, that it only sets the default value so the user 
can override it manually by choosing some other entry. The timeout remains. 

Btw: This computer is one of those where Windows is constantly kicking out Grub 
from the EFI Boot Manager. After booting Windows there is no longer any grub in 
the EFI Boot Manager and the PC starts Windows only. 

But that's not Microsofts fault here, it's the BIOS vendors fault (HP/AMI) as 
this UEFI removes all EFI Boot Manager entries except the Default one. I tried 
to add several additional entries and they all get removed on next boot. So if 
Grub adds itself, the Windows boot entry gets removed. So Windows adds itself 
again on next boot (which I think is quite reasonable to do). So then Grub gets 
removed again. 

The solution is to force Windows to add Grub as its own Bootloader with (in a 
Windows Admin Shell):

bcdedit /set {bootmgr} path \EFI\debian\shimx64.efi

There are plenty of articles in the Internet how to do so correctly. Afterwards 
Windows wants to install Grub if Grub gets removed from UEFI. ;-) 

> Hopefully all that remains is to use the above information to figure out
> the actual value needed to replace my REPLACEME placeholder.

Boot the PC via all the different methods and for every one run in the Grub 
shell: 
smbios --type 1 --get-byte 24
This returns the value of the current startup type / boot reason. 

Many thanks
hede

Reply via email to