# diskless node unable to mount root filesystem via NFS

## jwpaine

Hey...not sure what part of the forums I should put this on. Will try here =)

I'm using TFTP, NFS and DHCP to boot a diskless node using PXELinux. 

Each node has a basic root filesystem which resides in 

/diskless/ip_address on the server

Right now, my node acquires an IP from my DHCP server, which instructs the bootrom to download a file called pxelinux.0, and the default pxelinux config file (/diskless/pxelinux.conf/default ) is shown below:

```

DEFAULT /bzImage

APPEND ip=dhcp root=/dev/nfs nfsroot=192.168.1.1:/diskless/192.168.1.21

```

The node downloads the bzImage via tftp  (INTFTPD_PATH="/diskless") and boots the kernel. It goes through its hardware detection and all that fun stuff, and then the message:

 *Quote:*   

> 
> 
> VFS: cannot open root device "nfs" or unknown block(2,0)
> 
> 

 

The root device that it is refering to "nfs" is that which is defined in the pxelinux default config as root = /dev/nfs

[NOTE: Modern kernels recognize root=/dev/nfs as a command-line argument] Which leads me to think that I am possibly missing something in the kernel (bzImage) that the client node is booting. Here is a grep NFS of the kernel .config file:

```

CONFIG_NFS_FS=y

CONFIG_NFS_V3=y

CONFIG_NFS_V3_ACL=y

CONFIG_NFS_V4=y

# CONFIG_NFS_V4_1 is not set

CONFIG_ROOT_NFS=y

# CONFIG_NFS_USE_LEGACY_DNS is not set

CONFIG_NFS_USE_KERNEL_DNS=y

# CONFIG_NFS_USE_NEW_IDMAPPER is not set

CONFIG_NFSD=y

CONFIG_NFSD_DEPRECATED=y

CONFIG_NFSD_V3=y

# CONFIG_NFSD_V3_ACL is not set

# CONFIG_NFSD_V4 is not set

CONFIG_NFS_ACL_SUPPORT=y

CONFIG_NFS_COMMON=y

```

From what I can see, everything is enabled that needs to be enabled. Maybe a missing kernel option isn't the answer.

ANY suggestions would be awesome!

----------

## nativemad

Hi, 

the pxeconfig looks good.

Do you see that the kernel tries to gain an ip through dhcp (yes, a second time) after booting, just before the mount attempt? If there is no such info, then you probably miss the network driver IN kernel (not as module). 

If that is fine, you should see a mount attempt in the servers logfile which could probably tell you why the mount fails.

HTH, Cheers

----------

## jwpaine

Thanks for the reply.   

On the server, I did  *Quote:*   

> tcpdump port 67

  to see all active DHCP requests.  When I boot the machine, the node initiates a dhcp request, AND half way through booting the kernel it makes another request, before saying  *Quote:*   

> VFS: Unable to mount root fs via NFS   ,   VFS: Cannot open root device "nfs"

 

should the machine be able to respond to ping after a kernel panic?

If I change the line "root=/dev/nfs"  in the pxeconfig to, say root=/dev/foobar ,  I get "VFS: Cannot open root device "foobar" , which makes me think that the kernel isn't properly identifying the line root=/dev/nfs 

I have also tried tcpdump port 2049   (NFS)  and  do not see any incoming connections on this port.

Hmmm   :Confused: 

----------

## jwpaine

OK, checking /var/log/messages while the client boots, I am getting: 

 *Quote:*   

> refused mount request from 192.168.1.145 for /diskless/192.168.1.21 (/): no export entry

 

For some reason my node is being offered an IP of 192.168.1.145 (which is the IP of my server)

/var/log/messages shows: dhcpd: DHCPREQUEST for 192.168.1.145 (192.168.1.1) from 00:0b:db:2a:65:55 via eth0: lease 192.168.1.145 unavailable.

This looks like it's the problem...because in my /etc/exports file I have it specified that only a host with ip 192.168.1.21 can access the /diskless/192.168.1.21 share

NO idea why it's trying to get an ip of 192.168.1.145Last edited by jwpaine on Tue Oct 11, 2011 9:48 pm; edited 1 time in total

----------

## dmpogo

 *jwpaine wrote:*   

> OK, checking /var/log/messages while the client boots, I am getting: 
> 
>  *Quote:*   refused mount request from 192.168.1.145 for /diskless/192.168.1.21 (/): no export entry 
> 
> This is what my /etc/exports file looks like:
> ...

 

Could you have problems with premissions on your server ?   the export line should have a list of machines from which mount is allowed, no ?

I would expect it to be 

/diskless/192.168.1.21   192.168.1.145(sync,rw,no_root_squash,no_all_squash)

to be able to mount from 192.168.1.145

or, more generally, something like

/diskless/192.168.1.21   192.168.1.0/24(sync,rw,no_root_squash,no_all_squash)

----------

## jwpaine

For some reason the first time my dhcp server is providing it with a lease of 192.168.1.21, and the second time (once the kernel boots) it is aquiring an ip of 192.168.1.145...  I will figure this out later.  I changed the entry in /etc/exports to allow access from 192.168.1.145

/var/log/messages now shows:

authenticated mount request from 192.168.1.145:667 for /diskless/192.168.1.21 (/diskless/192.168.1.21)

so it was authenticated.... BUT

server kernel: [ 8254.772548] svc: 192.168.1.145, port=683: unknown version (3 for prog 100003, nfsd)

perhaps is what's causing the issue....    perhaps the client is using a different version of NFS?  I have NFS v3 enabled and v4 not set in the client's kernel

EDIT: 

```
cat /proc/fs/nfsd/versions
```

 gives "+2"

WHY is this using version to and not version 3? I recently emerged the nfs deamon.  isn't 2 really outdated?  Looks like I need to compile in version 2 support, unless I can find a way to enable version 3

----------

## dmpogo

 *jwpaine wrote:*   

> For some reason the first time my dhcp server is providing it with a lease of 192.168.1.21, and the second time (once the kernel boots) it is aquiring an ip of 192.168.1.145...  I will figure this out later.  I changed the entry in /etc/exports to allow access from 192.168.1.145
> 
> /var/log/messages now shows:
> 
> authenticated mount request from 192.168.1.145:667 for /diskless/192.168.1.21 (/diskless/192.168.1.21)
> ...

 

add     "vers=3"  to the nfs mount options on the client. Or compile nfs server without v4 support.

With dhcp, unless you configure dhcp server to give specific IP for a given MAC, you are never sure what IP you'll get.   So one would have to open exports to the whole network, or something, to avoid failures.   But then you name the images by IP, which is again problematic, without static assignment

----------

## jwpaine

The client's kernel is already configured to use NFS version 3.0   

NFS V4 is not configured in the client OR server kernel.    cat /proc/fs/nfds/versions shows  only support for version 2. I have no idea how to enable the server NFS version 3,   as server kernel already has CONFIG_NFS_V3=y

----------

## dmpogo

 *jwpaine wrote:*   

> The client's kernel is already configured to use NFS version 3.0   
> 
> NFS V4 is not configured in the client OR server kernel.    cat /proc/fs/nfds/versions shows  only support for version 2. I have no idea how to enable the server NFS version 3,   as server kernel already has CONFIG_NFS_V3=y

 

vers=3 is the MOUNT option,  to be set in  your /etc/fstab on the client  or whereever  your nfs mount is described on the client.

I see 

CONFIG_NFS_V4=y 

in one of your previous messages, was it on the client or server ?  I understood it is the client machine,  so kernel options say that   nfs client V3 and V4 and nfsserver V3 (but not V4) are configured in this kernel.  

Can you post all NFS kernel config options  from the server kernel ?

To have version 3 support your server kernel must have

CONFIG_NFSD_V3=y

If you server supports only version 2 and you can't change it,   then you should perhaps give    vers=2 option when you mount from the client.

----------

## jwpaine

CONFIG_NFSD_V2_ACL=y is the only thing I see that could be causing the issue. Removing and re-compiling.....

now /proc/fs/nfsd/versions shows +2 +3     Thanks a lot.... not sure how I missed that. Now to see if my client boots

It works! Kernel fully boots and I get a login prompt.   lots to work on, from here... but at least the nfs share is working  :Smile:  thanks!

----------

