How to Reinstall USB Mouse Drivers in Ubuntu Using the Command Line

Ubuntu automatically detects and configures mouse and keyboard drivers to work with your system. However, some rare circumstances may require a complete reinstallation of these input device drivers to make them work properly. The system responsible for managing these input drivers is known as the "X.Org Server" (or "xorg"), the X windows system used in Linux. It is the base graphical environment for your computer under Ubuntu. Therefore, reinstallation of the xorg windows environment may be necessary to activate your USB mouse or keyboard.

...
Ubuntu drivers for input devices including mice and keyboards are controlled by the xorg server.

Step

Boot your computer and log in.

Step

Press "CTRL + ALT + F1" simultaneously to gain access to a command-line console. Your screen will turn black and may prompt you for your login information. Log in using the text console if prompted.

Step

Enter the command "sudo apt-get remove --purge xserver-xorg" (without quotes) and hit "Enter." This completely purges the current xorg configuration.

Step

Enter the command "sudo apt-get install xserver-xorg" (without quotes) and hit "Enter." This installs a fresh xorg server.

Step

Reconfigure xorg by entering the command "sudo dpkg-reconfigure xserver-xorg" (without quotes).

Step

Reboot the computer and log in.

Step

Acces a command-line console again (see Step 2).

Step

Enter the command "sudo nano -B /etc/X11/xorg.conf" (without quotes) and hit "Enter." Enter your password at the prompt.

Step

Edit the xorg configuration file to make the following lines look like this:

Step

Option "Device" "/dev/ttyUSBx" (where "x" is the number of the USB port in use) Option "Protocol" "auto"

Step

Hold down the "Ctrl" key and hit "X." Ubuntu will then ask if you want to save the changes you made. Type "Y" and hit "Enter" to save the changes to the xorg configuration file. The USB mouse drivers are now installed.

Step

Enter the command "sudo /etc/init.d/gdm restart" (without quotes) to restart the X server. If your mouse still does not work, continue to Step 12 to undo these changes.

Step

Access a command-line console (see Step 2).

Step

Enter the command "cd /etc/X11" (without quotes), followed by "sudo cp xorg.conf~ xorg.conf" (without quotes). Your changes are now undone. Start over from Step 8 and try substituting a different number for the USB port (i.e., Option "Device" "/dev/ttyUSBx") in Step 9.