1

I'm building a custom initrd so that I can boot diskless nodes with a tmpfs root rather than NFS root (a script in the initrd copies the contents of the root device to a tmpfs filesystem, then changes the value of NEWROOT). All seemed well and good in my test environment, I generated a custom initrd, booted it, / mounted from none as tmpfs but had all the files the NFS root provided, great stuff.

Then I started moving towards the real environment, and when the initrd boots it chokes trying to mount the NFS root (which is still a normal NFS boot at that point) complaining mount.nfs4: No such device.

I generate my initrd using:

dracut -v -m "nfs network base" --include rd.live.overlay/ / initrd-tmpfs.img

I confirmed that the initrd-tmpfs.img is being loaded (based on the early part of the PXE boot where it lists the initrd its loading).

When the initrd fails it drops into the emergency shell, and has a few interesting things:

ip addr show lists my IP from DHCP, and I can ping the NFS server

echo $netroot lists the NFS boot paramaters nfs4:[Server IP]:[root location]:[nfs options]

mount -t nfs4 [Server IP]:[root location] /sysroot results: mount.nfs4: No such device (very familiar)

modprobe nfs results: modprobe:FATAL: Module nfs not found obviously a problem

grep nfs /usr/lib/dracut/modules.txt does match

grep nfs /usr/lib/modules/[kernel version]/modules.order matches a few times, mentioning: kernel/fs/nfs.ko | kernel/fs/nfsv3.ko | kernel/fs/nfsv4.ko however none of these exist

Environment: RHEL 7


Looks like my question answered itself just as I finished writing it, I'll post the answer

2

The last debugging step I did clued me in, so I figured I'd post the answer for the sake of others. grep nfs /usr/lib/modules/[kernel version]/modules.order matched kernel/fs/nfs.ko | kernel/fs/nfsv3.ko | kernel/fs/nfsv4.ko, but they didn't exist.

Well *.ko represents a kernel driver, and initrd has an option --add-drivers, so

dracut -v -m "nfs network base" --include rd.live.overlay/ / initrd-tmpfs.img

became:

dracut -v -m "nfs network base" --add-drivers "nfs nfsv4" \
--include rd.live.overlay/ / initrd-tmpfs.img

Then lsinitrd | grep nfs listed nfs.ko and nfsv4.ko, the root device got itself mounted, copied and happy days, there's a diskless server booted over NFS that has a tmpfs / directory, great stuff for a HA diskless cluster.

The difference in drivers between my test environment and target would be a result of /etc/dracut.conf or /etc/dracut.conf.d/, which can specify drivers to be included, but I didn't look into them too much (I would rather specify the drivers when running the command for the sake of my sanity).

  • Thank you so much for taking the time to write the answer! – joaerl Aug 14 '17 at 15:33

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.