1

How to print from CMOS which device will be used as boot device after reboot?

Computer has several sata disk drives and several bootable USB-devices attached.

The layout of CMOS memory is defined by version of BIOS used. I know that there are several different versions and manufacturers of BIOSes. I think it is possible to determine which one is used by examining BIOS memory. Somehow like in this question - How to check the BIOS version or name in Linux through a command prompt?

My computer gives

$ sudo dmidecode -t bios -q
BIOS Information
    Vendor: Award Software International, Inc.
    Version: F4
    ...
Characteristics:
    Boot from CD is supported
    Selectable boot is supported
    USB legacy is supported
    BIOS boot specification is supported
    ...

I don't have the possibility to reboot comuter and just look to the BIOS settings. This is why I need to know them without rebooting.

# dmidecode --type 32 --dump

Handle 0x0025, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected
Header and Data:
    20 0B 25 00 00 00 00 00 00 00 00
Strings:
    20 00
    " "

Found some docs,
http://www.scs.stanford.edu/05au-cs240c/lab/specsbbs101.pdf
http://www.dmtf.org/standards/smbios
http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf
but they are not enough for me.

Ideally, I need some command line tool (or information on how to write it) which will help me to understood which device (/dev/sd?) will be booted.

There is similar question about windows, but also without definitive answer - How to tell which disk Windows Used to Boot

Community
  • 1
  • 1
user1709408
  • 518
  • 4
  • 16

2 Answers2

2

If it's UEFI there are defined variables holding the boot order and a tool "efibootmgr" that can help you access them: https://linux.die.net/man/8/efibootmgr

lmz
  • 1,495
  • 1
  • 8
  • 18
2

If this is really a BIOS based system, rather than UEFI, then there is no universally available and reliable way to determine what disk will be booted from. For many BIOS versions, the disk booted by default may even change seemingly randomly from one boot to the next as devices are enumerated in different orders.

If you want to reliably boot GNU/Linux on a BIOS based machine, the standard solution is to make sure that grub's boot sector gets installed to the MBR of any drive which the BIOS might decide to boot from. If your distribution automatically re-installs grub when grub packages get updated (which it should, and most do) then you should make sure that your distribution is configured to re-install grub's boot sector to all drives as well.

Jordan Uggla
  • 121
  • 1