r/linuxfromscratch • u/8ttp • Jul 05 '25
initramfs
Is initramfs mandatory for LFS? Reading the docs I understood that initramfs is a topic for BLFS. But my LFS only boots when using initramfs. I am quite confused. Any thoughts on this? Is initramfs mandatory or not?
8
Upvotes
4
u/[deleted] Jul 05 '25
I've never done lfs. But initramfs is not always necessary...depending on your boot setup.
off the top of my head, I know it's needed for encrypted filesystems or lvm...I'm sure there are other situations where it's needed too.
3
u/RetroCoreGaming Jul 06 '25
If your rootfs is supported via a kernel module, then yes you'll need an initramfs.
If you built your rootfs kernel driver into the kernel itself, then no unless you want to preload certain drivers.
2
u/tiny_humble_guy Jul 05 '25
Interesting. Are you, by any chance, using uefi or specific driver ? I've done two builds and it works fine without any initramfs.
1
u/RealModeX86 Jul 05 '25
In what way is it not working without initramfs?
Like others have said, if you're doing LVM or encrypted root, you'd need initramfs, but another consideration is hardware support.
If you need a module for a disk controller to mount root, then you should be able to build that into your kernel instead of as a module in order to avoid needing an initramfs, at least if it's native partitions.
3
u/Dakota_Sneppy Jul 06 '25
nah I'm running full blfs with graphics and amdgpu all initramfsless :3
2
u/I0I0I0I Jul 06 '25
initramfs is generally used to pre-load drivers, e.g. ZFS. It solves the chicken/egg problem: system can't boot unless it can mount the filesystem, but it can't mount a ZFS filesystem unless it knows how. So initramfs loads the ZFS module, before the main kernel boots.
1
u/86redditmods Jul 07 '25
I dont use initramfs on my lfs daily driver no problems for me and I use eufi