Bug 1211101 - grub2 fw_path variable is incorrect for x86 EFI network boot: too many path components stripped
Summary: grub2 fw_path variable is incorrect for x86 EFI network boot: too many path c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grub2
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-13 02:28 UTC by Dan Callaghan
Modified: 2015-11-19 12:23 UTC (History)
3 users (show)

Fixed In Version: grub2-2.02-0.17.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 12:23:55 UTC


Attachments (Terms of Use)
grub2 patch (1.03 KB, patch)
2015-04-13 03:35 UTC, Dan Callaghan
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2401 normal SHIPPED_LIVE Low: grub2 security, bug fix, and enhancement update 2015-11-19 11:00:33 UTC

Description Dan Callaghan 2015-04-13 02:28:00 UTC
Description of problem:
As of grub2-2.02-0.16, GRUB tries both $fw_path/grub.cfg-* and $prefix/grub.cfg-* when looking for its config file on a network book (bug 1148652). However on x86 EFI, $fw_path is incorrect and thus GRUB searches the wrong path.

Version-Release number of selected component (if applicable):
grub2-2.02-0.16.el7.x86_64
grub2-efi-modules-2.02-0.16.el7.x86_64

Steps to Reproduce:
1. Set up a TFTP server with the GRUB2 config and image (symlink) in a subdirectory two levels deep:
yum install tftp-server grub2-efi-modules
grub2-mknetdir -d /usr/lib/grub/x86_64-efi --net-directory /var/lib/tftpboot
mkdir -p /var/lib/tftpboot/bootloader/test5
ln -s ../../boot/grub2/x86_64-efi/core.efi /var/lib/tftpboot/bootloader/test5/image
cat >/var/lib/tftpboot/bootloader/test5/grub.cfg <<"EOF"
# put something here, doesn't really matter
EOF
systemctl start tftp.socket
2. Find an x86 EFI system, configure its DHCP with next-server=<yourtftpserver> filename=bootloader/test5/image, boot it up

Actual results:
GRUB looks for its config under /bootloader/grub.cfg-* then /boot/grub2/grub.cfg-*

Expected results:
GRUB should look for its config under /bootloader/test5/grub.cfg-* then /boot/grub2/grub.cfg-*

Additional info:
You can see GRUB's attempts to load its config if you add -vv to the TFTP server:

Apr 13 11:30:24 lab in.tftpd[17886]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-01-f0-92-1c-de-38-de
Apr 13 11:30:24 lab in.tftpd[17886]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17887]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A40195E
Apr 13 11:30:24 lab in.tftpd[17887]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17888]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A40195
Apr 13 11:30:24 lab in.tftpd[17888]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17889]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A4019
Apr 13 11:30:24 lab in.tftpd[17889]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17890]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A401
Apr 13 11:30:24 lab in.tftpd[17890]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17891]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A40
Apr 13 11:30:24 lab in.tftpd[17891]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17892]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A4
Apr 13 11:30:24 lab in.tftpd[17892]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17893]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0A
Apr 13 11:30:24 lab in.tftpd[17893]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17894]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg-0
Apr 13 11:30:24 lab in.tftpd[17894]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17895]: RRQ from 10.64.25.94 filename /bootloader/grub.cfg
Apr 13 11:30:24 lab in.tftpd[17895]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17896]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-01-f0-92-1c-de-38-de
Apr 13 11:30:24 lab in.tftpd[17896]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17897]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A40195E
Apr 13 11:30:24 lab in.tftpd[17897]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17898]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A40195
Apr 13 11:30:24 lab in.tftpd[17898]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17899]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A4019
Apr 13 11:30:24 lab in.tftpd[17899]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17900]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A401
Apr 13 11:30:24 lab in.tftpd[17900]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17901]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A40
Apr 13 11:30:24 lab in.tftpd[17901]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17902]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A4
Apr 13 11:30:24 lab in.tftpd[17902]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17903]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0A
Apr 13 11:30:24 lab in.tftpd[17903]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17904]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg-0
Apr 13 11:30:24 lab in.tftpd[17904]: sending NAK (1, File not found) to 10.64.25.94
Apr 13 11:30:24 lab in.tftpd[17905]: RRQ from 10.64.25.94 filename /boot/grub2/grub.cfg
Apr 13 11:30:24 lab in.tftpd[17905]: sending NAK (1, File not found) to 10.64.25.94

Comment 2 Dan Callaghan 2015-04-13 02:48:06 UTC
I had a poke around in GRUB's source. This is using the prepped sources from grub2-2.02-0.16.el7.

The fw_path variable is populated using the path returned from grub_machine_get_bootlocation. The EFI version of grub_machine_get_bootlocation grabs the path from either grub_efi_get_filename (if booted from disk) or grub_efi_net_config (if booted from the network) and then strips the last component from the path.

However grub_efi_net_config populates the path using grub_net_configure_by_dhcp_ack which *also* strips the last component from the path.

Comment 3 Dan Callaghan 2015-04-13 03:35:42 UTC
Created attachment 1013793 [details]
grub2 patch

The attached patch appears to fix the problem.

Comment 8 errata-xmlrpc 2015-11-19 12:23:55 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://rhn.redhat.com/errata/RHSA-2015-2401.html


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