I've just setup a proof-of-concept UEFI, PXE, NFS diskless booting system. For the NFS booting to work, I needed to create a custom initramfs using dracut-network including modules for nfs, network, and base.

Eventually, there will be many different filesystems (operating systems) on the NFS, each one with multiple kernels (from updates/debug). I want it to be relatively simple to create/update any of these OSs.

How can I build one initramfs that will work with any generic distro kernel? (Is this even possible? Other architectural suggestions regarding the project are welcome too).


Either the modules you need in order to mount the root filesystem (like nfs, the necessary network interface drivers, and so on) are built in to the kernel, or else they will need to be present in the initramfs. The former is unlikely, because distro kernels don't tend to have those modules linked in statically (they go for a minimum set, counting on the initramfs for the rest). The latter won't solve your problem, because you'll have to supply modules that go with any of the kernels that the user might be using.

In other words, you probably can't.

| improve this answer | |
  • Thanks for answering! "The latter" is definitely what I'm trying to do. For some reason I thought the initramfs (if built accordingly) was independently able to link-up to an NFS and serve root (with modules) to the kernel. You're saying that in fact, it just contains and supplies a subset of kernel modules? – Dan Apr 13 '17 at 20:21
  • 1
    @Dan The initramfs contains more than a bunch of module files, but selecting what modules to load is one of its main roles. With a typical distribution kernel, the initramfs won't be able to access an NFS server without loading a bunch of network-related modules, including in particular the network card driver — distributions put hardware drivers in modules to avoid having a huge kernel containing all the drivers whereas most computers need at most one in each category. – Gilles 'SO- stop being evil' Apr 14 '17 at 21:43

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.