Skip to contentSkip to conversation

package/kmod: use the correct path for kmod

PATCH In review Li Chen 2 participants 3 messages Oct 12, 2022 – Oct 16, 2022

lore
Share & tools
lore

Li Chen

author
#0 lore raw

PATCH 1/1 package/kmod: use the correct path for kmod

Content-Transfer-Encoding: 8bit

kmod install path is always /usr/bin/kmod instead
of /bin/kmod.

So if we link modprobe/lsmod/... to /bin/kmod

We will get error like:

Quoted 2 lines
# modprobe
-sh: modprobe: not found

because it points to:

Quoted 2 lines
# ls -liah /sbin/modprobe
  2551 lrwxrwxrwx    1 root     root          11 Sep 25 10:05 /sbin/modprobe -> ../bin/kmod

and kmod is under /usr/bin/kmod instead of /bin/kmod.

---
 package/kmod/kmod.mk | 5 -----
 1 file changed, 5 deletions(-)
package/kmod/kmod.mk +0 -5
index 82e8597759..cfb4a27cf3 100644
@@ -73,12 +73,7 @@ ifeq ($(BR2_PACKAGE_KMOD_TOOLS),y)
 KMOD_LICENSE += , GPL-2.0+ (tools)
 KMOD_LICENSE_FILES += COPYING
 
-# /sbin is really /usr/sbin with merged /usr, so adjust relative symlink
-ifeq ($(BR2_ROOTFS_MERGED_USR),y)
-KMOD_BIN_PATH = ../bin/kmod
-else
 KMOD_BIN_PATH = ../usr/bin/kmod
-endif
 
 define KMOD_INSTALL_TOOLS
 	for i in depmod insmod lsmod modinfo modprobe rmmod; do \
Signature · 6 lines
2.37.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello,

Quoted 11 lines · On Wed, 12 Oct 2022 09:34:39 +0800 Li Chen<[email protected]> wrote:

Content-Transfer-Encoding: 8bit

kmod install path is always /usr/bin/kmod instead
of /bin/kmod.

So if we link modprobe/lsmod/... to /bin/kmod

We will get error like:

Quoted 2 lines
# modprobe
-sh: modprobe: not found  
Quoted 7 lines

because it points to:

Quoted 2 lines
# ls -liah /sbin/modprobe
  2551 lrwxrwxrwx    1 root     root          11 Sep 25 10:05 /sbin/modprobe -> ../bin/kmod  

and kmod is under /usr/bin/kmod instead of /bin/kmod.

Are you testing a BR2_ROOTFS_MERGED_USR enabled or a BR2_ROOTFS_MERGED_USR disabled configuration?

If you're testing a BR2_ROOTFS_MERGED_USR enabled configuration, then the "modprobe" symlink, even if created in /sbin is in fact in /usr/sbin, because /sbin is a symlink to /usr/sbin. So actually the symlink is /usr/sbin/modprobe -> ../bin/kmod, which is correct as kmod is indeed in /usr/bin/kmod.

If you're testing a BR2_ROOTFS_MERGED_USR disabled configuration, then the "modprobe" symlink is really in /sbin, and /sbin/modprobe is a symlink to ../usr/bin/kmod, which is correct.

(Of course, I didn't do a test, so maybe my reasoning is wrong, but the current logic appears correct at first sight).

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#2 lore raw

Hi Thomas,
---- On Thu, 13 Oct 2022 04:40:08 +0800 Thomas Petazzoni wrote ---

Quoted 33 lines

Hello,

Quoted 11 lines · On Wed, 12 Oct 2022 09:34:39 +0800 Li [email protected]> wrote:

Content-Transfer-Encoding: 8bit

kmod install path is always /usr/bin/kmod instead
of /bin/kmod.

So if we link modprobe/lsmod/... to /bin/kmod

We will get error like:

Quoted 2 lines
# modprobe
-sh: modprobe: not found  
Quoted 7 lines

because it points to:

Quoted 2 lines
# ls -liah /sbin/modprobe
  2551 lrwxrwxrwx    1 root     root          11 Sep 25 10:05 /sbin/modprobe -> ../bin/kmod  

and kmod is under /usr/bin/kmod instead of /bin/kmod.

Are you testing a BR2_ROOTFS_MERGED_USR enabled or a BR2_ROOTFS_MERGED_USR disabled configuration?

If you're testing a BR2_ROOTFS_MERGED_USR enabled configuration, then the "modprobe" symlink, even if created in /sbin is in fact in /usr/sbin, because /sbin is a symlink to /usr/sbin. So actually the symlink is /usr/sbin/modprobe -> ../bin/kmod, which is correct as kmod is indeed in /usr/bin/kmod.

Quoted 6 lines

If you're testing a BR2_ROOTFS_MERGED_USR disabled configuration, then the "modprobe" symlink is really in /sbin, and /sbin/modprobe is a symlink to ../usr/bin/kmod, which is correct.

(Of course, I didn't do a test, so maybe my reasoning is wrong, but the current logic appears correct at first sight).

Thanks for your reply,
I cannot reproduce this issue now somehow. I will update this thread if I come across it again someday.

Regards,
Li
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot