17 modifying kernel module behavior through modprobe
show which modules are loaded
[svn@svn ~]$ lsmod
Module Size Used by
nls_utf8 12557 1
isofs 39844 1
fuse 87741 3
binfmt_misc 17468 1
xt_CHECKSUM 12549 1
ipt_MASQUERADE 12678 3
nf_nat_masquerade_ipv4 13412 1 ipt_MASQUERADE
tun 27226 1
[svn@svn ~]$ lsmod
Module Size Used by
nls_utf8 12557 1
isofs 39844 1
fuse 87741 3
binfmt_misc 17468 1
xt_CHECKSUM 12549 1
ipt_MASQUERADE 12678 3
nf_nat_masquerade_ipv4 13412 1 ipt_MASQUERADE
tun 27226 1
[svn@svn ~]$ lsmod | grep e100
e1000 137544 0
show info of particular module
[svn@svn ~]$ modinfo e1000
filename: /lib/modules/3.10.0-514.el7.x86_64/kernel/drivers/net/ethernet/intel/e1000/e1000.ko
version: 7.3.21-k8-NAPI
license: GPL
description: Intel(R) PRO/1000 Network Driver
author: Intel Corporation, <linux.nics@intel.com>
rhelversion: 7.3
parm: RxDescriptors:Number of receive descriptors (array of int)
parm: Speed:Speed setting (array of int)
parm: Duplex:Duplex setting (array of int)
parm: AutoNeg:Advertised auto-negotiation setting (array of int)
===================
we cannot modify parameters of loaded module
[svn@svn ~]$ modprobe -r cdrom
modprobe: FATAL: Module cdrom is in use.
[svn@svn ~]$ modinfo cdrom
filename: /lib/modules/3.10.0-514.el7.x86_64/kernel/drivers/cdrom/cdrom.ko
license: GPL
rhelversion: 7.3
srcversion: BE3BD0D17D080229D55B173
depends:
intree: Y
vermagic: 3.10.0-514.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: D4:88:63:A7:C1:6F:CC:27:41:23:E6:29:8F:74:F0:57:AF:19:FC:54
sig_hashalgo: sha256
parm: debug:bool
parm: autoclose:bool
parm: autoeject:bool
parm: lockdoor:bool
parm: check_media_type:bool
parm: mrw_format_restart:bool
[svn@svn ~]$
=======================
on older linux version to modify parameters there was a file
/etc/modprobe.conf
in RHEL 7 this is no longer the case
[svn@svn modprobe.d]$ man 5 modprobe.d
the only option to verify the module is to reboot
some parameters values are presented in
[svn@svn modprobe.d]$ ls /sys/module/
8250 ip6_tables ppdev
ablk_helper ip6table_security printk
ac97_bus ip6t_REJECT processor
acpi ip6t_rpfilter psmouse
acpiphp ip_set pstore
aesni_intel iptable_filter random
ata_generic iptable_mangle rcupdate
ata_piix iptable_nat rcutree
auth_rpcgss iptable_raw rng_core
battery ip_tables scsi_dh_alua
e1000 137544 0
show info of particular module
[svn@svn ~]$ modinfo e1000
filename: /lib/modules/3.10.0-514.el7.x86_64/kernel/drivers/net/ethernet/intel/e1000/e1000.ko
version: 7.3.21-k8-NAPI
license: GPL
description: Intel(R) PRO/1000 Network Driver
author: Intel Corporation, <linux.nics@intel.com>
rhelversion: 7.3
...
...
...
parm: TxDescriptors:Number of transmit descriptors (array of int)parm: RxDescriptors:Number of receive descriptors (array of int)
parm: Speed:Speed setting (array of int)
parm: Duplex:Duplex setting (array of int)
parm: AutoNeg:Advertised auto-negotiation setting (array of int)
we cannot modify parameters of loaded module
[svn@svn ~]$ modprobe -r cdrom
modprobe: FATAL: Module cdrom is in use.
[svn@svn ~]$ modinfo cdrom
filename: /lib/modules/3.10.0-514.el7.x86_64/kernel/drivers/cdrom/cdrom.ko
license: GPL
rhelversion: 7.3
srcversion: BE3BD0D17D080229D55B173
depends:
intree: Y
vermagic: 3.10.0-514.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: D4:88:63:A7:C1:6F:CC:27:41:23:E6:29:8F:74:F0:57:AF:19:FC:54
sig_hashalgo: sha256
parm: debug:bool
parm: autoclose:bool
parm: autoeject:bool
parm: lockdoor:bool
parm: check_media_type:bool
parm: mrw_format_restart:bool
[svn@svn ~]$
=======================
on older linux version to modify parameters there was a file
/etc/modprobe.conf
in RHEL 7 this is no longer the case
[svn@svn modprobe.d]$ man 5 modprobe.d
in order to change parameter we created a file
[svn@svn modprobe.d]$ cat cdrom.conf
options cdrom lockdoor=0
some parameters values are presented in
[svn@svn modprobe.d]$ ls /sys/module/
8250 ip6_tables ppdev
ablk_helper ip6table_security printk
ac97_bus ip6t_REJECT processor
acpi ip6t_rpfilter psmouse
acpiphp ip_set pstore
aesni_intel iptable_filter random
ata_generic iptable_mangle rcupdate
ata_piix iptable_nat rcutree
auth_rpcgss iptable_raw rng_core
battery ip_tables scsi_dh_alua
[svn@svn modprobe.d]$ dmesg | grep -P5 cdrom
[ 3.189840] [drm] Initialized vmwgfx 2.10.0 20160210 for 0000:00:0f.0 on minor 0
[ 3.224905] ata2.00: ATAPI: VMware Virtual IDE CDROM Drive, 00000001, max UDMA/33
[ 3.230845] ata2.00: configured for UDMA/33
[ 3.232809] scsi 2:0:0:0: CD-ROM NECVMWar VMware IDE CDR10 1.00 PQ: 0 ANSI: 5
[ 3.267043] sr 2:0:0:0: [sr0] scsi3-mmc drive: 1x/1x writer dvd-ram cd/rw xa/form2 cdda tray
[ 3.267050] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 3.267339] sr 2:0:0:0: Attached scsi CD-ROM sr0
[ 3.582770] e1000 0000:02:01.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:e7:8e:ec
[ 3.582787] e1000 0000:02:01.0 eth0: Intel(R) PRO/1000 Network Connection
[ 3.783944] SGI XFS with ACLs, security attributes, no debug enabled
[ 3.786122] XFS (dm-0): Mounting V5 Filesystem
[svn@svn modprobe.d]$
[ 3.189840] [drm] Initialized vmwgfx 2.10.0 20160210 for 0000:00:0f.0 on minor 0
[ 3.224905] ata2.00: ATAPI: VMware Virtual IDE CDROM Drive, 00000001, max UDMA/33
[ 3.230845] ata2.00: configured for UDMA/33
[ 3.232809] scsi 2:0:0:0: CD-ROM NECVMWar VMware IDE CDR10 1.00 PQ: 0 ANSI: 5
[ 3.267043] sr 2:0:0:0: [sr0] scsi3-mmc drive: 1x/1x writer dvd-ram cd/rw xa/form2 cdda tray
[ 3.267050] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 3.267339] sr 2:0:0:0: Attached scsi CD-ROM sr0
[ 3.582770] e1000 0000:02:01.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:e7:8e:ec
[ 3.582787] e1000 0000:02:01.0 eth0: Intel(R) PRO/1000 Network Connection
[ 3.783944] SGI XFS with ACLs, security attributes, no debug enabled
[ 3.786122] XFS (dm-0): Mounting V5 Filesystem
[svn@svn modprobe.d]$
Comments
Post a Comment