Missing usbmon module

Hi

I would like to use the kernel facility usbmon (https://www.kernel.org/doc/Documentation/usb/usbmon.txt) to help debugging a USB device, but it seems like the module is not included in balenaOS.

If I try to load the usbmon module, I get:

modprobe usbmon
modprobe: FATAL: Module usbmon not found in directory /lib/modules/4.14.48-yocto-standard

I have tried to use your project https://github.com/balena-io-projects/kernel-module-build to build the kernel module myself, but so far without luck. I have downloaded the source code https://github.com/torvalds/linux/tree/v4.14/drivers/usb/mon and modified the Makefile to:

KERNEL_TREE_PATH?=/lib/modules/$(shell uname -r)/build
EXTRA_CFLAGS:="-DDEBUG"
KBUILD_CFLAGS += -DCONFIG_USB_MON=Y

obj-m+=usbmon.o
usbmon-y := mon_main.o mon_stat.o mon_text.o mon_bin.o

all:
	make -C $(KERNEL_TREE_PATH) M=$(PWD) modules

clean:
	make -C $(KERNEL_TREE_PATH) M=$(PWD) clean

.PHONY: all clean

Building with “./build.sh intel-nuc 2.26.0+rev1.dev mon” gives me:

make: Entering directory '/tmp/tmp.Alri3SHHAC'
  CC [M]  /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/mon_main.o
  CC [M]  /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/mon_stat.o
  CC [M]  /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/mon_text.o
  CC [M]  /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/mon_bin.o
  LD [M]  /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/usbmon.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "usb_mon_register" [/home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/usbmon.ko] undefined!
WARNING: "usb_mon_deregister" [/home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/usbmon.ko] undefined!
  CC      /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/usbmon.mod.o
  LD [M]  /home/xxx/repos/kernel-module-build/mon_intel-nuc_2.26.0+rev1.dev/usbmon.ko
make: Leaving directory '/tmp/tmp.Alri3SHHAC'

Clearly, usb_mon_register and usb_mon_deregister are missing?

Is this something you can help me with?

Best Regards,
abaldur

Hi @abaldur,

You can grab the Balena Intel repo and do a small addition where you activate the usbmon driver:

You should do something very similar to this:

The other way would be to pay Balena for support and we could do it for you.

Regards!

Hi @spanceac

Thx for the reply.

It would be really nice If I could avoid to fork the repo just because if that single kernel module.

Are there any chances that you will include it in the official balena-os/balena-intel repo?

As seen in the linux-yocto_%.bbappend, you have already included some customer requests. What are your policies regarding what can be included in your official repository?

/ abaldur

Hi @abaldur,

Usually what you see in the Requested by customer field were requests from our paying customers.

We will evaluate the adding of usbmon to the list of modules and will get to you with a reply.

In the past we had some issue with the free space availability for Intel NUC so adding more modules was a problem. Now we freed some space so there is some margin to add user requested modules.

Regards!

Hi @abaldur,
Usually what you see in the Requested by customer field were requests from our paying customers.
We will evaluate the adding of usbmon to the list of modules and will get to you with a reply.
In the past we had some issue with the free space availability for Intel NUC so adding more modules was a problem. Now we freed some space so there is some margin to add user requested modules.
Regards!

Hi @spanceac

I understand.

Sounds great, really appreciate your support.

Let me know if you decide to include it in the official repo.

/ abaldur

Hi @spanceac

I have a couple of follow-up questions:

  1. When you say that “Requested by customer” is from your paying customers, does that mean customers that are at least on the prototype plan? Or do you charge a separate fee for special requests like that?

  2. What are the criteria for kernel modules to be included in the balena-os/balena-intel repo? I guess that you would like to keep it as small as possible?

  3. If we decide to build our own custom yocto image, can we then still make use of your backend for pushing and deploying images?

Thanks

/ abaldur

Hi @abaldur,

To answer your questions.

1 and 2 We enable kernel modules for paying and non-paying customers depending on how important is for the community to have those modules. We usually want to preserve the free space, to have it available for modules that are important for the community.

3 If you decide to build your own custom image you can still make use of our infrastructure to deploy and manage your applications. The only caveat is if you will update the OS from the dashboard, your custom image will be overwritten with the default OS. As long as you don’t do remote update to the OS you won’t have problems.

Another question would be why do you need this kernel module activated and if you need it permanently activated or only for some temporary debug purposes?

Regards!

Hi @spanceac

Thx for the answers.

The reason we need the kernel module activated is because we are having trouble with a USB device that sometimes (unfortunately rarely) fails, and I would like to have as much debugging information as possible when that happens.

It would definitely be beneficial for us to have the module available permanently in order to track down any potential future problems.

Thanks,

/ abaldur