How to fix an apparenlty missing kernel module dependency declaration?
I’ve encountered a relatively common problem with ASIX AX88179 USB 3.0 Gigabit Ethernet adapter, where it was not working at all, or was working sporadically, and dmesg
was showing errors like
[23552.344134] ax88179_178a 2-1:2.1 eth1: Failed to read reg index 0x0000: -32
Searching on-line, I’ve found reports of this or similar problems without satisfactory solutions or explanation.
After some debugging, it turned out that the problem is solved if cdc_mbim
module is loaded before ax88179_178a
. The following solves the problem until the next reboot:
# rmmod ax88179_178a
# modprobe cdc_mbim
# modprobe ax88179_178a # optional
I’ve checked that cdc_mbim
is not declared a dependency of ax88179_178a
, neither directly, nor indirectly.
How can I make ax88179_178a
depend on cdc_mbim
, so that cdc_mbim
be always loaded automatically before ax88179_178a
?
Update.
My question seems to be a duplicate of Create Linux module dependency for autoloading module.
You can use a modprobe.d
file to configure this without changing the kernel. Create a file, named /etc/modprobe.d/ax88179.conf
, with the following contents:
install ax88179_178a /sbin/modprobe cdc_mbim; /sbin/modprobe --ignore-install ax88179_178a
This will ensure that attempts to install ax88179_178a
result in cdc_mbim
being loaded first, followed by ax88179_178a
. --ignore-install
on the second command skips this line (to avoid endless processing).
A similar, but slightly cleaner strategy also involving a file in modprobe.d/
is to use the softdep
feature to tell modprobe
to load cdc_mbim
before ax88179_178a
. In /etc/modprobe.d/ax88179.conf
:
softdep ax88179_178a pre: cdc_mbim