Skip to contentSkip to conversation

Initramfs and /sbin/hotplug fun

DISCUSSION Andrew Walrond 5 participants 8 messages Jan 15, 2007 – Jan 16, 2007

lore
Share & tools
lore
#0 lore raw

If the initramfs root filesystem contains /sbin/hotplug, the kernel starts calling it very early in the kernel boot process, well before /init has been called. In my case this resulted in lots of hotplug segfault messages as the kernel boots, followed by a thoroughly unhappy hotplug+udev once /init actually gets control.

To solve this, I deleted /sbin/hotplug from the initramfs archive and modified /init to reinstate it once it gets control. This works fine, but seems inelegant. Is there a better solution? Should sbin/hotplug be called at all before the kernel has passed control to /init?

Andrew Walrond

#1 lore raw
Quoted 6 lines · Andrew Walrond

If the initramfs root filesystem contains /sbin/hotplug, the kernel starts calling it very early in the kernel boot process, well before /init has been called. In my case this resulted in lots of hotplug segfault messages as the kernel boots, followed by a thoroughly unhappy hotplug+udev once /init actually gets control.

Could this be a case of http://lkml.org/lkml/2006/12/3/19 ?

	-`J'
#2 lore raw
In reply to Andrew Walrond
Quoted 4 lines · Andrew Walrond

To solve this, I deleted /sbin/hotplug from the initramfs archive and modified /init to reinstate it once it gets control. This works fine, but seems inelegant. Is there a better solution? Should sbin/hotplug be called at all before the kernel has passed control to /init?

Yes, it should be called.
/sbin/hotplug and /init are two very different and unrelated things.

#3 lore raw
Quoted 5 lines · Olaf Hering
Quoted 1 line · Andrew Walrond

To solve this, I deleted /sbin/hotplug from the initramfs archive and modified /init to reinstate it once it gets control. This works fine, but seems inelegant. Is there a better solution? Should sbin/hotplug be called at all before the kernel has passed control to /init?

Yes, it should be called.

Ok

Quoted 1 line

/sbin/hotplug and /init are two very different and unrelated things.

Well, of course. But looking at the thread provided by Jan, it seems the kernel might not be in any fit state to service the (userspace) hotplug infrastructure when it makes the calls (Ie can't create pipes yet).

The kernel wouldn't call /init (or /sbin/init) before it was fully ready to handle userspace processes, so why should it feel able to call the hotplug userspace?

Andrew Walrond

#4 lore raw
Quoted 5 lines · Andrew Walrond
Quoted 1 line

/sbin/hotplug and /init are two very different and unrelated things.

Well, of course. But looking at the thread provided by Jan, it seems the kernel might not be in any fit state to service the (userspace) hotplug infrastructure when it makes the calls (Ie can't create pipes yet).

Thats because noone really fixed the init call order. Its going back and forth since /init was added in 2.6.6.
Ideally, there could be some /earlyinit that could prepare the enviroment for hotplug calls.
Why do you need /sbin/hotplug anyway, just for firmware loading for a non-modular kernel?

#7 lore raw
In reply to Andrew Walrond
Quoted 7 lines · Andrew Walrond
Quoted 5 lines · Olaf Hering
Quoted 1 line · Andrew Walrond

To solve this, I deleted /sbin/hotplug from the initramfs archive and modified /init to reinstate it once it gets control. This works fine, but seems inelegant. Is there a better solution? Should sbin/hotplug be called at all before the kernel has passed control to /init?

Yes, it should be called.

Quoted 8 lines

Ok

Quoted 1 line

/sbin/hotplug and /init are two very different and unrelated things.

Well, of course. But looking at the thread provided by Jan, it seems the kernel might not be in any fit state to service the (userspace) hotplug infrastructure when it makes the calls (Ie can't create pipes yet).

The kernel wouldn't call /init (or /sbin/init) before it was fully ready to handle userspace processes, so why should it feel able to call the hotplug userspace?

I could speculate in case it needs to hotplug something to complete boot, but it could just be a thinko.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO TMR Associates, Inc
  Doing interesting things with small computers since 1979
#5 lore raw
In reply to Olaf Hering
Quoted 3 lines · Olaf Hering

Why do you need /sbin/hotplug anyway, just for firmware loading for a non-modular kernel?

I guess this is unusual, but FWIW...

I have a custom distro and I was just looking for the easiest way to create a bootable rescue pen-drive. So I just took a working distro, added an init->sbin/init symlink, cpio'ed it into an initramfs, and booted it up. Works a treat, except for the early hotplug calls.

Andrew

#6 lore raw
Quoted 7 lines · Andrew Walrond
Quoted 2 lines · Olaf Hering

Why do you need /sbin/hotplug anyway, just for firmware loading for a non-modular kernel?

I guess this is unusual, but FWIW...

I have a custom distro and I was just looking for the easiest way to create a bootable rescue pen-drive. So I just took a working distro, added an init->sbin/init symlink, cpio'ed it into an initramfs, and booted it up. Works a treat, except for the early hotplug calls.

I have a kernel that needs to have early hotplug calls to load firmware. I just rolled my own simple hotplug scripts to only address that issue and have not had a problem since. The mdev in busybox that is in the gentoo initramfs didn't seem to be able to handle it, so I just made my own scripts. In my case I needed QLogic firmware so root could be on FC.

FWIW, it is a real PITA to not be able to build a monolithic kernel that can bring up root on its own. I will stipulate that I am an old-school guy that likes monolithic kernels, but I do feel that something has been lost. Yes, I am aware of the reasons for the change, else I would have written something when I was fighting the battle, but I still don't have to like it.

Signature · 1 line
Mark Rustad, [email protected]