Kmod instead of ubox

I'd like to install kmod, it's only 35Kb bigger. opkg install fails as it tries to replace ubox's files. OK, but I can't build it with imagebuilder:

% make image PROFILE=miwifi-mini PACKAGES="-ubox kmod
...
Collected errors:
* check_data_file_clashes: Package ubox wants to install file /srv/moo-x_share/sergio/projects/all/outerface/openwrt/imagebuilder/openwrt-imagebuilder-19.07.1-ramips-mt7620.Linux-x86_64/build_dir/target-mipsel_24kc_musl/root-ramips/sbin/insmod
   But that file is already provided by package  * kmod
* check_data_file_clashes: Package ubox wants to install file /srv/moo-x_share/sergio/projects/all/outerface/openwrt/imagebuilder/openwrt-imagebuilder-19.07.1-ramips-mt7620.Linux-x86_64/build_dir/target-mipsel_24kc_musl/root-ramips/sbin/lsmod
   But that file is already provided by package  * kmod
* check_data_file_clashes: Package ubox wants to install file /srv/moo-x_share/sergio/projects/all/outerface/openwrt/imagebuilder/openwrt-imagebuilder-19.07.1-ramips-mt7620.Linux-x86_64/build_dir/target-mipsel_24kc_musl/root-ramips/sbin/modinfo
   But that file is already provided by package  * kmod
* check_data_file_clashes: Package ubox wants to install file /srv/moo-x_share/sergio/projects/all/outerface/openwrt/imagebuilder/openwrt-imagebuilder-19.07.1-ramips-mt7620.Linux-x86_64/build_dir/target-mipsel_24kc_musl/root-ramips/sbin/modprobe
   But that file is already provided by package  * kmod
* check_data_file_clashes: Package ubox wants to install file /srv/moo-x_share/sergio/projects/all/outerface/openwrt/imagebuilder/openwrt-imagebuilder-19.07.1-ramips-mt7620.Linux-x86_64/build_dir/target-mipsel_24kc_musl/root-ramips/sbin/rmmod
   But that file is already provided by package  * kmod
* opkg_install_cmd: Cannot install package base-files.

But base-files doesn't depend on ubox.

Why do you wanna do that?

I think there is another solution for your desired solution.

First of all I want to see module parameters with modinfo, also I want to be able to say modprobe -r and rmmod -f. What is the problem to replace ubox with kmod?

Because at least one other very important package, named procd, depends on ubox.

On a running openwrt system you should be able to force install the package kmod without first removing ubox. You should try this...
I don't know if this is possible with the image builder.

I also prefer using the kmod tools. You need to build a busybox package and remove the kmod utility in the busybox configuration in menuconfig.

Shouldn't procd depend on {ubox|kmod}, instead of strict ubox dependency?

How this will help?

Because the utilities in busybox conflict with the utilities of the same name in the kmod package as you have already noted in the original post.

So removing kmod in the busybox config builds busybox without the kmod tools and thus lets the kmod package and the busybox package be installed with no conflicts.

This is how I did it on my system

2 Likes

base-files depends on procd that depends on ubox, it's not clear howto removing kmod in the busybox config helps with this dependencies, anyway it's not that I want: kmod is already packaged I'd just like to install it, not rebuild the whole system.

I still have busybox installed. That's the whole point. It's just the kmod tools that are deselected in the busybox package configuration, so all other busybox utilities are there and the procd dependency is satisfied. The kmod piece is satisfied by kmod-tools.

You don't need to rebuild the system. Just build a new busybox package with the SDK.

So I just did exactly this for your platform miwifi-mini. It took all of ten minutes to download the SDK and build a new busybox ipk.

If you want, I can make the binary ipk available to you for download, but I recommend you compile it yourself so you know its provenance. [EDIT: link to it here on my github]

To rebuild busybox is not a problem, but is a workaround, not a solution.
This is just a wrong dependency and it should be corrected.

This isn´t fixable...
As i suggested before, force overwriting contents of other packages do the trick...

opkg --force-overwrite install kmod

This is just another workaround.

This isn´t fixable...

Why so?

Because kmod doesn't provide a equal functionality like ubox and the very important procd relies on ubox.
Therefore it can not be replaced by kmod.

Remember we are on a very resource constrained device and can not install any full blown desktop init system or there like.

Therefore we have procd, ubox and so on...

1 Like

kmod provides wider functionality than ubox, not equal, so I see no reason why it can not replace ubox.

With equal to ubox i mean, at least all features of ubox!

If you are sure thats true, why not sending a patch or create a pr?

1 Like
  • Are you sure you know what a package dependency actually is?
  • Do you understand that the conflicting programs are compiled into the available Busybox package?
  • So you understand to add the package you desire, that you have to provide a Busybox package not containing them, correct?
  • You do understand it's common that routers have space constraints?

If so, why are you calling it a workaround?

If you want this to be change to be OpenWrt-wide - as @juppin said, you should feel free to make the appropriate request; but I surmise what you're well aware of the development issue that would cause.

Both ubox and kmod need to be extended to be alternatives to each other, similar to how it has been done for wget, ip, etc.

Until this is done, your only choice is to use opkg --force-overwrite install kmod.

3 Likes

As I see ip and wget behave differently: both ip-tiny and ip-full provide ip (on which something else may depend), while wget updates /usr/bin/wget symlink.

Exact solutions that I see:

  1. kmod and ubox should conflict each other and provide module-tools, procd, fstools and other should depend on module-tools

  2. kmod and ubox should conflict each other and kmod should provide ubox.

I'd like to make a patch.

The proper solution is registering the kmod applets as alternatives, this way opkg will transparently handle the executable conflicts.

These two patches (untested) should solve the conflict issue:

  1. patch against ubox package
diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile
index cfa0b594e4..6a515c0f32 100644
--- a/package/system/ubox/Makefile
+++ b/package/system/ubox/Makefile
@@ -25,6 +25,12 @@ define Package/ubox
   CATEGORY:=Base system
   DEPENDS:=+libubox +ubusd +ubus +libubus +libuci +USE_GLIBC:librt
   TITLE:=OpenWrt system helper toolbox
+  ALTERNATIVES:= \
+    100:/sbin/insmod:/sbin/kmodloader \
+    100:/sbin/lsmod:/sbin/kmodloader \
+    100:/sbin/modinfo:/sbin/kmodloader \
+    100:/sbin/modprobe:/sbin/kmodloader \
+    100:/sbin/rmmod:/sbin/kmodloader
 endef
 
 define Package/getrando
  1. Patch against kmod package
diff --git a/utils/kmod/Makefile b/utils/kmod/Makefile
index b9e7b6068..fae2395dd 100644
--- a/utils/kmod/Makefile
+++ b/utils/kmod/Makefile
@@ -38,6 +38,13 @@ endef
 define Package/kmod
 $(call Package/kmod/Default)
   TITLE+= (tools)
+  ALTERNATIVES:= \
+    200:/sbin/depmod:/sbin/kmod \
+    200:/sbin/insmod:/sbin/kmod \
+    200:/sbin/lsmod:/sbin/kmod \
+    200:/sbin/modinfo:/sbin/kmod \
+    200:/sbin/modprobe:/sbin/kmod \
+    200:/sbin/rmmod:/sbin/kmod
 endef
 
 define Package/kmod/description
2 Likes