I'm trying to build kernel 3.13.9, fetched using apt-get source, and built in a clean debootstrap chroot (both host and chroot being installations of Ubuntu Trusty). My goal is to boot a diskless machine to a console over NFS.

I ran make menuconfig and enabled 64-bit kernel, disabled debugging, and made sure I was doing a 64-bit build. In addition, I went to file systems->network file systems, and enabled the following:

  • Network File Systems
  • NFS Client Support

The host has nfs-kernel-server installed, and an export set up for the directory that I would like to use as the root of the network-booted system.

PXE boot happens OK, kernel and initrd are loaded, but after a long pause, I'm dumped to a busybox prompt, due to a root filesystem being missing.

What could be the cause? (or, is more info needed?)

Edit: I'm already passing nfsroot:

LABEL linux
KERNEL vmlinuz-3.13.9
APPEND root=/dev/nfs initrd=initrd.img-3.13.9 nfsroot=,rw ip=dhcp rw
  • Ok, the problem is with the compiling or that the flags don't seems to make any effect? – Braiam Jul 1 '14 at 21:47
  • @Braiam I can compile just fine. I don't know how to check if NFS was actually put in, but I enabled it in the config, and didn't see any warnings regarding it. I'm not sure how the flags are being parsed, but /dev/nfs does not exist after the kernel comes up. I've checked in BusyBox. – nanofarad Jul 1 '14 at 23:11

As the kernel documentation states, /dev/nfs is not a real device but only a hint to the kernel to use NFS as rootfs. You'll also have to tell the kernel where to find this root through the nfsroot parameter or a properly set up DHCP daemon. For the latter one to work you'll also have to either configure your kernel to auto-configure its network interfaces or have an initramfs which takes care of this.

Also, make sure to have NFS support built into your kernel binary and not as a module (or have an initramfs, which takes care of this). Same goes for network drivers: you'll most probably want to have the driver for you ethernet NIC built into your kernel image, otherwise you'll have to load it from an initramfs.

In short, there are several possibilities:

  1. Do as above link tells you: have root=/dev/nfs set, give the correct nfsroot parameter and tell your kernel your network configuration via the ip parameter (this would be the best way to make sure it's working at all, i.e. to rule out a misconfigured DHCP server).
  2. Have CONFIG_IP_PNP and CONFIG_IP_PNP_DHCP enabled and set up a DHCP daemon to tell your client which IP address to use and where to find its NFS-root.
  3. Build an initramfs which does the correct configuration and NFS-mounting.

Edit: I think if you're using an initrd/initramfs as your edit suggests, you'll have to do the NFS-mount in the initrd (resp. your initrd has to be aware of the fact that it has to do so). Automounting through the kernel (as IP autoconfiguration, IIRC) only works if there's no initrd.

| improve this answer | |
  • I forgot to mention, I'm already passing nfsroot with the kernel append option. I'll edit the exact lines into my post shortly. – nanofarad Jul 1 '14 at 15:02
  • Could you indicate how to set up the initrd to perform the NFS mount? – nanofarad Jul 1 '14 at 23:46
  • Why don't you skip the initrd-part and let the kernel do autoconfiguration? Configure your kernel to have everything needed for booting (network drivers, NFS support, …) built-in and enable CONFIG_IP_PNP_DHCP. Would be much easier than fiddling with an initrd. – Andreas Wiese Jul 2 '14 at 11:04
  • Since around 10 years the kernel doesn't boot nfs directly, but it mounts an initial ramdisk, which re-interprets the kernel command line and boots from where you want. – peterh - Reinstate Monica Jun 17 '16 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.