Bug 888959

Summary: [BUG] rhts-post snippet doesn't handle duplicate efi entries
Product: [Retired] Beaker Reporter: Bill Peck <bpeck>
Component: schedulerAssignee: Amit Saha <asaha>
Status: CLOSED CURRENTRELEASE QA Contact: Qixiang Wan <qwan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.10CC: asaha, dcallagh, ebaak, jburke, llim, qwan, rglasz, rmancy
Target Milestone: 0.12   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Misc
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-11 04:56:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bill Peck 2012-12-19 21:53:29 UTC
Description of problem:
Efi boot entries can be duplicated like this:

[root@ibm-hs22-04 ~]# /usr/sbin/efibootmgr -v
BootCurrent: 000E
Timeout: 10 seconds
BootOrder: 000E,000F,00D2,00C8,00C9,00C6,00C7,00CA,00CB,00CC,00CD,00CE,00CF,00D0,00D1,00D3
Boot0000* CD/DVD Rom    Vendor(0c588db8-6af4-11dd-a992-00197d890238,0c)
Boot0001* Floppy Disk   Vendor(0c588db8-6af4-11dd-a992-00197d890238,00)
Boot0002* Hard Disk 0   Vendor(0c588db8-6af4-11dd-a992-00197d890238,08)
Boot0003* PXE Network   Vendor(0c588db8-6af4-11dd-a992-00197d890238,06)
Boot0004* Hard Disk 1   Vendor(0c588db8-6af4-11dd-a992-00197d890238,09)
Boot0005* Hard Disk 2   Vendor(0c588db8-6af4-11dd-a992-00197d890238,0a)
Boot0006* Hard Disk 3   Vendor(0c588db8-6af4-11dd-a992-00197d890238,0b)
Boot0007* Hard Disk 4   Vendor(0c588db8-6af4-11dd-a992-00197d890238,0e)
Boot0008* USB Storage   Vendor(0c588db8-6af4-11dd-a992-00197d890238,03)
Boot0009* Diagnostics   Vendor(0c588db8-6af4-11dd-a992-00197d890238,da)
Boot000A* iSCSI Vendor(0c588db8-6af4-11dd-a992-00197d890238,04)
Boot000B* iSCSI Critical        Vendor(0c588db8-6af4-11dd-a992-00197d890238,05)
Boot000C* Legacy Only   Vendor(0c588db8-6af4-11dd-a992-00197d890238,ee)
Boot000D* Embedded Hypervisor   Vendor(0c588db8-6af4-11dd-a992-00197d890238,01)
Boot000E* Red Hat Enterprise Linux      HD(1,800,64000,cde409ee-c35d-4367-881a-5dc9b04d7452)File(\EFI\redhat\grub.efi)
Boot000F* network       ACPI(a0341d0,0)PCI(7,0)PCI(0,0)MAC(00215e99f14c,0)IPv4(0.0.0.0:0<->0.0.0.0:0,0, 0
Boot0010* CD/DVD Rom    Vendor(0c588db8-6af4-11dd-a992-00197d890238,0c)
Boot0011* Floppy Disk   Vendor(0c588db8-6af4-11dd-a992-00197d890238,00)
Boot0012* Hard Disk 0   Vendor(0c588db8-6af4-11dd-a992-00197d890238,08)
Boot0013* PXE Network   Vendor(0c588db8-6af4-11dd-a992-00197d890238,06)
Boot0014* Hard Disk 1   Vendor(0c588db8-6af4-11dd-a992-00197d890238,09)
Boot0015* Hard Disk 2   Vendor(0c588db8-6af4-11dd-a992-00197d890238,0a)
Boot0016* Hard Disk 3   Vendor(0c588db8-6af4-11dd-a992-00197d890238,0b)
Boot0017* Hard Disk 4   Vendor(0c588db8-6af4-11dd-a992-00197d890238,0e)
Boot0018* USB Storage   Vendor(0c588db8-6af4-11dd-a992-00197d890238,03)
Boot0019* Diagnostics   Vendor(0c588db8-6af4-11dd-a992-00197d890238,da)
Boot001A* iSCSI Vendor(0c588db8-6af4-11dd-a992-00197d890238,04)
Boot001B* iSCSI Critical        Vendor(0c588db8-6af4-11dd-a992-00197d890238,05)

This is probably a bug in something else, but we should be more robust in handling this problem:

+ '[' -x /usr/sbin/efibootmgr ']' 
++ /usr/sbin/efibootmgr -v 
++ grep BootOrder 
++ awk '{print $2}' 
++ awk -F, '{print $1}' 
+ BOOT=000E 
++ /usr/sbin/efibootmgr -v 
++ grep Boot000E 
++ awk '{print $NF}' 
+ EFI='HD(1,800,64000,cde409ee-c35d-4367-881a-5dc9b04d7452)File(\EFI\redhat\grub.efi)' 
++ /usr/sbin/efibootmgr -v 
++ grep -Ei '(netboot|pxe)' 
++ cut -c5-8 
+ PXE_SLOT='0003 
0013 
0021 
002F 
003D 
004B 
0059 
0067 
0075 
0083 
0091 
009F 
00AD 
00BB 
00C9' 
+ '[' '!' -z 0003 0013 0021 002F 003D 004B 0059 0067 0075 0083 0091 009F 00AD 00BB 00C9 ']' 
/tmp/ks-script-DHamE9: line 60: [: too many arguments 


The offending line is:

PXE_SLOT=$(/usr/sbin/efibootmgr -v | grep -Ei '(netboot|pxe)' |cut -c5-8)

Which can be fixed by this:

PXE_SLOT=$(/usr/sbin/efibootmgr -v | grep -Ei '(netboot|pxe)' |head -n 1 |cut -c5-8)

Comment 1 Amit Saha 2013-02-19 04:30:58 UTC
Thanks Bill. I have made the change and updated the test cases: http://gerrit.beaker-project.org/#/c/1737/

Comment 3 Qixiang Wan 2013-03-29 07:02:57 UTC
Although we can't sure about which the efi entry is valid and it's what we want to use, the fix is safe and resolves the failure of seeing multiple netboot/pxe entries. So close this as Verified.

Comment 4 Dan Callaghan 2013-04-11 04:56:41 UTC
Beaker 0.12 has been released.