pcimodules and lspci not working alternative solution

pcimodules no longer works it produces nothing probably because the format of /sys/bus/pci is different.

lspci -k doesn't work on older lspci versions.

pciutils can be compiled but it won't work if you have an old system and compile on a newer glibc.

iteriate through /sys/bus/pci/devices/*/modalias

cat /sys/bus/pci/devices/*/modalias
pci:v00008086d00001237sv00000000sd00000000bc06sc00i00
pci:v00008086d00007000sv00000000sd00000000bc06sc01i00
pci:v00008086d00007111sv00000000sd00000000bc01sc01i8A
pci:v000080EEd0000BEEFsv00000000sd00000000bc03sc00i00
pci:v00008086d0000100Esv00008086sd0000001Ebc02sc00i00
pci:v000080EEd0000CAFEsv00000000sd00000000bc08sc80i00
pci:v00008086d00002415sv00008086sd00000000bc04sc01i00
pci:v0000106Bd0000003Fsv00000000sd00000000bc0Csc03i10
pci:v00008086d00007113sv00000000sd00000000bc06sc80i00




compare it to /lib/modules/4.4.98/modules.alias
pci:v00008086d00001237sv00000000sd00000000bc06sc00i00
the part we care about is:
8086d00001237 (note I now truncate more of the end so try again removing the 7 or even the 73 at the end to be more inclusive or you will have a lower success rate).


cat /lib/modules/4.4.98/modules.alias|grep 8086d0000123
alias pci:v00008086d00001234sv*sd*bc*sc*i* pata_mpiix
alias pci:v00008086d00001230sv*sd*bc*sc*i* pata_oldpiix
alias pci:v00008086d00001234sv*sd*bc*sc*i* piix
alias pci:v00008086d00001230sv*sd*bc*sc*i* piix

So bash to the rescue!

iteriate through /sys/bus/pci/devices/*/modalias

compare it to /lib/modules/4.4.98/modules.alias

 bash script that I use in my init

#use this code to do the same thing as pcimodules
for device in `ls -1 /sys/bus/pci/devices/`; do
   device=`cat /sys/bus/pci/devices/$device/modalias`
    #specifying 9:11 or 9:14 with 9:11 being less restrictive and presenting more options
    #9:14 drills down and is more strict giving you less chance of getting the wrong driver
   alias=${device:9:14}
   kernversion=`uname -r`
   module=`cat /lib/modules/$kernversion/modules.alias|grep $alias|awk '{print $3}'`
   if [ ! -z "$module" ]; then
     for mod in $module; do
     echo "module for $device $alias =$module"
     modprobe $module
     done
     else
     echo "No module found for $device $alias"
   fi
done


Tags:

pcimodules, lspci, solutionpcimodules, produces, format, sys, pci, doesn, versions, pciutils, compiled, compile, newer, glibc, iteriate, devices, modalias, sv, bc, sc, eed, beefsv, esv, ebc, cafesv, bd, fsv, csc, lib, modules, alias, truncate, removing, inclusive, grep, pata_mpiix, pata_oldpiix, piix, bash, init, ls, specifying, restrictive, presenting, drills, strict, kernversion, uname, module, awk, z, quot, mod, echo, modprobe, fi,

Latest Articles

  • How to install Windows or other OS and then bring to another computer by using a physical drive and Virtual Machine with QEMU
  • PXE-E23 Error BOOTx64.EFI GRUB booting is 0 bytes tftp pxe dhcp solution NBP filesize is 0 Bytes
  • vagrant install on Debian Mint Ubuntu Linux RHEL Quick Setup Guide Tutorial
  • RHEL 8 CentOS 8, Alma Linux 8, Rocky Linux 8 System Not Booting with RAID or on other servers/computers Solution for dracut and initramfs missing kernel modules
  • How to Upgrade to Debian 11 from Version 8,9,10
  • Ubuntu Linux Mint Debian Redhat Cannot View Files on Android iPhone USB File Transfer Not Working Solution
  • Virtualbox Best Networking Mode In Lab/Work Environment without using NAT Network or Bridged
  • debootstrap how to install Ubuntu, Mint, Debian install
  • Linux grub not using UUID for the root device instead it uses /dev/sda1 or other device name solution
  • How To Restore Partition Table on Running Linux Mint Ubuntu Debian Machine
  • Debian Ubuntu apt install stop daemon questions/accept the default action without prompting
  • iptables NAT how to enable PPTP in newer Debian/Ubuntu/Mint Kernels Linux
  • Grandstream Phone Vulnerability Security Issue Remote Backdoor Connection to 207.246.119.209:3478
  • Linux How to Check Which NIC is Onboard eth0 or eth1 Ubuntu Centos Debian Mint
  • VboxManage VirtualBox NAT Network Issues Managment Troubleshooting
  • Dell PowerEdge Server iDRAC Remote KVM/IP Default Username, Password Reset and Login Information Solution
  • Nvidia Tesla GPUs K40/K80/M40/P40/P100/V100 at home/desktop hacking, cooling, powering, cable solutions Tutorial AIO Solutions
  • Stop ls in Linux Debian Mint CentOS Ubuntu from applying quotes around filenames and directory names
  • Thunderbird Attachment Download Error Corrupt Wrong filesize of 29 or 27 bytes Solution
  • Generic IP Camera LAN Default IP Settings DVR