Skip to contentSkip to conversation

package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

PATCH New Andy Shevchenko 2 participants 6 messages May 23, 2019 – May 24, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

At runtime on most of the modern kernels [1] S10mdev script produces an error:

/etc/init.d/S10mdev: line 9: can't create /proc/sys/kernel/hotplug: nonexistent directory

since the commit

caae7fa1d737 ("busybox: register mdev as hotplug helper when selected")

added it unconditionally.

Check the presence of procfs node before writing to it.

[1]: Linux kernels with the commit
86d56134f1b6 ("kobject: Make support for uevent_helper optional.")
applied.

Fixes caae7fa1d737 ("busybox: register mdev as hotplug helper when selected")
Cc Gustavo Zacarias <[email protected]>
---
 package/busybox/S10mdev | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/busybox/S10mdev +1 -1
index 7075b77016..ddede9a4a6 100644
@@ -6,7 +6,7 @@
 case "$1" in
   start)
 	echo "Starting mdev..."
-	echo /sbin/mdev >/proc/sys/kernel/hotplug
+	test -f /proc/sys/kernel/hotplug && echo /sbin/mdev > /proc/sys/kernel/hotplug
 	/sbin/mdev -s
 	# coldplug modules
 	find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Andy" == Andy Shevchenko <[email protected]> writes:

At runtime on most of the modern kernels [1] S10mdev script produces an error:
/etc/init.d/S10mdev: line 9: can't create /proc/sys/kernel/hotplug: nonexistent directory

since the commit

caae7fa1d737 ("busybox: register mdev as hotplug helper when selected")

Quoted 7 lines

added it unconditionally.

Check the presence of procfs node before writing to it.

[1]: Linux kernels with the commit
86d56134f1b6 ("kobject: Make support for uevent_helper optional.")
applied.

But how can mdev work on such setups?

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

Quoted 12 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Andy" == Andy Shevchenko <[email protected]> writes:

At runtime on most of the modern kernels [1] S10mdev script produces an error:
/etc/init.d/S10mdev: line 9: can't create /proc/sys/kernel/hotplug: nonexistent directory

since the commit

caae7fa1d737 ("busybox: register mdev as hotplug helper when selected")

added it unconditionally.

Quoted 7 lines
Quoted 5 lines

Check the presence of procfs node before writing to it.

[1]: Linux kernels with the commit
86d56134f1b6 ("kobject: Make support for uevent_helper optional.") applied.

But how can mdev work on such setups?

To be clear, if mdev needs CONFIG_UEVENT_HELPER=y for hotplug notifications, then we should rather force that in linux/linux.mk and mention the dependency in the mdev help text rather than silently not having hotplug work.

I have marked this patch as changes requested in patchwork.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

Quoted 12 lines · Peter Korsgaard
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Andy" == Andy Shevchenko <[email protected]> writes:

At runtime on most of the modern kernels [1] S10mdev script produces an error:
/etc/init.d/S10mdev: line 9: can't create /proc/sys/kernel/hotplug: nonexistent directory

since the commit

caae7fa1d737 ("busybox: register mdev as hotplug helper when selected")

added it unconditionally.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Check the presence of procfs node before writing to it.

[1]: Linux kernels with the commit
86d56134f1b6 ("kobject: Make support for uevent_helper optional.") applied.

But how can mdev work on such setups?

At least the script is used to initialize modules at the boot time. What happens afterwards I didn't investigate. I have no such issues.

Quoted 6 lines

To be clear, if mdev needs CONFIG_UEVENT_HELPER=y for hotplug notifications, then we should rather force that in linux/linux.mk and mention the dependency in the mdev help text rather than silently not having hotplug work.

I have marked this patch as changes requested in patchwork.

Kernel can be built outside of Buildroot. Still this needs to be fixed.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH 1/1 package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

"Andy" == Andy Shevchenko <[email protected]> writes:

But how can mdev work on such setups?

At least the script is used to initialize modules at the boot time. What happens afterwards I didn't investigate. I have no such issues.

You mean the:

        # coldplug modules
        find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
            xargs -0 modprobe -abq

That indeed does not depend on mdev working.

Quoted 8 lines
Quoted 6 lines

To be clear, if mdev needs CONFIG_UEVENT_HELPER=y for hotplug notifications, then we should rather force that in linux/linux.mk and mention the dependency in the mdev help text rather than silently not having hotplug work.

I have marked this patch as changes requested in patchwork.

Kernel can be built outside of Buildroot. Still this needs to be fixed.

And just like all other packages that require specific kernel options enabled, if you are not using Buildroot to build the kernel then you have to ensure the kernel has the right config options enabled.

I am not sure what you mean exactly with "Still this needs to be fixed". The only fix I can think of is what I mentioned above, E.G. document the need for CONFIG_UEVENT_HELPER in the help text and automatically enable it in linux.mk.

Expecting mdev to work sensible on a system without uevent helper support isn't sensible, it is similar to having radvd (IPv6 router advertising daemon) work on a system without IPv6.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/1 package/busybox: Avoid "can't create /proc/sys/kernel/hotplug" error

Quoted 29 lines · Peter Korsgaard
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

"Andy" == Andy Shevchenko <[email protected]> writes:

But how can mdev work on such setups?

At least the script is used to initialize modules at the boot time. What happens afterwards I didn't investigate. I have no such issues.

You mean the:

        # coldplug modules
        find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
            xargs -0 modprobe -abq

That indeed does not depend on mdev working.

Quoted 8 lines
Quoted 6 lines

To be clear, if mdev needs CONFIG_UEVENT_HELPER=y for hotplug notifications, then we should rather force that in linux/linux.mk and mention the dependency in the mdev help text rather than silently not having hotplug work.

I have marked this patch as changes requested in patchwork.

Kernel can be built outside of Buildroot. Still this needs to be fixed.

And just like all other packages that require specific kernel options enabled, if you are not using Buildroot to build the kernel then you have to ensure the kernel has the right config options enabled.

Quoted 8 lines

I am not sure what you mean exactly with "Still this needs to be fixed". The only fix I can think of is what I mentioned above, E.G. document the need for CONFIG_UEVENT_HELPER in the help text and automatically enable it in linux.mk.

Expecting mdev to work sensible on a system without uevent helper support isn't sensible, it is similar to having radvd (IPv6 router advertising daemon) work on a system without IPv6.

I'm not sure if mdev follows the change in the kernel, but uEvent helper is obsolete mechanism.

--- 8< --- 8< --- 8< ---

The external binary /sbin/hotplug was used in earlier releases to inform Udev about device state change. That has been replaced and Udev can now directly listen to those events through Netlink.

--- 8< --- 8< --- 8< ---

Signature · 2 lines
With Best Regards,
Andy Shevchenko