LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unload kernel module at boot time (Debian Wheezy 7.2, 3.2.0-4-686-pae kernel) (https://www.linuxquestions.org/questions/linux-newbie-8/unload-kernel-module-at-boot-time-debian-wheezy-7-2-3-2-0-4-686-pae-kernel-4175489749/)

gacanepa 12-31-2013 07:27 PM

Unload kernel module at boot time (Debian Wheezy 7.2, 3.2.0-4-686-pae kernel)
 
Hi everyone,
I am trying to prevent the ehci_hcd kernel module to load at boot time.
Here's what I've tried so far:
1) Add the following line to /etc/modprobe.d/blacklist.conf (as suggested here):
Code:

blacklist ehci_hcd
2) Blacklisted the module by adding the following string to
Code:

GRUB_CMDLINE_LINUX_DEFAULT="quiet modprobe.blacklist=ehci_hcd"
3) Tried to blacklist the module by adding the following line to /etc/modprobe.d/blacklist (without the .conf):
Code:

blacklist ehci_hcd
After trying each step I updated the boot image with
Code:

dpkg-reconfigure linux-image-$(uname -r)
and rebooted, each time to no use.
I've also removed the module with
Code:

modprobe -r ehci_hcd
but as you know, that will only unload the module until next reboot.
The reason why I want to do this is because I am suspecting that module is responsible for crashing a RAID1 device composed of 2 8 GB USB drives connected to a PCI 4-port USB 2.0 hub in an old home server that only has USB 1.1 onboard ports available (I added the PCI hub in hopes that I could use the flash drives at USB 2.0 speeds). Maybe the hardware itself isn't capable of handling USB 2.0? Please correct me if my reasoning is faulty.
Any hints or suggestions will be more than welcome.

syg00 12-31-2013 11:36 PM

Just rename the actual kernel module (under /usr/lib/modules... somewhere), and reboot. Rename it back after your testing.

towheedm 01-01-2014 12:47 AM

Quote:

Originally Posted by syg00 (Post 5089957)
Just rename the actual kernel module (under /usr/lib/modules... somewhere), and reboot. Rename it back after your testing.

That will work but it's /lib/modules/..... on Debian.

If you want to blacklist the ehci_hcd module, you must also blacklist the uhci_hcd module. There must some dependency going on, not sure.

You can do it from GRUB, but you must update GRUB's configuration files for it to take effect:
Code:

sudo update-grub
My preference would be to blacklist it from modprobe:
Code:

echo -e "blacklist ehci_hcd\nblacklist uchi_hcd" | sudo tee /etc/modprobe.d/ehci.conf

gacanepa 01-01-2014 08:48 AM

Thanks syg00 and towheedm.
I'll tell you what I did.
1) I checked the dependencies of each module and it turns out that ehci_hcd does not depend on uhci_hcd. Instead, both depend on usbcore:
Code:

root@debian:~# modinfo ehci_hcd uhci_hcd | grep depends
depends:        usbcore
depends:        usbcore
root@debian:~#

However, I tried to blacklist both modules from modprobe, as towheedm suggested. I rebooted and found out that both modules were loaded automatically during boot. (Also, I forgot to add that I had updated grub configuration yesterday :) ).
2) I changed the name of the module file:
Code:

root@debian:~# modinfo ehci_hcd
filename:      /lib/modules/3.2.0-4-686-pae/kernel/drivers/usb/host/ehci-hcd.ko
license:        GPL
author:        David Brownell
description:    USB 2.0 'Enhanced' Host Controller (EHCI) Driver
alias:          pci:v*d*sv*sd*bc0Csc03i20*
depends:        usbcore
intree:        Y
vermagic:      3.2.0-4-686-pae SMP mod_unload modversions 686
parm:          log2_irq_thresh:log2 IRQ latency, 1-64 microframes (int)
parm:          park:park setting; 1-3 back-to-back async packets (uint)
parm:          ignore_oc:ignore bogus hardware overcurrent indications (bool)
parm:          hird:host initiated resume duration, +1 for each 75us (int)
root@debian:~#

and rebooted. It appears the module is still being loaded:
Code:

root@debian:~# lsmod | grep usb
usb_storage            35142  0
usbcore              104555  4 ehci_hcd,uhci_hcd,usb_storage
scsi_mod              135037  5 libata,sd_mod,sr_mod,sg,usb_storage
usb_common            12338  1 usbcore
root@debian:~# modinfo ehci_hcd
filename:      /lib/modules/3.2.0-4-686-pae/kernel/drivers/usb/host/ehci-hcd.ko
ERROR: could not get modinfo from 'ehci_hcd': No such file or directory
root@debian:~#

It just can't find the module information since I changed the module name... but somehow it keeps getting loaded... I'm kinda confused here.
FYI:
Code:

root@debian:~# ls /lib/modules/3.2.0-4-686-pae/kernel/drivers/usb/host
ehci-hcd.ko.bkp  hwa-hc.ko  isp116x-hcd.ko  ohci-hcd.ko  r8a66597-hcd.ko  sl811_cs.ko  sl811-hcd.ko  u132-hcd.ko  uhci-hcd.ko  whci  xhci-hcd.ko
root@debian:~#

Or maybe I'm doing something wrong.
Please advise.

gacanepa 01-01-2014 09:51 AM

Update:
I just tried adding the following symlink to /etc/rc2.d:
Code:

root@debian:~# ln -s /etc/init.d/unload-ehci_hcd /etc/rc2.d/K01ehci_hcd
where unload-ehci_hcd contains:
Code:

modprobe -r ehci_hcd
It didn't work either :(.
Up to this point I am beginning to think that maybe the only permanent solution to this would be to recompile the kernel without the ehci_hcd module.

towheedm 01-01-2014 10:34 AM

I forgot to include 'blacklist' in the last code block. It's edited now.

After trying it, neither the ehci_hcd or uhci_hcd drivers were loaded, which meant non of my usb devices worked after rebooting.

Again, the only way I could prevent the ehci_hcd from loading was to also blacklist the uhci_hcd module.

I did rename the ehci module in a VM, which prevented it from loading.

towheedm 01-01-2014 10:47 AM

Renamed echi and rebooted. It was not loaded, but neither was the uhci driver.

Code:

sudo mv /lib/modules/3.2.0-4-686-pae/kernel/drivers/usb/host/ehci-hcd.ko ~/
Reboot and only the usbcore module is loaded.

Checking the kernel sources does not show a direct dependency between the two though.

Interesting, I will check this further.

BTW: Use code tags instead of quote tags for your code. It preserves formatting making it much easier to read.

gacanepa 01-01-2014 12:18 PM

towheedm,
It worked!
This time I didn't rename the module (in the actual sense of the word) but moved it to root's home directory, just like you suggested earlier. Note that I just did this with the ehci_hcd module, not with uhci_hcd - and did not blacklist them in the .conf file inside the /etc/modprobe.d directory.
Then I updated the boot image and rebooted, and now the ehci_hcd module is not loading automatically anymore:
Code:

gacanepa@debian:~$ lsmod | grep usb
usbcore              104555  2 uhci_hcd
usb_common            12338  1 usbcore
gacanepa@debian:~$

I will mark all your posts and syg00's as helpful and this thread as solved. I will still have to check whether I can create the RAID1 device without issues, but that's a completely different story.
Thanks guys!


All times are GMT -5. The time now is 07:36 PM.