void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

[RFC] initramfs

Open dkwo opened this issue 5 years ago • 16 comments

What are the main benefits of using dracut vs mkinitcpio?

For an encrypted setup, is it enough to add the keyboard, keymap and encrypt hooks to mkinitcpio.conf?

Thanks.

dkwo avatar May 12 '21 08:05 dkwo

The best mkinitcpio documentation is from Arch Linux. They support systemd-less initramfs, so it should be fully applicable to void. I'm saying this because I don't have experience with mkinitcpio in void myself, and don't remember my Manjaro setup.

As for features, I'm not sure. Choosing an initramfs generator seems to be more about picking one and sticking to it than extensive technical advantages, but I could be wrong. Could investigate git history to see when drafut became default.

ericonr avatar May 12 '21 11:05 ericonr

They support systemd-less initramfs, so it should be fully applicable to void.

As for dracut, the attitude seems to be: focus their resources to further integrate with and optimize for systemd.

@ahesford

dkwo avatar May 12 '21 12:05 dkwo

I prefer mkinitcpio to dracut. It is much simpler. In dracut, there are multiple levels of hooks that modules can inject, but some hooks aren't guaranteed to run even once. The console_init.sh hook in the i18n module, for example, will never be run if other "critical" hooks finish too quickly. I opened an issue about this and was told to bugger off because I don't use systemd.

One of these days, I intend to investigate a full-featured migration to mkinitcpio in Void, but it's a low-priority task that keeps getting bumped.

ahesford avatar May 12 '21 13:05 ahesford

What should be changed in order for XBPS to use mkinitcpio instead of dracut? I mean as far as XBPS settings go.

dkwo avatar May 13 '21 11:05 dkwo

Nothing, other than changing the dependency of base-system. They both just hook into the /etc/kernel.d hooking system.

Not sure if there is a nice way to do this change, if we don't add replaces=dracut>=someversion, then users will have two initramfs for each kernel until they remove orphaned packages. If we just replace dracut then users who actually configured dracut to work with their system, but not mkinitcpio then we are going to somewhat break their system or cause an inconvenience.

Duncaen avatar May 13 '21 12:05 Duncaen

@dkwo You could try #29434 if you would like.

travankor avatar May 17 '21 13:05 travankor

@travankor Good to know, thanks. It does not require any hooks to deal with encrypted partition, correct?

dkwo avatar May 17 '21 16:05 dkwo

Yes, no hooks are used currently. Most features are built in by default.

travankor avatar May 18 '21 08:05 travankor

While I am sure mkinitcpio will be around for a long time, it has been inconsistently maintained, and Giancarlo Razzolini, who is listed as Arch maintainer, seems less than enthused. He has suggested switching Arch to dracut as default.

furryfixer avatar May 24 '21 02:05 furryfixer

After some trial time, my two cents here go to booster: it is simple, works well, and the developer is willing to debug non-systemd issues. Actually, they just helped solve an issue with runit.

dkwo avatar Jun 30 '21 08:06 dkwo

booster is non-portable so it's not an option

q66 avatar Jun 30 '21 10:06 q66

@q66 Could you clarify your definition of portable?

dkwo avatar Jul 01 '21 07:07 dkwo

It us unportable, because it is written in go, e.g. we currently do not have go properly on 32bit ppc and mips.

Johnnynator avatar Jul 01 '21 09:07 Johnnynator

gccgo is a joke/toy, and official go is only available on x86/arm/aarch64/ppc64le, so yeah, it's pretty non-portable

I don't want a google language anywhere near the base system

q66 avatar Jul 01 '21 10:07 q66

Part of this discussion gets charged because we start thinking about where we'd go when dracut becomes completely hostile to anything but systemd. Every release seems to take us closer to that point.

I now think the best thing we can do is try to decouple packages from a single initramfs generator. 876b6ed3a4da006639908794bff4eeaeb0f123eb is a start, replacing dracut-specific post-install scripts with a common XBPS trigger that is currently aware of mkinitcpio and dracut. Somebody can add booster, initramfs-tools, whatever to that trigger as needed.

The only other issue that remains is how to cleanly handle multiple installed generators. On some systems, I've been using mkinitcpio to ensure there is a clean transitional path. However, ZFSBootMenu still requires dracut. Having both installed means multiple kernel hooks compete (mkinitcpio would win here) unless I noextract the hooks I don't want. This works fine for people who know to do it, but we really need a method for multiple kernel hooks to coexist without all of them firing. I see two possibilities:

  1. Every kernel hook is aware of /etc/default/initramfs-regenerate used by the XBPS trigger and will turn itself into a no-op if the configured generator does not agree with the one in the hook, or
  2. We centralize the kernel hook, knowing how to create an initramfs for each generator and choosing the right one based on the configuration. The first option provably violates DRY, but the second doesn't scale well beyond a handful of generators. No problem; we should never really have more than a handful available anyway. I think (2) is a bit cleaner.

With the hook issue resolved, we can probably just define a virtual provided by all the generators. People can then just use what they want with no problems. The last issue is choosing a default provider, but that should obviously be dracut for a long time because we have a lot of inertia.

ahesford avatar Jul 01 '21 11:07 ahesford

I see, thanks for the clarifications.

dkwo avatar Jul 01 '21 11:07 dkwo