Bug 873406 - Add ability to autoload grub2's config file when netbooting
Add ability to autoload grub2's config file when netbooting
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: grub2 (Show other bugs)
18
ppc64 All
unspecified Severity urgent
: ---
: ---
Assigned To: Peter Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-05 14:06 EST by IBM Bug Proxy
Modified: 2012-12-06 02:25 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-06 02:25:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
[PATCH 1/3] Add %X option to printf functions. (1.64 KB, patch)
2012-11-27 14:45 EST, Paulo Flabiano Smorigo
no flags Details | Diff
[PATCH 2/3] DHCP client ID and UUID options added. (3.47 KB, patch)
2012-11-27 14:46 EST, Paulo Flabiano Smorigo
no flags Details | Diff
[PATCH 3/3] Search for specific config file for netboot (6.22 KB, patch)
2012-11-27 14:46 EST, Paulo Flabiano Smorigo
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
IBM Linux Technology Center 86537 None None None 2012-11-05 14:06:44 EST

  None (edit)
Description IBM Bug Proxy 2012-11-05 14:06:43 EST
== Comment: #0 - Brent J. Baude <baude@us.ibm.com> - 2012-11-05 13:40:08 ==
+++ This bug was initially created as a clone of Bug #80686 +++

Similar to yaboot and pxelinux, grub2 network boot needs to auto load a config file. A few things that we need to fix:

1. net_bootp must default to the network we loaded grub2 off. RIght now it seems to default to the last network card. We need to use the info in boot-device to find the correct interface.

2. We need to load a machine specific config file over tftp. The algorithm used by both yaboot and pxelinux can be found at:

http://syslinux.zytor.com/pxe.php#config
Comment 1 IBM Bug Proxy 2012-11-05 15:00:35 EST
------- Comment From baude@us.ibm.com 2012-11-05 19:53 EDT-------
Original response from Paulo below:

I made a patch to do the pxe config. The procedure looks for the following files, just like pxe/yaboot do:

(tftp,192.168.1.1)//boot/grub/grub.cfg-01-e4-1f-13-f4-ad-c2
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0A80164
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0A8016
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0A801
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0A80
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0A8
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0A
(tftp,192.168.1.1)//boot/grub/grub.cfg-C0
(tftp,192.168.1.1)//boot/grub/grub.cfg-C
(tftp,192.168.1.1)//boot/grub/grub.cfg

After talking with GRUB2 maintainer about it, he suggested to put a script inside grub.cfg to do this job. I made one with the content:

{{{
configfile=$prefix/grub.cfg-$net_ofnet_network_mac
source "$configfile"

ip=$net_ofnet_network_ip

for c in 1 2 3 4; do
configfile=$prefix/grub.cfg-$ip
source "$configfile"
regexp --set=ip '^(.*)\..+$' "$ip"
done
}}}

It searches:
(tftp,9.8.234.191)//boot/grub/grub.cfg-e4:1f:13:f4:ad:c2
(tftp,9.8.234.191)//boot/grub/grub.cfg-9.8.234.243
(tftp,9.8.234.191)//boot/grub/grub.cfg-9.8.234
(tftp,9.8.234.191)//boot/grub/grub.cfg-9.8
(tftp,9.8.234.191)//boot/grub/grub.cfg-9

Do you think this approach is good?
What do you think about use IP as decimal?
Comment 2 Paulo Flabiano Smorigo 2012-11-27 14:45:02 EST
Created attachment 653057 [details]
[PATCH 1/3]  Add %X option to printf functions.
Comment 3 Paulo Flabiano Smorigo 2012-11-27 14:46:04 EST
Created attachment 653058 [details]
[PATCH 2/3] DHCP client ID and UUID options added.
Comment 4 Paulo Flabiano Smorigo 2012-11-27 14:46:44 EST
Created attachment 653059 [details]
[PATCH 3/3] Search for specific config file for netboot
Comment 5 Paulo Flabiano Smorigo 2012-11-27 14:49:07 EST
Those patches implement a search for a specific configuration when the config
file is on a remote server. It uses the following order:
   1) DHCP client UUID option.
   2) MAC address (in lower case hexadecimal with dash separators);
   3) IP (in upper case hexadecimal) or IPv6;
   4) The original grub.cfg file.

This procedure is similar to what is used by pxelinux and yaboot:
http://www.syslinux.org/wiki/index.php/PXELINUX#config
Comment 6 Fedora Update System 2012-11-27 15:36:06 EST
grub2-2.00-13.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/grub2-2.00-13.fc18
Comment 7 Fedora Update System 2012-11-27 21:12:14 EST
Package grub2-2.00-13.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing grub2-2.00-13.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-19181/grub2-2.00-13.fc18
then log in and leave karma (feedback).
Comment 8 Fedora Update System 2012-12-06 02:25:42 EST
grub2-2.00-13.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

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