Bug 1616395 - grub2 doesn't handle relative paths correctly for UEFI HTTP Boot [NEEDINFO]
Summary: grub2 doesn't handle relative paths correctly for UEFI HTTP Boot
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grub2
Version: 7.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact: Release Test Team
Depends On:
Blocks: 1619274 1619291
TreeView+ depends on / blocked
Reported: 2018-08-15 19:20 UTC by Stephen Benjamin
Modified: 2020-01-02 12:20 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-04-05 12:59:10 UTC
Target Upstream Version:
stbenjam: needinfo? (pjones)
lzap: needinfo? (pjones)

Attachments (Terms of Use)

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):

How reproducible:

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 ""

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@redhat.com>
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

$ 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

Note You need to log in before you can comment on or make changes to this bug.