Load an autorun depending on label in pxelinux.cfg/default?

Questions related to network booting via PXE
scm
Posts: 3
Joined: 23 Sep 2010, 17:53

Load an autorun depending on label in pxelinux.cfg/default?

Postby scm » 23 Sep 2010, 19:06

Hi there. (First of all: sysresccd rocks, I had a working PXE environment up in *no* time! :)

Question: I would like to load an autorun depending on the label I choose in pxelinux.cfg/default. So I guess I need to put something like

Code: Select all

ar_source=http://10.1.0.1/my_script_01.sh

in the following section in pxelinux.cfg/default

Code: Select all

label resc
        kernel rescuecd
        append initrd=initram.igz dodhcp netboot=http://10.1.0.1/sysrcd.dat

Any hints how I could do this? (What I want to do: Have the system do different things after boot up depending on the label I use during PXE-boot.)

I naively tried:

Code: Select all

        kernel rescuecd ar_source=http://10.1.0.1/my_script_01.sh
        append initrd=initram.igz dodhcp netboot=http://10.1.0.1/sysrcd.dat

which did not work (should work like this when booting from CD, right??).

thanks a lot for any help
sacha

gernot
Posts: 1127
Joined: 07 Apr 2010, 16:19

Re: Load an autorun depending on label in pxelinux.cfg/defau

Postby gernot » 24 Sep 2010, 10:15

The ar_source must be in the kernel commandline like all other arguments.
The name autorun is fix, but you can modify the directory path

To provide script1/autorun via thttpd you can modify /etc/conf.d/thttpd
Use there THTTPD_DOCROOT="/tftpboot" which is the writable aufs side of /livemnt/boot/
Name your script /tftpboot/script1/autorun

Code: Select all

        kernel rescuecd
        append initrd=initram.igz dodhcp netboot=http://10.1.0.1/sysrcd.dat ar_source=http://10.1.0.1/script1


if your target-PC has 2 networkcards dodhcp can take a long time. You can then try booting without it.

gernot

scm
Posts: 3
Joined: 23 Sep 2010, 17:53

Re: Load an autorun depending on label in pxelinux.cfg/defau

Postby scm » 24 Sep 2010, 12:16

Works like a charm, thank you very much!

sacha

scm
Posts: 3
Joined: 23 Sep 2010, 17:53

Re: Load an autorun depending on label in pxelinux.cfg/defau

Postby scm » 24 Sep 2010, 15:21

What you said about DHCP made me think.

My machines have 2 NICs and while booting in more then 50% of the cases DHCPdiscover does not get an IP (fixed to the MAC of eth0). I can't see why.
When I reboot, it usually works.

Is that maybe related to your advice "if the target-PC has 2 networkcards dodhcp can take a long time. You can then try booting without it." ?

How would I boot without the second NIC? ;/

thanks a lot
sacha

gernot
Posts: 1127
Joined: 07 Apr 2010, 16:19

Re: Load an autorun depending on label in pxelinux.cfg/defau

Postby gernot » 24 Sep 2010, 16:50

i meant without the option dodhcp.
if booting fails check for a wrong IP from e.g. a router.

At the moment i have no idea how to disable one nic.
The only is to blacklist a kernelmodule with noload= if there are two different nics used.

gernot


Return to “Network Boot via PXE”

Who is online

Users browsing this forum: No registered users and 4 guests