2

Without having access to the physical display, how can I know if my computer is being booted by grub or systemd-boot?

As I have writted on the tittle I have both /boot/grub/ and /boot/efi/EFI/systemd/ folders.

On the other hand dd if=/dev/sda bs=512 count=1 2>/dev/null | strings returns the following:

ZRr=
`|f
\|f1
GRUB
Geom
Hard Disk
Read
 Error

But on the other hand cat /boot/efi/EFI/BOOT/BOOTX64.EFI | strings |grep systemd returns #### LoaderInfo: systemd-boot 247.3-7+deb11u1 ####

Sooo... What's going here? It's the computer using grub or systemd-boot?

EDIT: efibootmgr -v output:

BootCurrent: 0004
Timeout: 1 seconds
BootOrder: 0004,0002,0005,0006,0007,0008,0000,0003,0001
Boot0000* Windows Boot Manager  VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a...............
Boot0001* Linux Boot Manager    VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0002* Linux Boot Manager    HD(2,GPT,1eded8dc-d1ab-4723-b499-b718400c1898,0x800,0x100000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0003* Linux Boot Manager    VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0004* Linux Boot Manager    HD(2,GPT,ed10b328-3615-45c0-bf5b-b117031e4c22,0x800,0x100000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)
Boot0005* UEFI OS    HD(2,GPT,26b839e2-9a19-4e21-ad28-dbd1c15d598d,0x800,0x100000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0006* Hard Drive BBS(HD,,0x0)..GO..NO........o.S.a.m.s.u.n.g. .S.S.D. .8.7.0. .Q.V.O. .1.T.B...................A..........................>..Gd-.;.A..MQ..L.5.S.R.R.F.N.R.0.3.B.0.5.8.4. .Y. . . . .......BO..NO........o.S.T.1.2.0.0.0.N.M.0.0.1.G.-.2.M.V.1.0.3...................A..........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .T.Z.0.N.9.0.G.2.......BO..NO........o.S.T.1.2.0.0.0.N.M.0.0.1.G.-.2.M.V.1.0.3...................A..........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .T.Z.0.N.2.1.T.1.......BO..NO........o.S.T.1.2.0.0.0.N.M.0.0.1.G.-.2.M.V.1.0.3...................A..........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .T.Z.0.N.8.0.J.C.......BO..NO........o.S.a.m.s.u.n.g. .S.S.D. .8.7.0. .Q.V.O. .1.T.B...................A..........................>..Gd-.;.A..MQ..L.5.S.R.R.F.N.R.0.3.B.0.5.9.7. .P. . . . .......BO..NO........o.S.a.m.s.u.n.g. .S.S.D. .8.7.0. .E.V.O. .1.T.B...................A..........................>..Gd-.;.A..MQ..L.6.S.U.P.M.N.T.0.3.5.7.8.4.2. .L. . . . .......BO
Boot0007* UEFI OS    HD(2,GPT,1eded8dc-d1ab-4723-b499-b718400c1898,0x800,0x100000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0008* UEFI OS    HD(2,GPT,ed10b328-3615-45c0-bf5b-b117031e4c22,0x800,0x100000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
4
  • 2
    What does sudo efibootmgr -v show? Grub uses grubx64.efi or shimx64.efi in UEFI boot. External drives and fallback and some others may use /EFI/Boot/bootx64.efi. Grub may make bootx64.efi a copy of shimx64.efi but then other installs may also use that.
    – oldfred
    Feb 15, 2023 at 21:55
  • @oldfred Edit into the question
    – Héctor
    Feb 15, 2023 at 22:06
  • I think it's clear now... Didnt know the -v option
    – Héctor
    Feb 15, 2023 at 22:34
  • 1
    Default looks like SystemD boot. Not sure what 7 & 8 may be as fallback drive boot entry. The VenHw is either a BIOS boot or disconnected drive, so UEFI changes to a default entry of some sort.
    – oldfred
    Feb 15, 2023 at 22:44

2 Answers 2

1

The fact that efibootmgr -v works proves your system has UEFI runtime services enabled, which can only happen when the system is booted in UEFI mode.

(As Marcus Müller said in the comments, the reverse inference cannot be made: it would be possible to boot in UEFI mode even without UEFI runtime services being enabled, either because the firmware chooses to not provide them, or because the kernel is missing the necessary build-time option to use them. In newer kernels, it is also possible to disable the use of UEFI run-time services by a boot option, e.g. to work around bugs in specific UEFI firmware implementations.)

BootCurrent: 0004
[...]
Boot0004* Linux Boot Manager    HD(2,GPT,ed10b328-3615-45c0-bf5b-b117031e4c22,0x800,0x100000)/File(\EFI\SYSTEMD\SYSTEMD-BOOTX64.EFI)

When your system was booted up, it used the Boot0004 boot option, which uses systemd-bootx64.efi on a partition whose PARTUUID is ed10b328-3615-45c0-bf5b-b117031e4c22. So you are currently using systemd-boot. You can see the PARTUUIDs with lsblk -o +partuuid.

Your dd if=/dev/sda bs=512 count=1 2>/dev/null results indicate that a a BIOS-compatible i386-pc version of GRUB has been installed on that disk at some point, but unless the system is configured with the BIOS compatibility module (CSM) enabled, it will be completely meaningless for the UEFI firmware. It is possible (although not certain) that the Boot0006 boot option could represent booting from that disk in BIOS-compatible mode.

Note that the i386-pc version of GRUB is not entirely contained in the Master Boot Record block: it also needs to embed the rest of the GRUB core image to a fixed location on the disk. On a MBR-partitioned disk, the unused space between the MBR and the beginning of the first partition is normally used for this; on a GPT-partitioned disk, this space is occupied by the GPT partition table structures, so a dedicated "biosboot" partition would be needed to boot with a BIOS-style GRUB from a GPT-partitioned disk.

However, Microsoft chose to tie the boot method and the partitioning scheme together in their Windows OS, so a Windows installed to a MBR-partitioned disk will only ever boot in BIOS-style, and a Windows installed to a GPT-partitioned disk will only ever boot in UEFI style. A boot manager normally cannot switch between boot styles, so if you have multiple OSs installed, it's most convenient to use the same boot method (either BIOS or UEFI) with all of them.

The presence of the text Windows Boot Manager in efibootmgr -v output suggests you may have a Windows OS that is booting in UEFI mode, so if you want to use GRUB, you should use the UEFI-native x86_64-efi version of GRUB instead of the i386-pc BIOS version.

2
  • Nice answer. The presence of Windows Boot Manager really confuses me because windows has never been installed on that PC. It's been running proxmox (debian based) all its life. Proxmox it's an hypervisor and inside it there is one windows virtual machine, but this W10 VM boot from a virtual disk, so it shouldn't be related with what we are seeing here. If it's really the i386-pc version then it's even weirder.
    – Héctor
    Feb 16, 2023 at 11:32
  • 1
    The UEFI hardware path associated with the Windows Boot Manager is of type VenHw, so it is a vendor-specified path. Unless the vendor documents their UEFI implementation at a technical level, it is anyone's guess what that entry might mean. It could be some sort of autodetection mode: "try and find a Windows Boot Manager, no matter where it might be", or something. Or it might be a remnant of a factory-default Windows pre-installer which you did never use and promptly overwrote it on day 1.
    – telcoM
    Feb 16, 2023 at 12:10
-2

https://itsfoss.com/check-uefi-or-bios/

gives answer for both windows and linux

in linux, after you have SSH'd in, The easiest way to find out if you are running UEFI or BIOS is to look for a folder /sys/firmware/efi. The folder will be missing if your system is using BIOS.

4
  • Sorry, if my question isn't clear enough but I'm not asking if I'm running on UEFI or BIOS. I known I'm on UEFI, but not what bootloader is doing the boot process.
    – Héctor
    Feb 15, 2023 at 22:09
  • Also, the answer is inaccurate. A lot of itsfoss.com reads more like it's been written by an AI that has the first page of Google results, but no understanding. (That's no criticism of you, Ron; just a remark regarding that specific website) Feb 16, 2023 at 0:19
  • The answer is wrong, by the way, because a sufficient and a necessary condition are not the same. From the absence of that directory you cannot infer that a BIOS boot was done. Feb 16, 2023 at 0:24
  • neglecting interpretation of the original question, I just installed CentOS Stream-8 onto an older Asus P6X58D-E motherboard which predates UEFI. There is no /sys/firmware/efi folder present. So you certainly are not correct in saying that my answer is wrong. The original question needs to be modified syntactically to better get across whatever the question is. When Hector says in the above comment I known I'm on UEFI, - first that's not even correct engrish and second if you already know then WTH are you asking in the first place?
    – ron
    Feb 17, 2023 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .