# diskless client won't fire off udhcp

## joeldavis

Basically, here is the set up: I have the install-x86-minimal-20111011 ISO file, I copied the kernel, initrd and squash fs to a cobbler server, I created a distro for it and tried to boot off the image with the squashfs being mounted as a rw NFS export. The boot is fine going through the initramfs portion, but when it comes time to switch root, it's not firing off udhcp. If I supply "debug" on the command line so that it stops with a debug shell just prior to the switch root and run udhcpc manually, it gets a valid IP address and exiting the shell resumes the normal "LiveCD" boot. I've supplied the following as my kernel parameters:

```
initrd=/images/diagnosticPlatform/initrd ksdevice=bootif lang=  IP=dhcp debug text root=/dev/nfs kssendmac nfsroot=192.168.0.100:/srv/diagnosticsPlatform/squashfs  ks=http://192.168.0.100/cblr/svc/op/ks/profile/Boot_to_Linux_command_line
```

I've tried multiple values on the IP designation (mixing case, going all upper case, all lower case, etc) I even tried using the archlinux suggestion of "ip=::::::dhcp" but none gets around the fact that I have to manually run udhcpc in order to get a dynamic lease. I've perused the console logs (with debugging on) and the only thing networking related I can find are protocols being registered. What kills me is I even had this functioning on virts and it's only when I tried to move it to a bare metal box that I started having this trouble. I didn't save my cobbler config from the virts (it was so easy the first time, and II thought this was just going to be a "copy this over here now" operation). I also didn't save the console logs from the debug boot but I can regenerate either one for you if you feel like you'll need the information.

Also, this is the document I'm loosely basing my work off of:

http://www.gentoo.org/doc/en/diskless-howto.xml

**EDIT::**

Basically, the long and short of it is that I'm PXE booting off the kernel and initramfs from the CD with the idea that the squashfs will be mounted as an NFS root. I can PXE just fine and it starts loading without any real issue, but for some reason it's not requesting an IP address on its own. If I use the "debug" kernel parameter to drop me into a debug shell prior to the pivot and force it to get an IP address, the rest of the boot is fine.

- Joel

----------

## joeldavis

Some further developments for anyone interested I started tinkering with the initramfs (echo'ing values out at various places, echo'ing simple pings out, etc) and eventually settled onto this as the problematic line of code:

from gentoo.igz/etc/initrd.scripts:

```

findnfsmount() {

        echo "inside findnfsmount"

        echo -n "IP: "

        echo ${IP}

        if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q

        then

                [ -e /rootpath ] && NFSROOT=`cat /rootpath`

                if [ "${NFSROOT}" = '' ]

                then

                        # Obtain NFSIP

                        OPTIONS=`busybox dmesg | grep rootserver | sed -e "s/,/ /g"`

                        for OPTION in $OPTIONS

```

I don't understand the logic behind the first conditional, it seems to me to be saying "if they didn't specify 'ip' on the command line then run "busybox udhcpc -n -T 15 -q" which seems to be the opposite of what I would want in the case of an NFS root filesystem, so i think I may need someone to explain that to me. Since reversing it didn't resolve the issue clearly I'm not understanding what's going on but I can't figure it out.

At any rate adding a simple "busybox udhcpc" to the line above the first conditional gets me around the problem to the point where I can start developing again (albeit with an error about the default route):

```
>> Hint: Use parameter scandelay[=seconds] if you need waiting here 

>> Activating mdev 

>> Determining root device... 

>> Mounting root... 

inside findnfsmount

IP: dhcp

udhcpc (v1.18.1) started

Sending discover...

Sending select for 192.168.122.2...

Lease of 192.168.122.2 obtained, lease time 600

route: SIOCDELRT: No such process

>> Attempting to mount NFS root on 192.168.0.105:/srv/gentooTest/squashfs with options ro,nolock,rsize=1024,wsize=1024 

>> Booting (initramfs)..

INIT: version 2.88 booting

   OpenRC 0.8.3 is starting up Gentoo Linux (i686)

 * /proc is already mounted, skipping

 * Caching service dependencies ...

```

but I have some additional questions here:

 1) Is my workaround viable or is there a reason it has to be done the way it is in the initrd script?

 2) I know I've gotten this to work before without having to dig through the initramfs and change things, what am I doing wrong?

 3) I don't understand the logic of the conditional so i may need that explained to me.

----------

## Hu

I read that line to mean "if an IP address was specified or if busybox manages to obtain one, then go on to do NFS root operations."  This makes sense, since if you have no IP on the command line and busybox fails, then you have no IP address at all, so NFS cannot work.  I suspect specifying ip=dhcp is confusing it.  Have you tried using either ip=valid-address or omitting ip= entirely?

----------

## joeldavis

I have but it exhibits the same behavior. Also it looks like my work around isn't much of a work around, for whatever reason it seems like the PXE boot works as long as it's a virtual machine but when I take a physical machine and try to PXE boot it errors out a lot sooner. Which complicates things somewhat by limiting how reproducible the problem is.

----------

