Device driver on Linux Guest on 13th September 2020 10:30:10 AM
  1. 1. User interfaces
  2. If you are new to Linux and coming from the Windows or MacOS world, you'll be glad to know that Linux offers ways to see whether a driver is available through wizard-like programs. Ubuntu offers the Additional Drivers option. Other Linux distributions provide helper programs, like Package Manager for GNOME, that you can check for available drivers.
  4. 2. Command line
  5. What if you can't find a driver through your nice user interface application? Or you only have access through the shell with no graphic interface whatsoever? Maybe you've even decided to expand your skills by using a console. You have two options:
  7. Use a repository
  8. This is similar to the homebrew command in MacOS.  By using yum, dnf, apt-get, etc., you're basically adding a repository and updating the package cache.
  9. Download, compile, and build it yourself
  10. This usually involves downloading a package directly from a website or using the wget command and running the configuration file and Makefile to install it. This is beyond the scope of this article, but you should be able to find online guides if you choose to go this route.
  11. Check if a driver is already installed
  12. Before jumping further into installing a driver in Linux, let's look at some commands that will determine whether the driver is already available on your system.
  14. The lspci command shows detailed information about all PCI buses and devices on the system:
  16. $ lscpci
  17. Or with grep:
  19. $ lscpci | grep SOME_DRIVER_KEYWORD
  20. For example, you can type lspci | grep SAMSUNG if you want to know if a Samsung driver is installed.
  22. The dmesg command shows all device drivers recognized by the kernel:
  24. $ dmesg
  25. Or with grep:
  27. $ dmesg | grep SOME_DRIVER_KEYWORD
  28. Any driver that's recognized will show in the results.
  30. If nothing is recognized by the dmesg or lscpi commands, try these two commands to see if the driver is at least loaded on the disk:
  32. $ /sbin/lsmod
  33. and
  35. $ find /lib/modules
  36. Tip: As with lspci or dmesg, append | grep to either command above to filter the results.
  38. If a driver is recognized by those commands but not by lscpi or dmesg, it means the driver is on the disk but not in the kernel. In this case, load the module with the modprobe command:
  40. $ sudo modprobe MODULE_NAME
  41. Run as this command as sudo since this module must be installed as a root user.
  43. Add the repository and install
  44. There are different ways to add the repository through yum, dnf, and apt-get; describing them all is beyond the scope of this article. To make it simple, this example will use apt-get, but the idea is similar for the other options.
  46. 1. Delete the existing repository, if it exists.
  48. $ sudo apt-get purge NAME_OF_DRIVER*
  49. where NAME_OF_DRIVER is the probable name of your driver. You can also add pattern match to your regular expression to filter further.
  51. 2. Add the repository to the repolist, which should be specified in the driver guide.
  53. $ sudo add-apt-repository REPOLIST_OF_DRIVER
  54. where REPOLIST_OF_DRIVER should be specified from the driver documentation (e.g., epel-list).
  56. 3. Update the repository list.
  58. $ sudo apt-get update
  59. 4. Install the package.
  61. $ sudo apt-get install NAME_OF_DRIVER
  62. 5. Check the installation.
  64. Run the lscpi command (as above) to check that the driver was installed successfully.

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.