LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-26-2012, 01:13 PM   #1
hokie92grad
LQ Newbie
 
Registered: May 2009
Location: Virginia
Posts: 11

Rep: Reputation: 0
Passing root path from dhcp to grub2 in a pxe boot


I am trying to setup a RHEL6 x86_64 server to host iscsi root drives for an array of RHEL6 x86_64 diskless clients. I would like to set this up in a way that does not require user intervention to get the clients to boot and each client needs to have its own root device.

The setup:
Each client is using pxe to start the process, which obtains the boot loader image name from dhcp. (grub.pxe from grub version 1.99)
grub is then loading its configuration file and a default item is selected in the menu list to boot a vmlinuz and initramfs that knows how to switch to an iscsi root drive. Currently the grub.cfg file specifies the iscsi root device to load, but this will not work when I have multiple clients trying to use the same grub.cfg file.

I have a few of options 1) setup dhcp to pass the root device information to grub, 2) setup dhcp to pass the config file for grub to load, 3) change the initramfs scripts to load an appropriate iscsi root device based on ip address or some other metric.

Right now I am trying option 1. According to the manual, there are some environment variables available : net_pxe_rootpath and net_pxe_extensionpath, which I believe correspond to the dhcp option root-path and extensions-path. I don't know how to use these environment variables. I tried in what I thought was an obvious way, but it did not work.

Here is the setup:
dhcpd.conf:
host client1
{
next-server 192.168.1.2;
option host-name client1;
hardware ethernet 00:a0:ae:02:b8:8b;
fixed-address 192.168.1.128;
filename "grub.pxe";
option root-path "/dev/mapper/vg_client1-lv_root";
option extensions-path "iscsi:@192.168.1.2::3260::iqn.2011-11.net.foonet:server1.target2.sys2";
}

grub.cfg:
menuentry 'GNU/Linux, 2.6.32-131.0.15.el6.x86_64 pxe client1 env' --class gnu-linux --class gnu --class os {
echo 'Loading Linux 2.6.32-131.0.15.el6.x86_64 ...'
echo "net_pxe_rootpath=${net_pxe_rootpath}"
echo "net_pxe_extensionspath=${net_pxe_extensionspath}"
linux (pxe)/vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=${net_pxe_rootpath} netroot=${net_pxe_extensionspath} iscsi_initiator=iqn.2011-11.net.foonet:server1.target2.sys2 ip=eth0:dhcp rd_LVM_LV=vg_cleint1/lv_root rd_LVM_LV=vg_client1/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto
echo 'Loading initial ramdisk ...'
initrd (pxe)/initramfs-2.6.32-131.0.15.el6.x86_64.img
}

menuentry 'GNU/Linux, 2.6.32-131.0.15.el6.x86_64 pxe cleint1 root' --class gnu-linux --class gnu --class os {
echo 'Loading Linux 2.6.32-131.0.15.el6.x86_64 ...'
linux (pxe)/vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/vg_client1-lv_root netroot=iscsi:@192.168.1.2::3260::iqn.2011-11.net.foonet:server1.target2.sys2 iscsi_initiator=iqn.2011-11.net.foonet:server1.target2.sys2 ip=eth0:dhcp rd_LVM_LV=vg_client1/lv_root rd_LVM_LV=vg_client1/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto
echo 'Loading initial ramdisk ...'
initrd (pxe)/initramfs-2.6.32-131.0.15.el6.x86_64.img



if I boot from the second menuentry above, the client boots normally. If I boot from the first menu entry above, the kernel panics because it can't find a root to mount. the echo of the net_pxe_rootpath and net_pxe_extensionspath don't show what I was expecting from the dhcp file.
the net_pxe_rootpath is showing a path "/pxe/root/client2" which I think I used at one point in time, but I can't find that string anywhere in any of the config files. (dchp or grub)
the net_pxe_extensionspath is empty.

Is there anyway to pass this type of information over dhcp to grub?

I found some other stuff regarding option 150, but I don't think that was passed either. Not sure if grub2 supports option 150 anymore. (I think it is a grub legacy option only).
 
Old 01-26-2012, 05:06 PM   #2
hokie92grad
LQ Newbie
 
Registered: May 2009
Location: Virginia
Posts: 11

Original Poster
Rep: Reputation: 0
Well how embarrasing, I simply forgot to reload the dhcpd configuration everything worked as it was entered.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PXE boot DHCP too slow. xtothat Linux - Networking 2 12-19-2010 12:16 AM
DHCP not handing IP to KVM in PXE boot drschloss Linux - Networking 2 09-03-2010 05:31 PM
pxe boot problem no root-path gfem Linux - Networking 6 03-22-2008 12:43 PM
nfs root path variable (pxe/nfs boot) freeindy Linux - Networking 3 03-11-2008 09:19 AM
DHCP server / PXE boot freeindy Linux - Networking 2 03-04-2008 02:31 AM


All times are GMT -5. The time now is 09:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration