You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a D-Link DIR-882 A1 router (MT7621 + 2x MT7615N, 128 MB of RAM, 16 MB of NOR flash) running OpenWrt SNAPSHOT r16087-1d412235a5 (built on March 4, 2021) and I need to pass quirks=0bc2:231a:u parameter to the usb-storage module at boot in order to skip loading of the UAS driver, which is currently broken on the xhci-mtk driver this router uses (as reported [[https://bugs.openwrt.org/index.php?do=details&task_id=1862|here]], [[https://bugs.openwrt.org/index.php?do=details&task_id=1305|here]], [[https://github.com/gnubee-git/GnuBee_Docs/issues/98|here]] and on various topics on the OpenWrt Forums), and prevents an external USB 3.0 HDD I have to work with it.
Accordingly to several sources, this should be easily accomplished by writing usb-storage quirks=::u on a single line into /etc/modules.d/usb-storage, however, the specified parameter is ignored and never reaches the kernel module, as running cat /sys/module/usb_storage/parameters/quirks after boot is complete returns empty. I also found [[https://forum.openwrt.org/t/is-there-any-way-to-pass-parameters-to-the-kernel-module-when-openwrt-starts/27907|this thread]], dating back to 2018, with other users having the same issue, and which also seems to confirm that adding the kernel module parameters to the corresponding file under /etc/modules.d is how it's supposed to work, but it simply doesn't.
The only workaround I found so far is running echo "0bc2:231a:u" > /sys/module/usb_storage/parameters/quirks after booting, but then I need to physically unplug and re-plug the HDD for the changes to take effect, this also needs to be done every time the router powers on, which is very annoying. Other things I tried includes creating /etc/modprobe.d/usb-storage.conf with options usb-storage quirks=::u and also unloading (and ever completely removing) kmod-usb-storage-uas from the device, but none of that worked.
So, is there any other mechanism for passing parameters to kernel modules at boot time? As far as I searched, /etc/modules.d seems to be the only one, but it's broken...
The text was updated successfully, but these errors were encountered:
I managed to create a workaround that works, but it's kinda ugly. It's a startup service that adds the quirk parameter to the kernel module manually after it has been already loaded, then it proceeds detaching then reattaching the USB XHCI hub to force reload all child devices with the new parameters, without needing to physically unplug/replug the HDD.
Create /etc/init.d/usb-uas-workaround and add the following content to the file: #!/bin/sh /etc/rc.common
Disable UAS for Seagate Expansion Drive
START=10
boot() {
echo "0bc2:231a:u" > /sys/module/usb_storage/parameters/quirks
echo "2-0:1.0" > /sys/bus/usb/drivers/hub/unbind
echo "2-0:1.0" > /sys/bus/usb/drivers/hub/bind
}
Then give it execute permissions (chmod 755) and enable the service through LuCI (System => Startup) or through SSH. You'll need to adjust the device VID/PID on the first line to match your particular HDD and also the USB node that corresponds to the XHCI hub on your router (the ones I provided should work on MT7621-based routers). Reboot when you're done and it should work.
I only did limited testing and this can certainly cause issues on more complex scenarios (e.g. having the disk connected to an external USB hub instead of being directly plugged on the router), but that's what I could come up with in the mean time.
A definitive fix requires patching whatever is making kmodloader ignore the passed parameters when reading the files from /etc/modules.d, but that's out of my reach...
mbc07:
I have a D-Link DIR-882 A1 router (MT7621 + 2x MT7615N, 128 MB of RAM, 16 MB of NOR flash) running OpenWrt SNAPSHOT r16087-1d412235a5 (built on March 4, 2021) and I need to pass quirks=0bc2:231a:u parameter to the usb-storage module at boot in order to skip loading of the UAS driver, which is currently broken on the xhci-mtk driver this router uses (as reported [[https://bugs.openwrt.org/index.php?do=details&task_id=1862|here]], [[https://bugs.openwrt.org/index.php?do=details&task_id=1305|here]], [[https://github.com/gnubee-git/GnuBee_Docs/issues/98|here]] and on various topics on the OpenWrt Forums), and prevents an external USB 3.0 HDD I have to work with it.
Accordingly to several sources, this should be easily accomplished by writing usb-storage quirks=::u on a single line into /etc/modules.d/usb-storage, however, the specified parameter is ignored and never reaches the kernel module, as running cat /sys/module/usb_storage/parameters/quirks after boot is complete returns empty. I also found [[https://forum.openwrt.org/t/is-there-any-way-to-pass-parameters-to-the-kernel-module-when-openwrt-starts/27907|this thread]], dating back to 2018, with other users having the same issue, and which also seems to confirm that adding the kernel module parameters to the corresponding file under /etc/modules.d is how it's supposed to work, but it simply doesn't.
The only workaround I found so far is running echo "0bc2:231a:u" > /sys/module/usb_storage/parameters/quirks after booting, but then I need to physically unplug and re-plug the HDD for the changes to take effect, this also needs to be done every time the router powers on, which is very annoying. Other things I tried includes creating /etc/modprobe.d/usb-storage.conf with options usb-storage quirks=::u and also unloading (and ever completely removing) kmod-usb-storage-uas from the device, but none of that worked.
So, is there any other mechanism for passing parameters to kernel modules at boot time? As far as I searched, /etc/modules.d seems to be the only one, but it's broken...
The text was updated successfully, but these errors were encountered: