Dracut looks to replace the initramfs patchwork
Creating initramfs images, for use by the kernel at "early boot" time, is a rather messy business. It is made more so by the fact that each individual distribution has its own tools to build the image, as well as its own set of tools inside it. At the 2008 Kernel Summit, Dave Jones spent some time discussing the problem along with his idea to start over by creating a cross-distribution initramfs. That has led to the Dracut project, which was announced by Jeremy Katz in December, and a new mailing list, aptly named "initramfs", in which to discuss it.
An initramfs is a cpio archive of the initial filesystem that gets loaded into memory when the kernel is loaded. That filesystem needs to contain all of the drivers and tools needed to mount the real root filesystem. It isn't strictly necessary to have an initramfs, a minimal /dev along with the required drivers built into the kernel is another alternative. Distributions, though, all use an initramfs and, over time, each has come up with their own way to handle this process. Jones, Katz, and others would like to see something more standardized, that gets pushed upstream into the mainline kernel so that distributions can stop fussing with the problem.
There are a number of advantages to that approach. Building an initramfs from the kernel sources would eliminate problems that users who build their own kernels sometimes run into. If a distribution's initramfs scheme falls behind the pace of kernel development in some fashion, users can find themselves unable to build a kernel+initramfs combination that will work. There is also hope that dracut will help speed up the boot process by using udev, as Katz puts it:
Because initramfs is so integral to the early boot process—and so difficult to debug if problems arise—there is a concern about starting over. It is not surprising, then, that there is some resistance to throwing out years of hard-earned knowledge that is embodied in the various distributions' initramfs handling, leading Maximilian Attems to ask:
beside having more features and flexibility it does not hardcode udev usage, nor bash, why should it not be considered at first!?
It is a question that is frequently asked, but one that Jones has a ready answer for:
"why not use the suse one?"
they all have some good and bad tradeoffs. Distro X has feature Y which no-one else does. etc.
When the project began we spent some time looking at what everyone else already does, and "lets start over and hope others participate" seemed more attractive than taking an existing one and bending it to fit.
So, the Red Hat folks, at least, are proceeding with dracut. Jones
recently posted a status
report on his blog that outlined what is working and what still needs
to be done. Though it currently is "Fedora-centric, with a few
hardcoded assumptions in there, so it'll likely fall over on other
distros
", fixing that is clearly high on the to-do list. The status
report is an effort to get people up-to-speed so that other distributions
can start trying it out. In addition, he plans to start trying it on
various distributions himself.
In its current form, dracut is rather minimal. It has a script named
dracut that will generate a gzipped cpio file for the initramfs
image, as
well as an init shell script that ends up in that image.
Jones says that init "achieves quite a lot in its 119
lines
": setting up device nodes, starting udev, waiting for the root
device to show up and mounting it, mounting /proc and /sys,
and more. If anything goes wrong during that process, init will
drop to a shell that will allow diagnosis of the problem. So far, it only
supports
the simpler cases for the location of the root filesystem:
There is only one remaining barrier to getting rid of the unlamented nash, and that is a utility to do a switch_root (i.e. switch to a new root directory and start an init from there). The plan is to write a standalone utility that would be added to the util-linux package. The environment provided by the initramfs would include util-linux, bash, and use glibc, which doesn't sit well with some embedded folks. They generally prefer a statically linked busybox environment. Kay Sievers outlines the reasons for a standard environment:
Full-featured distros who make their money with support, can just not afford to support tools compiled differently from the tools in the real rootfs. SUSE used klibc for one release, and stopped doing that immediately, because you go crazy if you run into problems with bootup problems on [customer] setups you can not reproduce with the tools from the real rootfs.
There is plenty to do to make dracut into a real tool for creating initramfs images—at least ones that work on more than just Fedora—more root filesystem types need to be handled, hibernation signatures need to be recognized and handled, the udev rules need to be cleaned up, kdump images need to be supported, etc. But the overriding question is: will other distributions start working on dracut as well? If and when Jones (or others) get things at least limping along on Debian/Ubuntu and/or SUSE, will those distributions start getting on board? So far, there is not a lot of evidence of anyone other than Red Hat working on dracut.
But, the plan is to eventually submit dracut upstream to the mainline kernel, so that make initramfs works in a standard kernel tree. It would seem that many kernel hackers see the need for standardizing initramfs and eventually moving it into the kernel, as Ted Ts'o notes:
So IMHO, it's important not only that the distributions standardize on a single initramfs framework, but that framework get integrated into the kernel sources.
No one is very happy about losing their particular version of the tools to build an initramfs—if only because of familiarity—but a standardized solution is something whose time has come. Probably any of the existing tools could have been used as a starting point, but for political reasons, it makes sense to start anew. There is a fair amount of cruft that has built up in the existing tools as well, which folks are unlikely to miss, so there are also technical reasons to start over. It should come as no surprise that a project started by Red Hat might be somewhat Fedora-centric in its early form, but the clear intent is to make it distribution-agnostic. It would seem the right time for other distributions and constituencies (embedded for example) to get involved to help shape dracut into something useful for all.
Index entries for this article | |
---|---|
Kernel | Dracut |
Kernel | initramfs |
Posted Feb 5, 2009 2:07 UTC (Thu)
by miffe (subscriber, #24478)
[Link] (2 responses)
Or am I missing something?
Posted Feb 5, 2009 3:22 UTC (Thu)
by jbailey (guest, #16890)
[Link] (1 responses)
Posted Feb 5, 2009 8:18 UTC (Thu)
by jengelh (guest, #33263)
[Link]
$myothercommands;
something like that. Of course you can wrap that into a nice C program, but if it works without, you'll probably spare the extra binary.
Posted Feb 5, 2009 2:54 UTC (Thu)
by me@jasonclinton.com (subscriber, #52701)
[Link]
But, here's why I don't think anyone else will adopt it: I worked for a company a few years ago that built a custom thin-client software stack. I wrote all of the initramfs integration. At the time the project started, I looked around for a nice framework that already existed that I could just reuse so that I didn't have to reinvent the wheel. I evaluated every distro's initramfs generation framework. In short, they all have terrible kludges and assumptions about the host OS and requirements EXCEPT for Debian's initramfs-tools. The design is simple, elegant and completely agnostic. And it works in just about every boot case you can possibly imagine with a fully pluggable boot method system (which we abused liberally).
I think it will take a few years for Dracut or any other solution to reach that level of maturity. And I just don't see any Debian-based system switching to Dracut until its forced on them--because what they have now is so, so nice.
It's a shame that this is yet another Redhat NIH. (And I don't buy the explanation that it was done to encourage adoption. If it's the right technical solution, people will use it.)
Posted Feb 5, 2009 3:36 UTC (Thu)
by jbailey (guest, #16890)
[Link] (9 responses)
The reason the question keeps coming up about why not reuse the initramfs-
My biggest concerns are things like the authors apparently not being
Hmm, I wonder if it's worth writing an LWN article on initramfs-tools
Tks,
Posted Feb 5, 2009 4:15 UTC (Thu)
by linuxjacques (subscriber, #45768)
[Link]
I do embedded and when I hear glibc and bash I think they must be joking.
Posted Feb 5, 2009 4:36 UTC (Thu)
by jake (editor, #205)
[Link]
Not only are we interested in seeing it, we are interested in paying for it :) See the "Write for LWN" link at the top and if you are still interested, let's talk ...
jake
Posted Feb 5, 2009 9:50 UTC (Thu)
by k3ninho (subscriber, #50375)
[Link]
K3n.
Posted Feb 5, 2009 14:55 UTC (Thu)
by roblucid (guest, #48964)
[Link]
Posted Feb 5, 2009 16:32 UTC (Thu)
by Stephen_Beynon (guest, #4090)
[Link]
Posted Feb 5, 2009 17:44 UTC (Thu)
by lbt (subscriber, #29672)
[Link]
It would be interesting to see 'the right way' to extend initramfs too.
Why not submit it upstream - no-one thinks twice about YAFS so it seems reasonable to have a competing initramfs tool.
Posted Feb 8, 2009 22:24 UTC (Sun)
by apollock (subscriber, #14629)
[Link]
Posted Feb 11, 2009 20:55 UTC (Wed)
by tack (guest, #12542)
[Link]
I recently got a thorough education on how initramfs-tools works in troubleshooting recent root-over-lvm-over-md problems, and I must say I was very pleased with the design, flexibility, and customizability.
When I later had to deal with Fedora's initrd toolset, I was one very agitated sysadmin.
Posted Aug 3, 2010 21:24 UTC (Tue)
by bobbytables (guest, #65908)
[Link]
I was introduced to initramfs-tools when I started building my kernel.org images with kernel-package/make-kpkg (yet another great Debian tool).
It was a breeze for me so I didn't even appreciate how good it is... until I tried to set up my full disk encryption on another distro (a root partition inside a LVM2 container inside a LUKS partition) - it was pain...
Congrats for your work and I'd really like to see an article!
Posted Feb 5, 2009 9:43 UTC (Thu)
by climent (guest, #7232)
[Link] (2 responses)
The day that happens we have a replacement. Otherwise, I want to be able to boot from my encrypted partitions when i use my laptop.
Posted Feb 5, 2009 14:22 UTC (Thu)
by nix (subscriber, #2304)
[Link] (1 responses)
Booting can be arbitrarily complicated: it must, no matter what, remain
Posted Feb 5, 2009 16:19 UTC (Thu)
by iabervon (subscriber, #722)
[Link]
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
initramfs at all.
Dracut looks to replace the initramfs patchwork
LD_LIBRARY_PATH=/mnt/lib /mnt/lib64/ld-linux-x86-64.so.2 /mnt/bin/rm -Rf /$everythingButMnt;
exec /mnt/lib64/ld-linux-x86-64.so.2 --library-path "/mnt/lib:/mnt/usr/lib" /mnt/usr/bin/chroot /mnt /sbin/init "$@";
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
tools code is because by the design of Dracut, it looks like they're trying
to produce the exact same thing that we did, about 3 years after we wrote
that one. Judging by the git tree, it looks like the authors haven't
bothered to look at what existing initramfs' in distros already do.
(Something which I did extensively before writing it. It wasn't like I
*wanted* to do this, just that all of the distros were still using
pivot_root at the time and I'd recently attended a talk at OLS where we
were told this method of booting was going away)
interested in klibc (initramfs-tools uses that to get a nice small shell
and for embedded cases producing initramfs' that are a fraction the size of
glibc, never mind glibc plus the userspace tools), their use of bashisms,
and the fact that they're starting quite far behind on different boot
scenarios.
pimping it a little harder? Anyone interested in seeing it?
Jeff Bailey
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
> pimping it a little harder? Anyone interested in seeing it?
Req: article on initramfs-tools.
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
article.
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
Dracut looks to replace the initramfs patchwork
mount LVM, systems that mount LVM-atop-RAID, one bizarre system that has a
root filesystem on RAID-atop-LVM (!), a couple of systems whose RAID
arrays are assembled over the network block device, and one that never
actually mounts a root filesystem atop the rootfs but does all its work
from there.
possible to *replace* whatever standardized initramfs framework goes
upstream, because nothing will ever cope with all the utterly bizarre
corner cases.
Dracut looks to replace the initramfs patchwork