How to check drivers in linux

Linux: How to find the device driver used for a device?

If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?

8 Answers 8

Example. I want to find the driver for my Ethernet card:

$ sudo lspci . 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01) $ find /sys | grep drivers.*02:00 /sys/bus/pci/drivers/r8169/0000:02:00.0 

First I need to find coordinates of the device using lspci ; then I find driver that is used for the devices with these coordinates.

I know the OP asked for «drivers being used», but what if the driver is not installed nor being used? How to find out just by the vendorID:productID ? Also, what if it is not a PCI device, and you only see it in lsusb for example?

@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case

#!/bin/bash for f in /sys/class/net/*; do dev=$(basename $f) driver=$(readlink $f/device/driver/module) if [ $driver ]; then driver=$(basename $driver) fi addr=$(cat $f/address) operstate=$(cat $f/operstate) printf "%10s [%s]: %10s (%s)\n" "$dev" "$addr" "$driver" "$operstate" done 
$ ~/what_eth_drivers.sh eth0 [52:54:00:aa:bb:cc]: virtio_net (up) eth1 [52:54:00:dd:ee:ff]: virtio_net (up) eth2 [52:54:00:99:88:77]: virtio_net (up) lo [00:00:00:00:00:00]: (unknown) 

I’d like to find solution which would find also veth and other virtual drivers. IMHO the only solution is to use ethtool or lshw .

sudo lspci -v will show it. like this:

$ sudo lspci -v 00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. . Kernel driver in use: radeon Kernel modules: radeon 

You can also combine it with grep like this:

$ sudo lspci -v | grep -A 20 VGA 

For USB based devices you can see the driver name by using the lsusb command:

And/or you use lshw which enumerates the devices on all buses including USB, PCI, etc so you can see which driver it uses:

FTR: the driver is shown at line titled configuration , for example: configuration: driver=btusb maxpower=100mA speed=12Mbit/s

If you just want to plainly use sysfs and doesn’t want to deal with all these commands which eventually looks inside sysfs anyways, here’s how:

say, what is the module/driver for eth6? «sfc» it is

# ls -l /sys/class/net/eth6/device/driver lrwxrwxrwx 1 root root 0 Jan 22 12:30 /sys/class/net/eth6/device/driver -> ../../../../bus/pci/drivers/sfc 

or better yet.. let readlink resolve the path for you.

# readlink -f /sys/class/net/eth6/device/driver /sys/bus/pci/drivers/sfc 

so. to figure out what are the drivers for all of your network interfaces:

# ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I<> bash -c 'echo -n <> :" " ; basename `readlink -f /sys/class/net/<>/device/driver`' eth0 : tg3 eth1 : tg3 eth10 : mlx4_core eth11 : mlx4_core eth2 : tg3 eth3 : tg3 eth4 : mlx4_core eth5 : mlx4_core eth6 : sfc eth7 : sfc eth8 : sfc eth9 : sfc 

Источник

Читайте также:  How to close port in linux

How do I check the status of my drivers and install them if needed? [duplicate]

I’m trying to learn how to use Ubuntu, but I must say I didn’t have half as many issues with 16 as I have had with 18.04 I’m using a laptop and I’m at a beginner-level. (But I’m willing to learn) And basically I’m having a lot of lag, and perhaps I don’t have the correct drivers. I’d need an easy command to pull up my system info, and then run a check on my drivers and download what’s needed. Proc: AMD e1-1200 APU with Radeon HD graphics x2, Mem: 3.5m total, 1.7g used, 651m free, Swap: 3.6g total, 29m used, 3.6g free CPU MHz: 778.147, CPU max MHz: 1400.0000, CPU min MHz: 777.0000

You’re thinking of apps that run in the Windows environment. I’m not aware of anything similar in the Ubuntu/Linux environment. Maybe, describe more about your «lag» and we might come up with some ideas on how to cure that. Does the lag happen all of the time? Only in one app? When you’re running a VPN? Etc.

I’ll have to read more about the kernal system and the major differences between Linux and Windows, to better understand. But basically, my system is very slow upon installing ubuntu 18.04. Namely, application windows slowly opening, webpages and while trying to play Minecraft. Generally the entire system seems slow.

What processor? What speed? How much RAM/swap? What video subsystem/drivers? Edit your question to show me free -h .

3 Answers 3

This has been answered before but in two parts.

First displaying loaded kernel modules.

Linux (and Ubuntu as well) doesn’t have separate entity as «device drivers», Linux has kernel modules which could be called «drivers» for real or virtual hardware depending on their functionality.

Use lsmod or cat /proc/modules to see list of loaded kernel modules. Also you can see list of all available (installed) kernel modules in system using:

ls -R /lib/modules/`uname -r`/kernel/ 

Next, using Software Sources > Additional Drivers, for installing device drivers, often proprietary.

Unity (15.10 and 15.04/14.04/13.04/14.10/13.10/12.10)

Click on the gear icon on the top right corner of your screen and click on «System Settings» from that menu, click on Software Sources (or you can click on the Ubuntu button and search for «Sources»:

enter image description here

and then on the Additional drivers tab:

Читайте также:  Find grep linux примеры

enter image description here

Source | How do I install additional drivers?

Источник

How can I check if I have any missing or upgradable driver on linux? | DEBIAN 10

Laptop: Asus TUF Gaming FX504GD With lspci for example you can check some hardware, and then you can browse the internet and find the drivers to install. But I would like to know if there is any way to check if you have any missing or upgradable drivers on linux.
I was wondering if there is a program in Linux similar to «DriversCloud» to solve this task. I don’t mind if the software has GUI or not.
I just bought a laptop for studying sysadmin, and I’m having trouble trying to guess which driver I have left to install. Thanks in advance.

The software for Windows you mentioned and so many other promising the same are for the most part scams.

@roaima I’m having particularly a really hard time with the nvidia graphics card. The one I have is GeForce GTX 1050 Mobile. I got this info from lspci command

@GabrielaGarcia I don’t think DriversCloud in particular is a scam. I have used that program for so long time, and I never had problems with it, and worked pretty well.

@GabrielaGarcia I think there is no need to be salty here. It’s simple, I think that software like driverscloud is useful, and I asked if somebody knew if the same kind of software exists for Linux. I just use a software If it’s useful and makes me save time. Simple. And as I said before, I’m having problems with my graphics card in particular, maybe you didn’t read it because you were focused on «keeping the Linux world clean»

2 Answers 2

In the Linux world, the overwhelming majority of drivers is open source and often integrated to the Linux kernel source code once they are of good enough quality, so as long as your kernel version is new enough, you’re probably good. If your kernel is older than your hardware model, you can expect problems.

Some devices may have userspace drivers that won’t need to be integrated in the kernel; if they are open-sourced, most distributions will usually pick them up at an appropriate point of their release cycle.

Desktop-oriented distributions like Ubuntu may already process hardware information in their OS installer and/or package management tools, so the package manager might be able to suggest missing driver packages. Unfortunately, Debian is not quite that automated yet.

Also unfortunately, display drivers tend to be the most significant exception of this: modern GPUs may depend on proprietary drivers to get the full performance out of them, as the development of open-source drivers often depends on reverse engineering, which takes time. But some people may want or even need to use the open-source drivers even at the expense of reduced performance, so Debian (as a strong proponent of open source) tends to default to open-source drivers whenever possible. Ubuntu, on the other hand, will tend towards maximizing functionality whenever possible, even if proprietary drivers are required to do so.

Читайте также:  Command line parser linux

Even so, distributions may have packaged the proprietary drivers for you. For NVidia Geforce GTX 1050 Mobile on Debian 10, you’ll want to make sure the non-free part of Debian repository is enabled, and install the nvidia-graphics-drivers package and its dependencies. If the version in there seems to be too old, the backports repository may have newer versions available sooner than the main distribution includes them. If that’s too old for you, you’ll have to get the bleeding-edge driver directly from NVidia.

For general checking, you seem to already have discovered lspci : add the -v option and it will indicate which driver each PCI(e) device is using. If you find a device with no driver associated with it, you may be missing something — or the device might be the «far» end of a PCI bridge device, which is covered by the pcieport or similar driver at the «near» end.

For USB devices, userspace drivers are way more common. But you could still go through the lsusb listing and ask yourself on each device: «Is this device working to my satisfaction?» If the answer is «yes», you don’t need an update, unless it’s for security reasons — and if you restrict yourself to the packages offered by your distribution and any compatible package repositories, your package manager will automatically know about updates.

For new laptop models, you should Google for keywords «linux» and the model of the laptop, preferably before you actually buy the laptop in question, and look for people reviewing or blogging about their Linux installation and any possible workarounds and experimental drivers that particular model ended up needing for full functionality. You can even find multiples of them and compare their suggestions for a sanity check.

In my opinion, that tends to be more reliable than relying on a mystery third-party website that claims to have all the answers: even though some of such sites may be good now, they may quietly go bankrupt and be sold to or their domain name taken over by a malware pusher with you being none the wiser. The only exception would be if a hardware vendor offers Linux support info for their hardware: then they clearly have a vested interest to ensure their information is both comprehensive and good.

Источник

Оцените статью
Adblock
detector