Ubuntu 16.04下USB鼠标失效,执行sudo rmmod usbhid报错如何解决?
Hey there, let's work through this USB mouse issue step by step. Since it works perfectly in Windows, we can rule out hardware failure—so the problem is definitely with Ubuntu's USB/HID subsystem. Let's start with the basics:
First, check if Ubuntu even detects your mouse
Open a terminal and run:lsusbLook for an entry that matches your mouse (it might say something like "USB Optical Mouse" or the brand name). If you don't see it, try plugging it into a different USB port (preferably a USB 2.0 port, since 16.04 can have quirks with USB 3.0 sometimes) and run the command again.
Verify HID module status (since
usbhidisn't loaded)
The error tells ususbhidisn't active, but let's check related modules that might be handling your mouse:lsmod | grep hidYou should see modules like
hid_generic,hid_microsoft(if it's a Microsoft mouse), or other brand-specific HID modules. Ifusbhidis missing entirely, let's try loading it manually:sudo modprobe usbhidAfter running this, wiggle your mouse—does it start working? If yes, we can make sure it loads automatically on boot by adding it to
/etc/modules:echo "usbhid" | sudo tee -a /etc/modulesCheck system logs for USB/HID errors
If loadingusbhiddoesn't fix it, let's dig into the kernel logs to find clues. Run:dmesg | grep -i usbOr narrow it down to HID-specific messages:
dmesg | grep -i hidLook for lines with words like
error,fail,unable, ordisconnectrelated to your mouse. For example, you might see a message about a failed HID descriptor or USB device reset.Disable USB auto-suspend (a common culprit)
Ubuntu 16.04 sometimes enables USB auto-suspend to save power, which can break certain peripherals. Let's disable it:- Open the GRUB config file:
sudo nano /etc/default/grub - Find the line starting with
GRUB_CMDLINE_LINUXand addusbcore.autosuspend=-1inside the quotes. It should look something like:GRUB_CMDLINE_LINUX="quiet splash usbcore.autosuspend=-1" - Save the file (Ctrl+O, then Enter) and exit (Ctrl+X).
- Update GRUB and reboot:
sudo update-grub sudo reboot
After rebooting, test your mouse again.
- Open the GRUB config file:
Try resetting the USB subsystem
If all else fails, you can reset the entire USB stack without rebooting:sudo echo 0 > /sys/bus/usb/devices/usb1/power/autosuspend sudo echo 1 > /sys/bus/usb/devices/usb1/power/level sudo echo 0 > /sys/bus/usb/devices/usb1/power/level(Note: If
usb1doesn't work, tryusb2orusb3—you can list USB buses withls /sys/bus/usb/devices/.)
Give these steps a shot one by one, and let me know if any of them get your mouse working again!
内容的提问来源于stack exchange,提问作者7k7

