What's new

How to blacklist UAS (USB) kernel module at boot?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Irresponse

New Around Here
First post in the forum, sorry for bad or weird english.

-Router: RT-AX82U v1 (tri-core, 512mb RAM, single USB 3.0 port)
-Firmware: 388.2_2_0-gnuton1 (merlin NG)
-Storage: Kingston XS2000 4Tb SSD with original cable (male USB-C in both ends) and USB-C-to-USB-A adapter (female C and male A)
-amtm with all bells and whistles, and opkg with usbutils, pciutils, etc, everything updated and running fine

The USB drivers are built-in kernel modules, hardcoded in the firmware.
There are 2 modules built-in, the old usb-storage.ko, and the newer uas.ko.

Early in the boot process, the kernel loads the xhci_hcd module (USB 3.0 driver), which then detects the Kingston SSD and loads the UAS module by default.

But I want to use the usb-storage driver instead of the uas driver (for testing purposes, kernel of this era are know to misbehave with the UAS driver, and I want to compare the performance).

The 2 main ways to do this are adding a usb-storage.quirk as kernel boot parameter in /proc/cmdline.txt, or blacklisting the uas module early in the boot process with modprobe.

I know that these need to be done with amtm startup scripts (probably in the init-start script), but after many trials i'm unable to do so, maybe i'm too dumb to understand the scripts lingo.

Someone can help?
 
But I want to use the usb-storage driver instead of the uas driver (for testing purposes, kernel of this era are know to misbehave with the UAS driver, and I want to compare the performance).

blacklisting and installing kmod's are a known thing...

What's the problem you are really trying to solve - UAS for devices that support it is fairly mature...
 
blacklisting and installing kmod's are a known thing...

What's the problem you are really trying to solve - UAS for devices that support it is fairly mature...

Like i said, i want just to test both drivers/modules and compare the performance between them.

I know that UAS is mature and etc, but kernels from this era (3.x and 4.x) sometimes don't do well with UAS, and changing driver/module from UAS to USB-STORAGE, albeit slower in theory, in practice sometimes is FASTER than UAS because lack of compatibility issues.
My system works fine, but i feel that the SSD performance, albeit still fast, is a lot slower than the same SSD in other systems like Windows and Linux notebooks (just 10% of the speed in other systems).

It's the CPU bottlenecking? Maybe, i wanna test it anyway.
It's the physical USB bus that is bottlenecked? Maybe, i wanna test it anyway.
It's some weird issue with the UAS driver? Maybe, i need to test with the another built-in driver to compare, it's the only variable that I can change.

The only variable that I (think that) can control in the system it's the USB driver used by the kernel, the others are hardware limited.

So I wanna do this test for learning purposes, but dont know how to blacklist or add an usb_storage.quirk to the UAS driver.
 
How about booting up the router without the USB drive plugged in. Then doing modprobe -r uas followed by inserting the USB drive?
 
I don't think Busybox's modutils support blacklisting.
 
I don't think Busybox's modutils support blacklisting.

Depends on the version and the default is disabled...


config FEATURE_MODPROBE_BLACKLIST
bool "Blacklist support"
default n
depends on MODPROBE
help
Say 'y' here to enable support for the 'blacklist' command in
modprobe.conf. This prevents the alias resolver to resolve
blacklisted modules. This is useful if you want to prevent your
hardware autodetection scripts to load modules like evdev, frame
buffer drivers etc.
 
Code:
merlin@ubuntu-dev:~/amng.ax86pro/release/src/router/busybox$ cat config_current | grep FEATURE_MODPROBE_BLACKLIST
# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
 
Up thread)
How to enable blacklisting on current firmware in router? Or it is impossible without recompile?
 
Not possible without recompiling the firmware with different Busybox options.
 
You could try the entware version of busybox. It should keep both versions on your router so if something doesn’t behave correctly just uninstall the opkg busybox and it should revert to the firmware version of busybox. I’ve done this before on my router nothing terrifying happened. I’ll note that when you install busybox it will likely install a bunch of updated software required for it which might cause path conflicts so purging that stuff later if you don’t want it might be required. I’d only do this if you’re willing to reinstall your entware or reset your router.

I wouldn’t say it’s recommended to do so as I have no idea the consequences of doing so or what security modifications @RMerlin might have made.
 
Last edited:
You could try the entware version of busybox. It should keep both versions on your router so if something doesn’t behave correctly just uninstall the opkg busybox and it should revert to the firmware version of busybox.

Not recommended - having been there/done that - better to use the current busybox version and patch/recompile as needed.

entware, at the moment, is stuck in a bit of limbo because of the ukraine situation - unfortunate, but it is what it is...
 
Wouldn`t help as the module will most likely be loaded by modprobe before the USB disk with the Entware installation is even mounted.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top