Linux kernel driver in use

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:

Читайте также:  Linux build usb driver

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 

Источник

kernel driver in use nouveau

При попытке установить драйвера для видеокарты Nvidia многие сталкивались вот с такой ошибкой:

ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding. Please consult the NVIDIA driver README and your Linux distribution’s documentation for details on how to correctly disable the Nouveau kernel driver. WARNING: The modprobe configuration file to disable Nouveau, /etc/modprobe.d/nvidia-installer-disable-nouveau.conf, is already present. Please be sure you have rebooted your system since that file was written. If you have rebooted, then Nouveau may be enabled for other reasons, such as being included in the system initial ramdisk or in your X configuration file. Please consult the NVIDIA driver README and your Linux distribution’s documentation for details on how to correctly disable the Nouveau kernel driver. ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

Эта ошибка говорит о том что в настоящее время используется драйвер Nouveau и его нужно отключить для установки драйверов Nvidia.
Чтобы не возникало такой проблемы нужно отключить драйвер на начальном этапе загрузки системы. Для этого если система грузится как здесь Ubuntu 9.10 с флешки добавляем в menu.lst nouveau.modeset=0 после этого наш menu.lst будет выглядеть вот так:

Читайте также:  Сколько весят папки линукс

title Start Ubuntu 9.10 from USB DISK
root (cd)
kernel /boot/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper noprompt cdrom-detect/try-usb=true persistent nouveau.modeset=0
initrd /boot/initrd.lz
boot

Следущий шаг удаляем все драйвера Nouveau пишем в терминале:

sudo apt-get purge xserver-xorg-video-nouveau

When installing CUDA in Ubuntu 16.04 by executing cuda_8.0.44_linux.run,

I got the following error message in /var/log/nvidia-installer.log

Then I checked /etc/modprobe.d/nvidia-installer-disable-nouveau.conf and got

Any suggestion to disable Nouveau Kernel Driver?

I found this 2012 discussion but didn’t work for me.

2 Answers 2

According to the NVIDIA developer zone: Create a file

with the following contents:

Regenerate the kernel initramfs:

maybe it is too late ,but hope can help for others. the follow tips worked for ubuntu 16.04 and elementary os 0.4.

remove all nvidia packages ,skip this if your system is fresh installed

install some packages for build kernel:

now block and disable nouveau kernel driver:

WARNING This tutorial could break your system, make sure you backup your system before following the steps.

Installing the Offial nvidia drivers will return an error if the Nouveau kernel driver is currently in use. We will explain how to fix the error and install the official drivers.

At this step we will remove all nvidia related packages.

If you get the following error it means that you never had an nvidia package installed and is ok:

Now install some required dependencies:

now block and disable nouveau kernel driver:

And append the follow lines to the blacklist.conf:

Disable the Kernel nouveau by typing the following commands:

Источник

Kernel drive in use is not Nvidia

I am trying to install NVidia drivers on Linux mg-Ubuntu 3.16.0-45-generic #60~14.04.1-Ubuntu . Here is screen shot from GTK; enter image description here And also in here is from Nvidia settings; enter image description here However when I tried to use Unreal Engine 4 in my Ubuntu graphics are not good. There are lots of weird colors are appearing. Here is image from Unreal Engine; enter image description here Then I go and check lspci and glxinfo whether my nvidia is working correctly or not. And it says that Kernel driver in use: i915

mg@mg-Ubuntu:/.1/Programs/UnrealEngine/UnrealEngine-release/Engine/Binaries/Linux$ lspci -vnn | grep -i VGA -A 1200:02.0 VGA compatible controller [0300]: Intel Corporation 3rd Gen Core processor Graphics Controller [8086:0166] (rev 09) (prog-if 00 [VGA controller]) Subsystem: Lenovo Device [17aa:3912] Flags: bus master, fast devsel, latency 0, IRQ 45 Memory at d3000000 (64-bit, non-prefetchable) [size=4M] Memory at e0000000 (64-bit, prefetchable) [size=256M] I/O ports at 4000 [size=64] Expansion ROM at [disabled] Capabilities: Kernel driver in use: i915 00:14.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller [8086:1e31] (rev 04) (prog-if 30 [XHCI]) Subsystem: Lenovo Device [17aa:3977] Flags: bus master, medium devsel, latency 0, IRQ 41 
mg@mg-Ubuntu:/.1/Programs/UnrealEngine/UnrealEngine-release/Engine/Binaries/Linux$ glxinfo | grep OpenGL | grep renderer OpenGL renderer string: GeForce GT 720M/PCIe/SSE2 

Источник

Читайте также:  Linux повысить приоритет процесса

How to change in use driver linux

I have «radeon» and «amdgpu» drivers installed. I want to switch to amdgpu from radeon but I don’t know how can I do that. lspci -v | grep driver:

Kernel driver in use: radeon 
Kernel modules: radeon, amdgpu 

3 Answers 3

Adding this in for others who come across this; after blacklisting modules you have to update the kernel:

The recommend method will depend on what Linux distribution you are running. But one thing that should work is to blacklist the radeon module from running.

In /etc/modprobe.d , create a new .conf file, and give it the following contents:

Use this command to unload a module:- rmmod modulename in your it will be rmmod radeon.

In order to check loaded module use :- lsmod | grep modulename

In order to prevent them from loading after reboot edit the file /etc/modprobe.d/blacklist (if you are using debian/ubuntu) and add the line

blacklist driver-name

In case of Fedora/Centos/Rhel. Edit file /etc/modprobe.conf and add the following line :-

alias driver-name off

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.12.43529

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

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