Initramfs and /sbin/hotplug fun
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
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'
Quoted 4 lines · Andrew Walrond
To solve this, I deleted
/sbin/hotplugfrom 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.
Quoted 5 lines · Olaf Hering
Quoted 1 line · Andrew Walrond
To solve this, I deleted
/sbin/hotplugfrom 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/hotplugand /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
Quoted 5 lines · Andrew Walrond
Quoted 1 line
/sbin/hotplugand /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?
Quoted 3 lines · Olaf Hering
Why do you need
/sbin/hotpluganyway, 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
Quoted 7 lines · Andrew Walrond
Quoted 2 lines · Olaf Hering
Why do you need
/sbin/hotpluganyway, 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]
Quoted 7 lines · Andrew Walrond
Quoted 5 lines · Olaf Hering
Quoted 1 line · Andrew Walrond
To solve this, I deleted
/sbin/hotplugfrom 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/hotplugand /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