Bug 1616395

Summary: grub2 doesn't handle relative paths correctly for UEFI HTTP Boot
Product: Red Hat Enterprise Linux 7 Reporter: Stephen Benjamin <stbenjam>
Component: grub2Assignee: Javier Martinez Canillas <fmartine>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.9CC: dconsoli, fmartine, lzap, ovasik, pjanda, rstrode, swadeley, tborcin, tbowling
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: grub2-2.02-0.82.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-29 19:34:15 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: 2020-07-07
Embargoed:
Bug Depends On:    
Bug Blocks: 1619274, 1619291    

Description Stephen Benjamin 2018-08-15 19:20:11 UTC
Description of problem:

grub2 UEFI HTTP boot fails to resolve relative paths correctly.  


Version-Release number of selected component (if applicable):
2.02-0.75

How reproducible:
Always

Steps to Reproduce:
1. Boot grub via UEFI HTTP
2. Configure grub.cfg to use a relative path, for example, given a menu entry like this:

menuentry 'Foreman Discovery Image' --id discovery {
  linuxefi boot/fdi-image/vmlinuz0 rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=http://centos7-devel.astriaporta.example.com proxy.type=foreman BOOTIF=01-$mac
  initrdefi boot/fdi-image/initrd0.img
}

where boot/fdi-image/vmlinuz0 is relative to the location of the grubx64.efi image.


3. Try to boot

Actual results:
Grub immediately fails with:
 Fail to send a request! status=0xe

Expected results:
Host boots

Additional info:
- Using /pub/boot/fdi-image/vmlinuz0 works
- If looking at a tcpdump, grub is trying to do a DNS query for "192.168.73.1boot"

Comment 2 Peter Jones 2019-04-05 12:59:10 UTC
This was fixed in 7.6 as part of a different bz.  Here's the relevant commit message:

From: Stephen Benjamin <stephen>
Date: Thu, 16 Aug 2018 16:58:51 -0400
Subject: [PATCH] Prepend prefix when HTTP path is relative

This sets a couple of variables.  With the url http://www.example.com/foo/bar :
http_path: /foo/bar
http_url: http://www.example.com/foo/bar

Related: rhbz#1490981

Comment 3 Stephen Benjamin 2019-04-12 13:06:56 UTC
This patch doesn't appear to be in any 7.6 builds, or even any builds I can find in Brew.


$ rpm -q --changelog grub2-efi-x64 | grep Prepend

$ rpm -q grub2-efi-x64
grub2-efi-x64-2.02-0.76.el7.1.x86_64

$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)

Comment 4 Stephen Benjamin 2019-04-12 14:50:47 UTC
There's also a really dumb mistake of mine in that patch, there's a PR to fix it: https://github.com/rhboot/grub2/pull/53

Comment 12 Javier Martinez Canillas 2020-03-07 10:52:28 UTC
*** Bug 1763216 has been marked as a duplicate of this bug. ***

Comment 15 Petr Janda 2020-03-26 15:33:19 UTC
Was able to reproduce it on RHEL-7.8-20200225.1  x86_64 Server

Comment 21 Javier Martinez Canillas 2020-05-27 16:12:51 UTC
*** Bug 1642438 has been marked as a duplicate of this bug. ***

Comment 22 Petr Janda 2020-07-03 08:03:04 UTC
Verified on RHEL-7.9-20200623.0 x86_64 Server 
grub2-2.02-0.82

Comment 26 errata-xmlrpc 2020-07-29 19:34:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3217