News Trending

5 Ways to Fix a Malfunctioning USB Device or Port on Linux

ad+1

fix-linux-usb

You’ve hooked up a USB flash drive, or a keyboard or mouse to your Linux PC. But nothing is happening.

What’s going on? Why won’t your Linux computer detect the device? Is it a Linux thing, or has your USB device stopped working?

USB Not Working in Ubuntu?

USB ports on a laptop

Disk drives, card readers, phones, media players, and media peripherals… they’re all useful, but if there’s a problem with your system’s USB port or drivers, they’re not going to work. This can be particularly frustrating if you use a Bluetooth keyboard (here’s why you shouldn’t) or mouse (with a USB dongle) as it means digging out wired USB alternatives.

However, it might not be the port that doesn’t work. Perhaps the USB device you’re using has developed a fault and cannot be detected.

Dealing with USB issues can be tricky, but it’s not impossible to diagnose a fault and make the necessary fixes.

There are five steps to follow to fix USB issues in Linux:

  1. Confirm the USB port is detected
  2. Make any necessary repairs to the port
  3. Fix or repair USB devices
  4. Reboot your Linux operating system
  5. Confirm the presence of device drivers

Let’s look at each of these in turn and learn how to deal with dodgy USB devices in Linux.

1. Is Your Device Detected by Linux?

The first thing to check upon inserting your USB device in your Linux computer is whether it is being detected. USB device detection is usually not as verbal or audible as it is in Windows or macOS, which means that often you need to check that the device has been picked up by the operating system.

Fortunately, this is simple.

Use the lsusb command in Linux

First, disconnect the USB device you’re querying. Then, open a terminal window and input the “list USB” command:

lsusb

Make a note of the results, then connect the USB device, and run lsusb again.

This time, you should see an extra device listed, with a Bus ID, Device ID, USB ID, and a description. If you can’t work out what the extra device is (you may have an internal USB device, perhaps Ethernet), try a different command.

dmesg | grep -i USB

The dmesg command will list the connected USB devices on your system. It will also include non-USB hardware, and unfortunately offers an overwhelming amount of information. To counter this, you can try

dmesg | less

Finally, you could just rely on the more user-friendly

usb-devices

This is like a cross between the dmesg and lsusb commands, listing connected USB hardware with enough information to identify them.

So, is the USB you’ve connected listed here? If not, then perhaps the port is damaged or there is a problem with the device. Equally, the device may not be compatible with Linux.

2. How to Check Your USB Port

If the USB device isn’t showing, it could be due to an issue with the USB port.

The best way to check this quickly is to simply use a different USB port on the same computer. If the USB hardware is now detected, then you know you have a problem with the other USB port.

If another USB port is not available, you’ll need to try the USB device on another PC or laptop. This may not be ideal, however, as you may only have a Windows or macOS computer as an alternative. As some USB devices cannot be used on Linux it will be difficult to ascertain whether it is the USB device, or the USB port that is causing you problems.

For the best results, where possible stick to Linux-compatible hardware when troubleshooting USB devices. No time to install Linux on another PC? Consider confirming the state of your USB hardware with a low-cost Raspberry Pi Zero instead.

3. Fixing Broken USB Hardware

If your USB hardware is defective, you have two choices: fix or return.

A fix will typically involve checking the USB port, as well as the device that is currently not working. Fixes will almost always center around the USB cable, and the port on your computer. USB cables can usually be replaced, however, while ports can be repaired.

A physical check of USB equipment is a good idea. Cables should be sturdy, without any splits; the plugs should be solid, with the metal section firmly attached.

USB ports, meanwhile, should be checked with your PC switched off, and disconnected from the mains supply. Check the ports are firmly seated; wobbly USB ports are an indication of hardware that is wearing out.

If the USB port is coming loose, you may be able to solder it back into place. Of course, you should already know how to solder; never attempt DIY jobs without prior experience.

Also, check for dust and dirt in your USB ports, especially those around the back of your PC where dust regularly collects. Dust is the enemy of PCs, so it is worth keeping your system in a dust free environment to encourage performance. As dust can work its way into your PC via USB slots, take the time to keep these ports clean. Use a can of compressed air to disperse dust and dirt.

Can you return your USB device? If it’s new, then probably. The problem is, unless it is explicitly labeled as running under Linux, then, the retailer is unlikely to accept a return. You may need to be a little selective with the facts you share with them…

4. Restarting Linux to Fix a USB Port

In some cases—such as if you’re using a laptop—power issues might be affecting its ability to detect USB devices. The autosuspend setting is designed to reduce power usage on Linux laptops, but it can prove counterproductive.

So, what can you do?

First, check whether autosuspend is causing the problem. You can do this by rebooting your computer; if the USB device works, then that USB port is receiving power.

The next step is to ensure this doesn’t happen again. The following command line tricks are for Ubuntu 18.10, so check for the correct procedure on your preferred Linux distribution.

Open a terminal window and input:

cat /sys/module/usbcore/parameters/autosuspend

This should return a value of 2, which means autosuspend is enabled. You can fix this by editing the grub file. Enter:

sudo nano /etc/default/grub

Fix USB power issues in Linux

Here, look for

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change this to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"

Press Ctrl + X to save the file, and exit. Next, update grub:

sudo update-grub

When that completes, restart Ubuntu.

After rebooting, log into your account and enter the cat command again:

cat /sys/module/usbcore/parameters/autosuspend

This time, the value returned should be -1. You’ve disabled autosuspend, so USB devices connected to your laptop should not fail due to power issues.

5. Checking USB Device Drivers on Linux

Once upon a time, USB devices didn’t often work in Linux. Only devices produced by OEMs with an interest in Linux (perhaps they used it for development) would offer a Linux driver.

These days, things are very different, with most manufacturers offering a Linux driver. In most cases, this will already be available in your Linux operating system, via the kernel.  You shouldn’t need to install any USB drivers.

If a driver is unavailable, you’ll probably be able to find it by contacting the USB device manufacturer.

Troubleshooting USB Issues on Linux: Fixed!

With built-in drivers and wide support for many types of USB device, it should be easy to diagnose issues with your computer’s USB hardware.

While broken hardware may need repairing or swapping, software fixes are also available.

If you’ve recently swapped from Windows, running into USB issues on Linux can be a problem. Fortunately, these problems are usually easily solved, helping to make switching to Linux easy!

Read the full article: 5 Ways to Fix a Malfunctioning USB Device or Port on Linux



from MakeUseOf https://ift.tt/2P1DeFr
via IFTTT

0 comments: