The perl and sh scripts at the end of this post seems to work on both CentOS 7 and Ubuntu 18.04 LTS to list drivers missing from the normal CentOS 8 kernels. (The latter is much slower.) Please let me know if you encounter problems with it.
Example run on an IBM x3455 7984
Code: Select all
find_centos8_needs_elrepo.pl -
Checking this machine for drivers missing from CentOS 8 but present in ElRepo
Getting Device ID list from http://elrepo.org/tiki/DeviceIDs
Getting pci IDs and long names from lspci
Checking pci and device IDs from lspci -n, listing only those in ElRepo
00:02.1 1166:0214 kmod-pata pci IDE interface: Broadcom BCM5785 [HT1000] IDE
02:01.0 14E4:1648 kmod-tg3 pci Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5704 Gigabit Ethernet (rev 10)
02:01.1 14E4:1648 kmod-tg3 pci Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5704 Gigabit Ethernet (rev 10)
06:00.0 8086:10B9 kmod-e1000e pci Ethernet controller: Intel Corporation 82572EI Gigabit Ethernet Controller (Copper) (rev 06)
Done
Example run on a Dell PowerEdge T310
Code: Select all
find_centos8_needs_elrepo.pl -
Checking this machine for drivers missing from CentOS 8 but present in ElRepo
Getting Device ID list from http://elrepo.org/tiki/DeviceIDs
Getting pci IDs and long names from lspci
Checking pci and device IDs from lspci -n, listing only those in ElRepo
02:00.0 14E4:163B kmod-bnx2 pci Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme II BCM5716 Gigabit Ethernet (rev 20)
02:00.1 14E4:163B kmod-bnx2 pci Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme II BCM5716 Gigabit Ethernet (rev 20)
03:00.0 1000:0060 kmod-megaraid_sas pci RAID bus controller: Broadcom / LSI MegaRAID SAS 1078 (rev 04)
06:08.0 1000:0030 kmod-mptspi pci SCSI storage controller: Broadcom / LSI 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev c1)
Done
Example run on a Dell PowerEdge T630
Code: Select all
find_centos8_needs_elrepo.pl -
Checking this machine for drivers missing from CentOS 8 but present in ElRepo
Getting Device ID list from http://elrepo.org/tiki/DeviceIDs
Getting pci IDs and long names from lspci
Checking pci and device IDs from lspci -n, listing only those in ElRepo
01:00.0 8086:1521 kmod-igb pci Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
01:00.1 8086:1521 kmod-igb pci Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
03:00.0 1000:005D kmod-megaraid_sas pci RAID bus controller: Broadcom / LSI MegaRAID SAS-3 3108 [Invader] (rev 02)
82:00.0 8086:1521 kmod-igb pci Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
82:00.1 8086:1521 kmod-igb pci Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
Done
Apparently CentOS 8's default kernel is missing key drivers on every single machine I use, notably the storage and ethernet drivers. So only the most dispensable pieces /s. Thanks a lot Red Hat!
Code: Select all
#!/usr/bin/perl
#Name: find_centos8_needs_elrepo.pl
#version: 1.0.0
#Date: 2020-03-10
#Author: David Mathog
#
# list any ElRepo drivers needed to install CentOS 8 on this system
#
# assumes wget, lspci, and access to the internet are both available
# If access is not available specify one parameter to the already downloaded
# file.
#
#
use strict;
use warnings;
my $IDLIST="http://elrepo.org/tiki/DeviceIDs";
my %id_hash_driver;
my %id_hash_type;
my %pci_hash_longname;
my $count=0;
my $real_filename="/tmp/fcne_DeviceIDsFile";
my $num_args = $#ARGV;
if ($num_args != 0) {
print
"Usage: find_centos8_needs_elrepo.pl DeviceIDsFile\n\n",
"If internet access is available let DeviceIDsFile = \"-\" and it will be downloaded\n",
"automatically. Otherwise on some machine do:\n\n",
" wget -O DeviceIDsFile $IDLIST\n\n",
"Then copy that file by some means to the target and specify\n",
"the file name on the command line.\n";
exit;
}
my $filename=$ARGV[0];
if($filename eq '-'){
my $messages = `wget -q -O $real_filename $IDLIST 2>/dev/null`;
if($messages){
print
"Some problem running:\n\n",
" wget -q -O $real_filename 2>/dev/null\n\n",
"returned:\n",
"$messages\n";
exit;
}
}
else {
$real_filename = $filename;
}
open(FH, $real_filename) or die "could not open file $real_filename";
print "Checking this machine for drivers missing from CentOS 8 but present in ElRepo\n";
print "Getting Device ID list from $IDLIST\n";
while (my $line = <FH>){
chomp $line;
if($line =~ /\skmod-/){
my ($dev_type, $dev_id, $dev_driver) = split(/\s+/,$line);
$dev_id = uc $dev_id;
$id_hash_driver{$dev_id}=$dev_driver;
$id_hash_type{$dev_id}=$dev_type;
}
}
close(FH);
print "Getting pci IDs and long names from lspci\n";
foreach my $line (`lspci`){
chomp $line;
my $starts = index($line," ");
my $pci_id = uc substr($line,0,$starts);
my $ln = substr($line,$starts+1);
$pci_hash_longname{$pci_id}=$ln;
}
print "Checking pci and device IDs from lspci -n, listing only those in ElRepo\n";
foreach my $line (`lspci -n`){
chomp $line;
my ($pci_id, $ignore, $dev_id)= split /\s/,$line;
$dev_id = uc $dev_id;
if(defined($id_hash_driver{$dev_id})){
$count++;
print "$pci_id $dev_id $id_hash_driver{$dev_id} $id_hash_type{$dev_id} $pci_hash_longname{$pci_id}\n";
}
}
if(!$count){
print "none found\n";
}
if($filename eq "-"){
unlink($real_filename);
}
print "Done\n";
Here is another version which uses /bin/sh instead of perl. It is much slower but may be able to run in busybox or other similar limited environment, so long as /tmp is present and lscpi is also present.
Code: Select all
#!/bin/sh
#Name: find_centos8_needs_elrepo.sh
#version: 1.0.0
#Date: 2020-03-17
#Author: David Mathog
#
# list any ElRepo drivers needed to install CentOS 8 on this system
#
# assumes wget, lspci, and access to the internet are available
# If access is not available specify one parameter to the already downloaded
# file.
#
# Derived from find_centos8_needs_elreop.pl. Instead of using hashes it makes file
# names under /tmp/fcne_tmp. Slower than the perl version but should be able to run
# even under busybox, assuming lscpi is also present.
#
IDLIST="http://elrepo.org/tiki/DeviceIDs"
count=0
real_filename="/tmp/fcne_DeviceIDsFile"
tmpdir="/tmp/fcne_tmp"
id_hash_type="$tmpdir/id_hash_type"
id_hash_driver="$tmpdir/id_hash_driver"
pci_hash_longname="$tmpdir/pci_hash_longname"
if [ $# != 1 ]
then
echo "Usage: find_centos8_needs_elrepo.sh DeviceIDsFile"
echo ""
echo "If internet access is available let DeviceIDsFile = \"-\" and it will be downloaded"
echo "automatically. Otherwise on some machine do:"
echo ""
echo " wget -O DeviceIDsFile $IDLIST"
echo ""
echo "Then copy that file by some means to the target and specify"
echo "the file name on the command line."
exit
fi
filename=$1;
if [ "$filename" = "-" ]
then
wmessages=`wget -q -O $real_filename $IDLIST 2>/dev/null`
if [ $wmessages ]
then
echo "Some problem running:"
echo ""
echo " wget -q -O $real_filename 2>/dev/null"
echo ""
echo "returned:"
echo "$wmessages"
exit;
fi
else
real_filename=$filename;
fi
if [ -d $tmpdir ]
then
rm -rf $tmpdir
fi
mkdir -p $tmpdir
mkdir -p $id_hash_type
mkdir -p $id_hash_driver
mkdir -p $pci_hash_longname
echo "Checking this machine for drivers missing from CentOS 8 but present in ElRepo"
echo "Getting Device ID list from $IDLIST"
#avoid arrays so this can work with ash, sh, bash
grep '[[:blank:]]kmod-' $real_filename | tr -d '\r' | while read line;
do
dev_type=`echo $line | cut -d ' ' -f1`
dev_id=`echo $line | cut -d ' ' -f2`
dev_driver=`echo $line | cut -d ' ' -f3`
echo -n $dev_type > $id_hash_type/$dev_id
echo -n $dev_driver > $id_hash_driver/$dev_id
done
echo "Getting pci IDs and long names from lspci"
lspci | while read line;
do
pci_id=`echo $line | cut -d ' ' -f1 | tr '[:lower:]' '[:upper:]'`
ln=`echo $line | cut -d ' ' -f2-`
dev_driver=`echo $line | awk '{ print $3 }'`
echo -n $ln > $pci_hash_longname/$pci_id
done
echo "Checking pci and device IDs from lspci -n, listing only those in ElRepo"
lspci -n | while read line;
do
pci_id=`echo $line | cut -d ' ' -f1 | tr '[:lower:]' '[:upper:]'`
dev_id=`echo $line | cut -d ' ' -f3 | tr '[:lower:]' '[:upper:]'`
if [ -f $id_hash_driver/$dev_id ]
then
count=`expr $count + 1`
ihd=`cat $id_hash_driver/$dev_id`
iht=`cat $id_hash_type/$dev_id`
phl=`cat $pci_hash_longname/$pci_id`
echo "$pci_id $dev_id $ihd $iht $phl"
fi
done
if [ ! $count ]
then
echo "none found"
fi
#clean up
if [ "$filename" = "-" ]
then
rm -f $real_filename
fi
rm -rf $tmpdir
echo "Done"
edit: minor change in perl script, added sh script.