How do I find the version of a kernel module (*.ko files located in /lib/modules/… directory) in Linux server?
You need to use the modinfo command to display information about a Linux Kernel module. The syntax is as follows:
modinfo Module-Name-Here
To list loaded modules, enter:
# lsmod
# lsmod | less
Sample outputs:
Module Size Used by sha1_generic 1759 4 ppp_mppe 5240 2 ppp_async 6245 1 crc_ccitt 1323 1 ppp_async ppp_generic 19291 6 ppp_mppe,ppp_async slhc 4003 1 ppp_generic aes_x86_64 7340 0 aes_generic 25714 1 aes_x86_64 hidp 11083 1 vmnet 37057 13 vmblock 10462 1 vsock 35775 0 vmci 46596 1 vsock vmmon 64195 0 parport_pc 18855 0 ppdev 5030 0 lp 7462 0 acpi_cpufreq 5571 1 cpufreq_stats 2659 0 parport 27954 3 parport_pc,ppdev,lp cpufreq_userspace 1992 0 cpufreq_conservative 5162 0 vboxnetadp 4683 0 cpufreq_powersave 902 0 vboxnetflt 15920 0 vboxdrv 1749361 2 vboxnetadp,vboxnetflt sco 7225 2 bridge 39662 0 stp 1440 1 bridge bnep 9443 2 rfcomm 29629 8 l2cap 24736 21 hidp,bnep,rfcomm uinput 6376 1 binfmt_misc 6447 1 fuse 50940 1 loop 11799 0 firewire_sbp2 11530 0 btusb 9913 4 bluetooth 41843 10 hidp,sco,bnep,rfcomm,l2cap,btusb snd_hda_codec_idt 42513 1 arc4 1274 4 snd_hda_intel 20051 1 pcmcia 19474 0 snd_hda_codec 54244 2 snd_hda_codec_idt,snd_hda_intel ecb 1841 4 snd_hwdep 5380 1 snd_hda_codec snd_pcm 60503 2 snd_hda_intel,snd_hda_codec snd_seq 42913 0 snd_timer 15582 2 snd_pcm,snd_seq snd_seq_device 4493 1 snd_seq iwlagn 73171 0 iwlcore 77938 1 iwlagn snd 46542 10 snd_hda_codec_idt,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_seq,snd_timer,snd_seq_device soundcore 4598 1 snd yenta_socket 19115 1 tifm_7xx1 3850 0 joydev 8459 0 mac80211 137516 2 iwlagn,iwlcore rsrc_nonstatic 7294 1 yenta_socket dell_laptop 1985 0 snd_page_alloc 6265 2 snd_hda_intel,snd_pcm tifm_core 4356 1 tifm_7xx1 nvidia 10484934 57 cfg80211 101656 3 iwlagn,iwlcore,mac80211 pcmcia_core 24118 3 pcmcia,yenta_socket,rsrc_nonstatic rfkill 13060 5 bluetooth,dell_laptop,cfg80211 video 17445 0 output 1692 1 video i2c_i801 7830 0 i2c_core 15835 2 nvidia,i2c_i801 psmouse 49937 0 evdev 7352 22 serio_raw 3752 0 pcspkr 1699 0 dcdbas 5048 1 dell_laptop wmi 4323 0 processor 29951 9 acpi_cpufreq ac 2192 0 battery 4998 0 button 4650 0 ext4 288478 1 mbcache 5050 1 ext4 jbd2 67079 1 ext4 crc16 1319 2 l2cap,ext4 sg 24085 0 sd_mod 29937 3 sr_mod 12602 0 crc_t10dif 1276 1 sd_mod cdrom 29415 1 sr_mod hid_apple 4594 0 usbhid 33324 0 hid 63273 3 hidp,hid_apple,usbhid sdhci_pci 5581 0 sdhci 13982 1 sdhci_pci mmc_core 45798 1 sdhci ahci 32534 2 firewire_ohci 19692 0 tg3 95695 0 firewire_core 36880 2 firewire_sbp2,firewire_ohci ehci_hcd 32129 0 crc_itu_t 1307 1 firewire_core led_class 2433 2 iwlcore,sdhci libata 133680 1 ahci libphy 14054 1 tg3 scsi_mod 126597 5 firewire_sbp2,sg,sd_mod,sr_mod,libata thermal 11674 0 usbcore 122450 4 btusb,usbhid,ehci_hcd nls_base 6377 1 usbcore thermal_sys 11942 3 video,processor,thermal
To find out version and other information about tg3 driver / module, enter:
# modinfo tg3 | less
# modinfo tg3 | grep -i version
Sample outputs:
version: 3.102 srcversion: 29B86B4EFF2E078A71F716A vermagic: 2.6.32-5-amd64 SMP mod_unload modversions
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 3 comments so far... add one ↓
🐧 3 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi, can we know the version of the module without actually loading it?
actually if i have an rpm and i want to check the actual version of the module, lets say by extracting the rpm and then using the .ko file present in it to check the version.
modinfo can be given a .ko file as the argument to report on.
#modinfo /tmp/nvme.ko
filename: /tmp/nvme.ko
version: 1.2.4.3.g8fae4.dirty
license: GPL
author: Matthew Wilcox
rhelversion: 7.1
srcversion: D957B45525BC530B7E1F93C
alias: pci:v*d*sv*sd*bc01sc08i02*
depends:
vermagic: 3.10.0-229.el7.x86_64 SMP mod_unload modversions
parm: admin_timeout:timeout in seconds for admin commands (byte)
parm: io_timeout:timeout in seconds for I/O (byte)
parm: retry_time:time in seconds to retry failed I/O (byte)
parm: shutdown_timeout:timeout in seconds for controller shutdown (byte)
parm: nvme_major:int
parm: nvme_char_major:int
parm: use_threaded_interrupts:int
Hi,
thank you!