# [Solved] Kernel panic: Unable to mount root fs via NFS

## MiRoSa

My PXE-Box get via tftp the kernel image...

It seems my kernel dont know how to NFS... but I have no idea why?

Kernel-Output:

```

...

e1000e: eth0 NIC Link is Up 100Mbps Full Duplex, Flow Control: Rx/Tx

e1000e 0000:00:19.0 eth0: 10/100 speed: disabling TSO

Sending DHCP requests ., OK

IP-Config: Got DHCP answer from 192.168.2.102, my address is 192.168.2.27

IP-Config: Complete:

    device=eth0, hwaddr=d8:50:e6:d2:..:.., ipaddr=192.168.2.27, mask=255.255.255.0, gw=192.168.2.1

    host=192.168.2.27, domain=misaro.de, nis-domain=(none)

    bootserver=192.168.2.102, rootserver=192.168.2.102, rootpath=

    nameserver0=192.168.2.1

...

   *** system waits here about 30 secs ***

...

VFS: Unable to mount root fs via NFS, trying floppy.

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

Please append a correct "root=" boot option; here are the available partitions:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

CPU: 1 PID: 1 Comm: swapper/0 NOt tainetd 3.12.21-gentoo-r1 #1

Hardware name: ASUS All Series/Q87T, BIOS 0904 05/14/2014

...

```

The kernel finds the net-driver, do a bootp request, but seems not to initiate the NFS

I dont get with tcpdump any nfs-related packets...

my pxelinux.cfg/C0A8021B:

```

DEFAULT /bzImage-igelfux

APPEND root=/dev/nfs nfsrootdebug nfsroot=192.168.2.102:/diskless/igelfux,nfsvers=4 ip=dhcp

```

my .config (i try to compile all important drivers into the kernel, but may be i need some more)

```

...

CONFIG_NETWORK_FILESYSTEMS=y

CONFIG_NFS_FS=y

# CONFIG_NFS_V2 is not set

CONFIG_NFS_V3=y

# CONFIG_NFS_V3_ACL is not set

CONFIG_NFS_V4=y

CONFIG_NFS_SWAP=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_NFSD=y

# CONFIG_NFSD_V3 is not set

# CONFIG_NFSD_V4 is not set

CONFIG_LOCKD=y

CONFIG_LOCKD_V4=y

CONFIG_NFS_COMMON=y

CONFIG_SUNRPC=y

CONFIG_SUNRPC_GSS=y

CONFIG_SUNRPC_SWAP=y

...

```

Last edited by MiRoSa on Sat Jul 12, 2014 4:25 pm; edited 1 time in total

----------

## szatox

First, you need initramfs to make it work. You didn't provide it among boot params. Is it built into kernel already?

Second, you must have your network device's driver compiled into kernel. Modules will not work (at least not with default genkernel-generated initramfs)

Third, it seems your root is a directory tree. Again, if you use initramfs from genkernel, it won't work. You must turn it into livecd. In particular, you need your root stuffed into squashfs image, provide nfsroot that would allow you read squashfs image, then to make it work you must specify path to that image, type of image, and tell init scripts you want loop mount.

To make it work in other modes than livecd you would have to hack it a bit. Not like it was very hard, it's mostly a matter of your wants.

----------

## NeddySeagoon

MiRoSa,

```
nfsvers=4
```

is a problem.  I could never get that to work.

----------

## MiRoSa

Thx, for your answers!

with

```
nfsvers=3
```

I get a step further!

That was the solution!

----------

