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

Updated April 17, 2017

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.

Boot your computer and log in.

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.

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

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

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

Reboot the computer and log in.

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

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

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

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

Option "Protocol" "auto"

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.

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.

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

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.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

William Paul Wentzell is a graduate of the University of Texas at Austin, holding bachelor's degrees in English and photojournalism. His work has been published in the New York Times, Deseret News, The Victoria Advocate and The Daily Texan.