5

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=192.168.1.39:/nfsroot,rw ip=dhcp rw
2
  • Ok, the problem is with the compiling or that the flags don't seems to make any effect?
    – Braiam
    Jul 1, 2014 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, 2014 at 23:11

2 Answers 2

5

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.

5
  • 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, 2014 at 15:02
  • Could you indicate how to set up the initrd to perform the NFS mount?
    – nanofarad
    Jul 1, 2014 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. Jul 2, 2014 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
    Jun 17, 2016 at 13:54
  • my pxe booting works fine from TFTP and mounting NFS as root. However I get a service failure message at boot time telling me systemd-remount-fs.service failed. Most likely this is because in fstab has /dev/nfs listed as root device, which does in fact not exist. How do I fix the issue? Do I just alter fstab to ip:/nfs/path / nfs defaults,rw,relatime 0 0?
    – FalcoGer
    Sep 11, 2021 at 13:19
0

FalcoGer, I was asking myself the exact same question. Since we are already passing root=/dev/nfs as a parameter in the bootloader I tried to comment this line and systemd-remount-fs stopped complaining! Wondering now if this is really required

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 17, 2022 at 3:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .