linuxlinux-kernellinux-device-driver

how to find Linux module path


in the linux, lsmod lists a lot of modules. but how can we find where those module loaded from. for some modules,linux command "modprobe -i" shows a path but some are not.
edited i also tried "find" and "locate". both of them lists all kind of versions

locate fake
/svf/SVDrv/kernel/linux/.fake.ko.cmd
/svf/SVDrv/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv/kernel/linux/.fake.o.cmd
/svf/SVDrv/kernel/linux/fake.ko
/svf/SVDrv/kernel/linux/fake.mod.o
/svf/SVDrv/kernel/linux/fake.o
/svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.ko.cmd
/svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.o.cmd
/svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.ko
/svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.mod.o
/svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.o
/svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.ko.cmd
/svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.o.cmd
/svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.ko
/svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.mod.o
/svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.o
/svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.ko.cmd
/svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.o.cmd
/svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.ko
/svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.mod.o
/svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.o
/svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.ko.cmd
/svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.o.cmd
/svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.ko
/svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.mod.o
/svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.o
/svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.ko.cmd
/svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.mod.o.cmd
/svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.o.cmd
/svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.ko
/svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.mod.o
/svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.o

Solution

  • You can use "locate" or "find" command on these modules to find where they are , for example

    [root@localhost core_src]# lsmod
    Module                  Size  Used by
    iptable_filter          2793  0
    ipt_MASQUERADE          2466  1
    iptable_nat             6158  1
    vmware_balloon          7199  0
    i2c_piix4              12608  0
    i2c_core               31276  1 i2c_piix4
    shpchp                 33482  0
    ext4                  371331  2
    mbcache                 8144  1 ext4
    jbd2                   93312  1 ext4
    sd_mod                 39488  4
    crc_t10dif              1541  1 sd_mod
    sr_mod                 16228  0
    cdrom                  39803  1 sr_mod
    mptspi                 17051  3
    mptscsih               36828  1 mptspi
    mptbase                94005  2 mptspi,mptscsih
    scsi_transport_spi     26151  1 mptspi
    pata_acpi               3701  0
    ata_generic             3837  0
    ata_piix               22846  0
    dm_mirror              14101  0
    dm_region_hash         12170  1 dm_mirror
    dm_log                 10122  2 dm_mirror,dm_region_hash
    dm_mod                 81692  2 dm_mirror,dm_log
    [root@localhost core_src]# locate vmware_balloon
    /lib/modules/2.6.32-279.el6.x86_64/kernel/drivers/misc/vmware_balloon.ko