On Tue, Jan 29, 2019 at 1:39 PM Alan Mackenzie <[email protected]> wrote: > > On Tue, Jan 29, 2019 at 12:58:38 -0500, Rich Freeman wrote: > > Can't say I've tried it recently, but I'd be shocked if it changed > > much. The linux kernel guys generally consider this somewhat > > deprecated behavior, and prefer that users use an initramfs for this > > sort of thing. It is exactly the sort of problem an initramfs was > > created to fix. > > An initramfs is conceptually so ugly that I view it as a workaround, not > a fix, to whatever problem it's applied to.
Not sure why you would think this. It is just a cpio archive of a root filesystem that the kernel runs as a generic bootstrap. This means that your bootstrap for initializing your root and everything else can use any userspace tool that exists for linux. A similar concept lies at the heart of coreboot - using a generic kernel/userpace as a firmware bootloader making it far more flexible. An initramfs is basically just a fairly compact linux distro. It works the same as any distro. The kernel runs init, and init does its thing. By convention that init will mount the real root and then exec the init inside, but it doesn't have to work that way. Heck, you can run a system with nothing but an initramfs and no other root filesystem. > It would surely be a bug if the kernel were capable of manipulating RAIDs, > but not of initialising > and mounting them. Linus would disagree with you there, and has said as much publicly. He does not consider initialization to be the responsibility of kernel space long-term, and prefers that this happen in user-space. Some of the lvm and mdadm support remains for legacy reasons, but you probably won't see initialization of newer volume/etc managers supported directly in the kernel. > > Honestly, I'd just bite the bullet and use dracut if you want your OS > > on RAID/etc. It is basically a one-liner at this point to install and > > a relatively small tweak to your GRUB config (automatic if using > > mkconfig). Dracut will respect your mdadm.conf, and just about all > > your other config info in /etc. The only gotcha is rebuilding your > > initramfs if it drastically changes (but, drastically changing your > > root filesystem is something that requires care anyway). > > Well, at the moment my system's not broken, hence doesn't need fixing. > Last time I looked at Dracut, it would only work in a kernel built with > modules enabled, ruling out my setup. That is news to me. Obviously it needs whatever drivers it needs, but I don't see why it would care if they are built in-kernel vs in-module. > Also, without putting in a LOT of time and study, dracut is a massive, > opaque mystery. I've got a pretty good mental picture of how my system > works, and introducing an initramfs would degrade that picture > enormously. That means if any problems happened with the initramfs, I'd > be faced with many days study to get to grips with it. Sure, if you want to know exactly how it works that is true, but the same is true of openrc or any other piece of software on your system. Dracut is highly modular and phase/hook-driven so it isn't too hard to grok. Most of it is just bash/dash scripts. -- Rich

