public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* BUG: tianocore does not honor the bootorder
@ 2023-02-15 20:20 gregory.lee.bartholomew
  2023-02-17 13:08 ` [edk2-devel] " Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: gregory.lee.bartholomew @ 2023-02-15 20:20 UTC (permalink / raw)
  To: devel

I have a script that uses Qemu to install a Linux OS to the supplied device. At
the end of the install script, efibootmgr is called to create UEFI boot entries
and set the boot order. However, every time I boot the VM, it boots to entry
0004 "UEFI Misc Device" instead of the proper entry specified in the bootorder.
This is confusing a script that I have for managing multiple ESPs (the script
needs to detect the current ESP and sync its contents to secondary/backup ESPs).

Below is the output from efibootmgr on one of my scripted installations.

# efibootmgr
BootCurrent: 0004
Timeout: 0 seconds
BootOrder: 0002,0001,0000,0003,0004,0005,0006,0007,0008,0009,000A
Boot0000* UiApp	FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-
7614-4503-836e-8ab6f4662331)
Boot0001* boot@b	HD(1,GPT,b0077ac5-be27-4b22-bdf1-
e7256e4731de,0x800,0x200000)/File(\efi\systemd\systemd-bootx64.efi)
Boot0002* boot@a	HD(1,GPT,70d1956e-7522-47d4-8319-
49a96674ecf1,0x800,0x200000)/File(\efi\systemd\systemd-bootx64.efi)
Boot0003* UEFI QEMU DVD-ROM QM00003
	PciRoot(0x0)/Pci(0x1,0x1)/Ata(1,0,0){auto_created_boot_option}
Boot0004* UEFI Misc
Device	PciRoot(0x0)/Pci(0x5,0x0){auto_created_boot_option}
Boot0005* UEFI Misc Device
2	PciRoot(0x0)/Pci(0x6,0x0){auto_created_boot_option}
Boot0006* UEFI PXEv4
(MAC:8232FE36D480)	PciRoot(0x0)/Pci(0x3,0x0)/MAC(8232fe36d480,1)/IPv4(0.0.0.00.0.0.0,0,0){auto_created_boot_option}
Boot0007* UEFI PXEv6
(MAC:8232FE36D480)	PciRoot(0x0)/Pci(0x3,0x0)/MAC(8232fe36d480,1)/IPv6([::]:<->[::]:,0,0){auto_created_boot_option}
Boot0008* UEFI HTTPv4
(MAC:8232FE36D480)	PciRoot(0x0)/Pci(0x3,0x0)/MAC(8232fe36d480,1)/IPv4(0.0.0.00.0.0.0,0,0)/Uri(){auto_created_boot_option}
Boot0009* UEFI HTTPv6
(MAC:8232FE36D480)	PciRoot(0x0)/Pci(0x3,0x0)/MAC(8232fe36d480,1)/IPv6([::]:<->[::]:,0,0)/Uri(){auto_created_boot_option}
Boot000A* EFI Internal Shell	FvVol(7cb8bdc9-f8eb-4f34-aaea-
3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)

Please fix tianocore to honor the bootorder instead of creating its own entries.

Thanks.

-- 
Gregory Lee Bartholomew
PGP Key ID: 3B67510E

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] BUG: tianocore does not honor the bootorder
  2023-02-15 20:20 BUG: tianocore does not honor the bootorder gregory.lee.bartholomew
@ 2023-02-17 13:08 ` Gerd Hoffmann
  2023-02-17 16:23   ` Gregory Lee Bartholomew
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2023-02-17 13:08 UTC (permalink / raw)
  To: devel, gregory.lee.bartholomew

On Wed, Feb 15, 2023 at 02:20:23PM -0600, Gregory Lee Bartholomew wrote:
> I have a script that uses Qemu to install a Linux OS to the supplied device. At
> the end of the install script, efibootmgr is called to create UEFI boot entries
> and set the boot order. However, every time I boot the VM, it boots to entry
> 0004 "UEFI Misc Device" instead of the proper entry specified in the bootorder.
> This is confusing a script that I have for managing multiple ESPs (the script
> needs to detect the current ESP and sync its contents to secondary/backup ESPs).
 
> Please fix tianocore to honor the bootorder instead of creating its own entries.

ovmf orders the boot entries according to the qemu configuration
(bootindex property for devices).  If you don't want that just remove
all bootindex properties from your qemu command line.

take care,
  Gerd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] BUG: tianocore does not honor the bootorder
  2023-02-17 13:08 ` [edk2-devel] " Gerd Hoffmann
@ 2023-02-17 16:23   ` Gregory Lee Bartholomew
  2023-02-20  7:10     ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: Gregory Lee Bartholomew @ 2023-02-17 16:23 UTC (permalink / raw)
  To: Gerd Hoffmann, devel

On Fri, 2023-02-17 at 14:08 +0100, Gerd Hoffmann wrote:
> On Wed, Feb 15, 2023 at 02:20:23PM -0600, Gregory Lee Bartholomew wrote:
> > I have a script that uses Qemu to install a Linux OS to the supplied device. At
> > the end of the install script, efibootmgr is called to create UEFI boot entries
> > and set the boot order. However, every time I boot the VM, it boots to entry
> > 0004 "UEFI Misc Device" instead of the proper entry specified in the bootorder.
> > This is confusing a script that I have for managing multiple ESPs (the script
> > needs to detect the current ESP and sync its contents to secondary/backup ESPs).
>  
> > Please fix tianocore to honor the bootorder instead of creating its own entries.
> 
> ovmf orders the boot entries according to the qemu configuration
> (bootindex property for devices).  If you don't want that just remove
> all bootindex properties from your qemu command line.
> 
> take care,
>   Gerd
> 

I don't believe I've set a bootindex. Below is the script that I'm using to
start the qemu instances.

#!/usr/bin/bash
# vim:set ts=3:

if [[ -z $1 ]]; then
	echo "usage: ${0##*/} <nework interface>" 1>&2
	exit 1
fi

if ! [[ -e /sys/class/net/$1 ]]; then
	echo "error: network interface '$1' not found" 1>&2
	exit 1
fi

TAP=$(ls /sys/class/net/$1/macvtap 2>/dev/null | grep -m 1 '^tap[0-9]\+$')

if [[ -z $TAP ]]; then
	echo "error: network interface '$1' does not appear to be" \
		"a macvtap device" 1>&2
	exit 1
fi

MAC=$(</sys/class/net/$1/address)

set -e

exec {fd}<>"/dev/$TAP"

DIR="${0%/*}"

source "$DIR/environment"

ARCH=$(uname -m)
exec qemu-system-$ARCH \
	-name "foz" \
	-machine "accel=kvm,vmport=off" \
	-m "${QEMU_MEMORY}" \
	-cpu "host" -smp "${QEMU_PROCESSORS}" \
	-netdev "tap,id=$1,fd=$fd" \
	-device "virtio-net-pci,netdev=$1,mac=$MAC" \
	-chardev "spicevmc,id=c1,name=vdagent" -device "virtio-serial-pci" \
	-device "virtserialport,chardev=c1,id=c1,name=com.redhat.spice.0" \
	-drive
"if=pflash,format=raw,unit=0,file=$DIR/efi/OVMF_CODE.fd,readonly=on" \
	-drive "if=pflash,format=raw,unit=1,file=$DIR/efi/OVMF_VARS.fd" \
	-drive "if=virtio,format=raw,file=${QEMU_DRIVE1}" \
	-drive "if=virtio,format=raw,file=${QEMU_DRIVE2}" \
	-vga "qxl" \
	-spice "$(printf -- '%s' \
		"x509-dir=$DIR/crt," \
		"password=${SPICE_PASSWORD}," \
		"addr=${SPICE_ADDRESS}," \
		"tls-port=${SPICE_PORT}" \
	)" \
	-monitor "unix:/run/foz.socket,server,nowait"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] BUG: tianocore does not honor the bootorder
  2023-02-17 16:23   ` Gregory Lee Bartholomew
@ 2023-02-20  7:10     ` Gerd Hoffmann
  2023-02-20 16:44       ` Gregory Lee Bartholomew
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2023-02-20  7:10 UTC (permalink / raw)
  To: Gregory Lee Bartholomew; +Cc: devel

On Fri, Feb 17, 2023 at 10:23:22AM -0600, Gregory Lee Bartholomew wrote:
> On Fri, 2023-02-17 at 14:08 +0100, Gerd Hoffmann wrote:
> > On Wed, Feb 15, 2023 at 02:20:23PM -0600, Gregory Lee Bartholomew wrote:
> > > I have a script that uses Qemu to install a Linux OS to the supplied device. At
> > > the end of the install script, efibootmgr is called to create UEFI boot entries
> > > and set the boot order. However, every time I boot the VM, it boots to entry
> > > 0004 "UEFI Misc Device" instead of the proper entry specified in the bootorder.
> > > This is confusing a script that I have for managing multiple ESPs (the script
> > > needs to detect the current ESP and sync its contents to secondary/backup ESPs).
> >  
> > > Please fix tianocore to honor the bootorder instead of creating its own entries.
> > 
> > ovmf orders the boot entries according to the qemu configuration
> > (bootindex property for devices).  If you don't want that just remove
> > all bootindex properties from your qemu command line.
> > 
> > take care,
> >   Gerd
> > 
> 
> I don't believe I've set a bootindex. Below is the script that I'm using to
> start the qemu instances.

OVMF shouldn't touch the order then.  It will still create entries for
the devices it finds (on first boot).  If you add more entries and put
them first (by setting BootOrder accordingly) OVMF should try booting
these first.

take care,
  Gerd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] BUG: tianocore does not honor the bootorder
  2023-02-20  7:10     ` Gerd Hoffmann
@ 2023-02-20 16:44       ` Gregory Lee Bartholomew
  0 siblings, 0 replies; 5+ messages in thread
From: Gregory Lee Bartholomew @ 2023-02-20 16:44 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: devel

On Mon, 2023-02-20 at 08:10 +0100, Gerd Hoffmann wrote:
> On Fri, Feb 17, 2023 at 10:23:22AM -0600, Gregory Lee Bartholomew wrote:
> > On Fri, 2023-02-17 at 14:08 +0100, Gerd Hoffmann wrote:
> > > On Wed, Feb 15, 2023 at 02:20:23PM -0600, Gregory Lee Bartholomew wrote:
> > > > I have a script that uses Qemu to install a Linux OS to the supplied device. At
> > > > the end of the install script, efibootmgr is called to create UEFI boot entries
> > > > and set the boot order. However, every time I boot the VM, it boots to entry
> > > > 0004 "UEFI Misc Device" instead of the proper entry specified in the bootorder.
> > > > This is confusing a script that I have for managing multiple ESPs (the script
> > > > needs to detect the current ESP and sync its contents to secondary/backup ESPs).
> > >  
> > > > Please fix tianocore to honor the bootorder instead of creating its own entries.
> > > 
> > > ovmf orders the boot entries according to the qemu configuration
> > > (bootindex property for devices).  If you don't want that just remove
> > > all bootindex properties from your qemu command line.
> > > 
> > > take care,
> > >   Gerd
> > > 
> > 
> > I don't believe I've set a bootindex. Below is the script that I'm using to
> > start the qemu instances.
> 
> OVMF shouldn't touch the order then.  It will still create entries for
> the devices it finds (on first boot).  If you add more entries and put
> them first (by setting BootOrder accordingly) OVMF should try booting
> these first.
> 
> take care,
>   Gerd
> 

It was my mistake. My qemu instance was referencing the wrong OVMF_VARS.fd.
Tiano was automatically booting the system from that "Misc Device" entry because
the installer-created entries were from an old run and were pointing to invalid
partition UUIDs. I personally think it would be less confusing if that sort of
automation were not done and instead a proper error were reported to the admin.
But I guess I understand why that is being done.

Sorry for the bogus bug report.

gb

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-20 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-15 20:20 BUG: tianocore does not honor the bootorder gregory.lee.bartholomew
2023-02-17 13:08 ` [edk2-devel] " Gerd Hoffmann
2023-02-17 16:23   ` Gregory Lee Bartholomew
2023-02-20  7:10     ` Gerd Hoffmann
2023-02-20 16:44       ` Gregory Lee Bartholomew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox