• Re: Switch boot entry by power-on reason

    From Thomas Schmitt@21:1/5 to David and Thomas collaboratingly on Mon Jul 29 18:50:01 2024
    Hi,

    David and Thomas collaboratingly wrote:
    smbios --type 1 --get-byte 24 --set result

    hede wrote:
    Many thanks, it works :-)

    \o/\o/ So the community and its resources are not that useless \o/\o/


    Have a nice day :)

    Thomas

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From hede@21:1/5 to bouncingcats@gmail.com on Mon Jul 29 18:30:04 2024
    Hello David and Thomas,

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

    On Sun, 21 Jul 2024 at 09:46, Thomas Schmitt <scdbackup@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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)