手掌有痣代表什么| 哏是什么意思| 猪肝能钓什么鱼| 为什么做梦| 南京有什么| 早唐筛查是检查什么| 什么是耽美| 支元体阳性是什么意思| 钊读什么| 环孢素是什么药| 老出虚汗是什么原因| 胃息肉是什么原因引起的| 高铁特等座有什么待遇| kai是什么意思| 美林是什么药| 胸口闷挂什么科| 喉结不明显的男生是什么原因| 脸肿是什么原因| 姝字五行属什么| 感冒为什么会流眼泪| 幼犬可以吃什么| 黄精什么功效| 胃疼适合吃什么食物| 芒果不能和什么水果一起吃| 什么是吸附性义齿| 属虎男和什么属相最配| 乳糖不耐受吃什么奶粉| 鲭鱼是什么鱼| 骨蒸是什么意思| 眼压高吃什么药| 令坦是对方什么人的尊称| 一月四号是什么星座| 人参和什么泡酒壮阳| 窦性心律不齐是什么意思| 为什么右眼皮一直跳| 丁毒豆泡酒能治什么病| 舌系带短会有什么影响| 阴道放屁是什么原因| 额头上长小疙瘩是什么原因| 一月三日是什么星座| 裹小脚是什么时候开始的| 鳞状上皮细胞是什么意思| 寸头适合什么脸型| 通奸是什么意思| 一月27日是什么星座| 阴险表情什么意思| 脚水肿吃什么药| 为什么头会一阵一阵的痛| 什么水果是降火的| 冰粉为什么要加石灰水| 3月15号是什么星座| 小孩咳嗽流鼻涕吃什么药效果好| 堂哥的女儿叫什么| 肛门瘙痒用什么药膏| 为什么冬吃萝卜夏吃姜| 喝栀子茶有什么好处| b型血为什么叫贵族血| 红楼梦为什么叫石头记| 清宫后需要注意什么| 小孩发烧可以吃什么水果| eno什么意思| 身经百战是什么意思| 什么至什么来| 喝什么解辣| 92年的猴是什么命| 猪心炖什么适合孩子| 大步向前走永远不回头是什么歌| 虐恋是什么意思啊| 金銮殿是什么意思| 火车代表什么生肖| 灰指甲什么症状| 凶神宜忌是什么意思| 香赞是什么意思| 总蛋白是什么| hp医学上是什么意思| 为什么说黑鱼是鬼| 人老放屁是什么原因| 盐水洗脸有什么好处| 8月26日什么星座| 明年属相是什么生肖| 五福是什么生肖| abi医学上是什么意思| 空调滴水什么原因| 袋鼠喜欢吃什么食物| 收缩压和舒张压是什么意思| 半夜猫叫有什么预兆| 长期开灯睡觉有什么危害| 莲子心泡水喝有什么功效和作用| 桃胶是什么| 喝茶有什么好处和坏处| 植物神经紊乱用什么药| 喉痹是什么意思| 马吃什么食物| 如泰山前面一个字是什么啊| 朝朝暮暮是什么意思| 女性经常手淫有什么危害| 金牛座前面是什么星座| 今天吃什么菜| 甲状腺毒症是什么意思| 河南有什么市| 莱特兄弟发明了什么| 指数是什么| 膝盖积液用什么药最好| 狗仗人势是什么生肖| 绿豆长什么样| 摩纳哥为什么这么富| 拉肚子后吃什么食物好| 人格的核心是什么| 备孕需要吃什么| 保拉纳啤酒什么档次| 胰腺有什么作用| 天冬与麦冬有什么区别| 瘰疬是什么意思| 盗汗和自汗有什么区别| 嘴唇起泡用什么药| 胆汁反流性胃炎吃什么药| 反应蛋白测定是查什么的| 眉毛下方有痣代表什么| 地藏经适合什么人念| 痰湿瘀阻是什么症状| 做梦梦见鬼是什么预兆| 为什么会得神经性皮炎| 糯米粉做什么好吃| 绿豆吃多了有什么坏处| 送镜子代表什么意思| 什么的坐着| 胃溃疡吃什么药好| giuseppe是什么牌子| 散粉和粉饼有什么区别| 川芎的功效与作用是什么| 妇炎康片主要治什么妇科病| 兔日冲鸡什么意思| 和珅属什么生肖| 一什么金鱼| 艾灸是什么| 什么颜色衣服最防晒| 两脚发热是什么原因| 鱼水之欢是什么意思| 2009年属什么| 三月份生日是什么星座| 青梅是什么水果| 共鸣是什么意思| 梦见包丢了是什么意思| bg文是什么意思| 感染科主要看什么病| 甲功五项能查出什么病| 先兆流产什么意思| 瞌睡是什么意思| 房门什么颜色好看| 每天吃一根黄瓜有什么好处| 苯扎氯铵是什么| 白英别名叫什么| 乙肝145阳性是什么意思| 5月24号是什么星座| 脸上长水泡似的痘痘是什么原因| 烫伤用什么药| 高亢是什么意思| 维生素检查项目叫什么| 低血压头晕吃什么药| 秋葵不适宜什么人吃| iga肾病是什么意思| 脑电图是检查什么的| 小本创业做什么生意好| 2月4号是什么星座| 长闭口是什么原因造成的| 梦见着火是什么预兆| 荔枝不能与什么一起吃| 浪子回头金不换是什么意思| 世界什么名| 梦见青蛙是什么意思| 五月天主唱叫什么名字| 68年属猴的是什么命| 乳腺彩超挂什么科| 无名指是什么经络| 梯是什么意思| 疴是什么意思| 奶粉结块是什么原因| bso是什么意思| 什么是坐骨神经疼有什么症状| 湿厕纸是干什么用的| 碱性磷酸酶高是什么意思| 呈味核苷酸二钠是什么| 嗜碱性粒细胞偏高是什么原因| 置换是什么意思| 眼胀是什么原因| 梦见人头是什么征兆| 李白是什么| 三月份是什么星座的| 牛油果什么时候吃最好| 普惠幼儿园是什么意思| 布偶猫长什么样| 鼻子红是什么原因| 什么水果补气血| 什么是pp材质| 乳腺增生样改变是什么意思| 2333是什么意思啊| 皮疹用什么药膏最好| 立是什么意思| 身上痒但是什么都没有| 眼珠发黄是什么原因| 马弁是什么意思| 农历五月初五是什么节| 慢性阑尾炎挂什么科| 孕妇吃什么水果对胎儿好| 做梦车丢了有什么预兆| 榕字五行属什么| 孕妇什么时候有奶水| 阴囊是什么| 下午五点半是什么时辰| 甲状腺是什么引起的原因| 大便不成形用什么药| 10000是什么电话| 用什么泡脚减肥最快| 白带有血是什么原因| 蜜蜂是什么牌子| 什么东西越热越爱出来| 永恒是什么意思| 清欢渡是什么意思| 什么时候可以领退休金| 天蝎座男是什么性格| 女人喜欢什么类型男人| 阿弥陀佛什么意思| 血糖高喝什么茶| 感冒引起的喉咙痛吃什么药| 腰肌劳损是什么原因引起的| 相宜的意思是什么| 短头发烫什么发型好看| 为什么眼睛会有红血丝| 龙猫是什么动物| 腊月是什么生肖| 什么品牌的笔记本好| 阴虚吃什么好| 观赏是什么意思| c60是什么| 10月7日什么星座| 喝酒为什么会头疼| 私处为什么会发黑| 长白头发是什么原因| 看肛门挂什么科| 吃什么助消化| 琛读什么| sm是什么| 调经吃什么药效果最好| 高考是什么| 生姜什么时候吃最好| 肚子一直咕咕叫是什么原因| 精索静脉曲张是什么原因导致的| 狗吃什么药会立马就死| 什么水果糖分最高| 降钙素原检测是什么| 外强中干是什么意思| 武则天墓为什么不敢挖| 总是头疼是什么原因| 孕妇梦见龙是什么征兆| 心什么肉什么| cd是什么| 喝什么水最解渴| 大便次数少是什么原因| 流鼻子打喷嚏吃什么药| 豇豆是什么| 什么的大娘| 6.30是什么星座| 11月26是什么星座| 千山鸟飞绝的绝是什么意思| 百度
Jump to content

任嘉伦最新写真曝光 笑容迷人尽显轻松姿态

From ArchWiki
(Redirected from Kernel modules)

Kernel modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system.

To create a kernel module, you can read The Linux Kernel Module Programming Guide. A module can be configured as built-in or loadable. To dynamically load or remove a module, it has to be configured as a loadable module in the kernel configuration (the line related to the module will therefore display the letter M).

To rebuild a kernel module automatically when a new kernel is installed, see Dynamic Kernel Module Support (DKMS).

Obtaining information

Usually modules depend on the kernel release and are stored in the /usr/lib/modules/kernel_release/ directory.

Tip Run uname -r (or uname --kernel-release) to get your current kernel release.
Note Module and alias names often use underscores (_) or dashes (-); however, those symbols are interchangeable when using the modprobe command and in configuration files in /etc/modprobe.d/ (automatic conversion to underscores is performed, see modprobe(8) § DESCRIPTION and modprobe.d(5) § DESCRIPTION).

To show what kernel modules are currently loaded:

$ lsmod

To show information about a module:

$ modinfo module_name

To list the options that are set for a loaded module use systool(1) from sysfsutils:

$ systool -v -m module_name

To display the comprehensive configuration of all the modules:

$ modprobe -c | less

To display the configuration of a particular module:

$ modprobe -c | grep module_name

List the dependencies of a module (or alias), including the module itself:

$ modprobe --show-depends module_name

Automatic module loading

Today, all necessary modules loading is handled automatically by udev, so if you do not need to use any out-of-tree kernel modules, there is no need to put modules that should be loaded at boot in any configuration file. However, there are cases where you might want to load an extra module during the boot process, or blacklist another one for your computer to function properly.

Early module loading

Early module loading depends on the initramfs generator used:

Note The initramfs image may not contain the kernel modules asked for in /etc/modules-load.d/, it also may lack the files that have been set in that folder (see #systemd).

systemd

Kernel modules can be explicitly listed in files under /etc/modules-load.d/ for systemd to load them during boot. Each configuration file is named in the style of /etc/modules-load.d/program.conf. Configuration files simply contain a list of kernel modules names to load, separated by newlines. Empty lines and lines whose first non-whitespace character is # or ; are ignored.

/etc/modules-load.d/virtio-net.conf
# Load virtio_net.ko at boot
virtio_net

See modules-load.d(5) for more details.

Manual module handling

Kernel modules are handled by tools provided by the kmod package, which is installed as a dependency of a kernel package. You can use these tools manually. To load a module:

# modprobe module_name
Note If you have upgraded your kernel but have not yet rebooted, modprobe will fail with no error message and exit with code 1, because the path /usr/lib/modules/kernel_release/ no longer exists. Check manually if this path exists when modprobe failed to determine if this is the case.

To load a module by a file name—i.e. one that is not installed in the /usr/lib/modules/kernel_release/ directory—use any of:

# insmod file_name module_options
# modprobe file_name

To unload—remove—a module, use any of:

# rmmod module_name
# modprobe -r module_name
# modprobe --remove module_name

Setting module options

To pass a parameter to a kernel module, you can pass them manually with modprobe or assure certain parameters are always applied using a modprobe configuration file or by using the kernel command line. If the module is built into the kernel, the kernel command line must be used and other methods will not work.

Using modprobe

The basic way to pass parameters to a module is using the modprobe command. Parameters are specified on command line using simple key=value assignments:

# modprobe module_name parameter_name=parameter_value

Using modprobe.d

Configuration files in the /etc/modprobe.d/ directory can be used to pass module settings to udev, which will use modprobe to manage the loading of the modules during system boot. Files in this directory can have any name, given that they end with the .conf extension. The file name matters, see modprobe.d(5) § CONFIGURATION DIRECTORIES AND PRECEDENCE. To show the effective configuration:

$ systemd-analyze cat-config modprobe.d

The syntax is:

/etc/modprobe.d/file_name.conf
options module_name parameter_name=parameter_value
Note All options for a given module must be defined in a single line. New options line with the same module name replaces the previous one.

Multiple module parameters are separated by spaces, in turn a parameter can receive a list of values which is separated by commas:

/etc/modprobe.d/file_name.conf
options module_name param1=value1 param2=value2a,value2b …

For example:

/etc/modprobe.d/thinkfan.conf
# On ThinkPads, this lets the 'thinkfan' daemon control fan speed
options thinkpad_acpi fan_control=1
Note If any of the affected modules is loaded from the initramfs, then you will need to add the appropriate .conf file to FILES in mkinitcpio.conf or use the modconf hook, then regenerate the initramfs to include the .conf file. To see the contents of the default initramfs use lsinitcpio.

Using kernel command line

You can also pass options to the module using the kernel command line. This is the only working option for modules built into the kernel. For all common boot loaders, the following syntax is correct:

module_name.parameter_name=parameter_value

For example:

thinkpad_acpi.fan_control=1

Simply add this to the appropriate line in your boot loader configuration, as described in Kernel parameters#Boot loader configuration.

Aliasing

Aliases are alternate names for a module. For example: alias my-mod really_long_modulename means you can use modprobe my-mod instead of modprobe really_long_modulename. You can also use shell-style wildcards, so alias my-mod* really_long_modulename means that modprobe my-mod-something has the same effect. Create an alias:

/etc/modprobe.d/myalias.conf
alias my-mod really_long_module_name

Aliases can be internal—contained in the module itself. Internal aliases are usually used for #Automatic module loading when it is needed by an application, e.g. when the kernel detects a new device. To see the module internal aliases:

$ modinfo --field=alias module_name

To see both configured and internal aliases:

$ modprobe --showconfig | grep '\<module_name$'

Blacklisting

Blacklisting, in the context of kernel modules, is a mechanism to prevent the kernel module from loading. This could be useful if, for example, the associated hardware is not needed, or if loading that module causes problems: for instance there may be two kernel modules that try to control the same piece of hardware, and loading them together would result in a conflict.

Tip Do not confuse the blacklisting as a generic term with using the blacklist keyword as a blacklisting particular case.

Some modules are loaded as part of the initramfs. mkinitcpio -M will print out all automatically detected modules: to prevent the initramfs from loading some of those modules, blacklist them in a .conf file under /etc/modprobe.d and it shall be added in by the modconf hook during image generation. Running mkinitcpio -v will list all modules pulled in by the various hooks (e.g. filesystems hook, block hook, etc.). Remember to add that .conf file to the FILES array in /etc/mkinitcpio.conf if you do not have the modconf hook in your HOOKS array (e.g. you have deviated from the default configuration), and once you have blacklisted the modules regenerate the initramfs, and reboot afterwards.

Using modprobe.d

alias

Disable an alias by overriding. For example, to prevent Bluetooth module autoloading taking module named off does not exist:

/etc/modprobe.d/modprobe.conf
alias net-pf-31 off
Note Alias overriding can prevent automatic module loading, but will still allow the module to be loaded—both automatically and manually—by another alias or the module name.

blacklist

To disable all internal aliases for a given module use the blacklist keyword. For example, to prevent the pcspkr module from loading on boot to avoid sounds through the PC speaker:

/etc/modprobe.d/nobeep.conf
blacklist pcspkr
Note The blacklist configuration command—as it deals with aliases—has the same drawback as the alias one does: automatic loading can be prevented, but the module still may be loaded manually, or automatically if another module depends on it.

install

There is a workaround for the behaviour described in the #alias and #blacklist notes. The install configuration command instructs modprobe to run a custom command instead of inserting the module in the kernel as normal, so you can simulate the successful module loading with:

/etc/modprobe.d/blacklist.conf
install module_name /bin/true

You can force the module to always fail loading with /bin/false: this will effectively prevent the module—and any other that depends on it—from loading by any means, and a log error message may be produced.

Using kernel command line

Tip This can be very useful if a broken module makes it impossible to boot your system.

You can also blacklist modules from the boot loader boot entry configuration.

Simply add module_blacklist=module_name_1,module_name_2,module_name_3 to your kernel command line, as described in Kernel parameters#Boot loader configuration.

Note
  • When you are blacklisting more than one module, note that they are separated by commas only. Spaces or anything else might presumably break the syntax.
  • module_blacklist will make the kernel completely refuse to load the module.
  • If you only want to prevent implicit loading, but maybe load the module manually later, the correct parameter is modprobe.blacklist=module_name_1,module_name_2,module_name_3. This will however not prevent explicit loads during the boot, e.g. by systemd or other modules.

Another use case for a command line option is to disable hardware-specific components of a module without disabling the module entirely. For example, disabling a microphone while retaining other sound out options. See BBS#303475 for a few examples.

Troubleshooting

Module does not load

In case a specific module does not load and the boot log (accessible by running journalctl -b as root) says that the module is blacklisted, but the directory /etc/modprobe.d/ does not show a corresponding entry, check another modprobe source directory at /usr/lib/modprobe.d/ for blacklisting entries.

A module will not be loaded if the "vermagic" string contained within the kernel module does not match the value of the currently running kernel. If it is known that the module is compatible with the current running kernel the "vermagic" check can be ignored with modprobe --force-vermagic.

Warning Ignoring the version checks for a kernel module can cause a kernel to crash or a system to exhibit undefined behavior due to incompatibility. Use --force-vermagic only with the utmost caution.

See also

1957属什么生肖 自在是什么意思 眼睛吹风就流泪是什么原因 红领巾的含义是什么 zeesea是什么牌子
体检需要带什么 地中海贫血是什么原因引起的 晦气是什么意思 男票是什么意思 民航是什么意思
mpv什么意思 济州岛有什么好玩的 西湖醋鱼用什么鱼 黑上衣配什么颜色裤子男 拜阿司匹林什么时间吃最好
激素药是什么意思 一个白一个本是什么字 喉咙痒想咳嗽吃什么药 海肠是什么 什么时候排卵期
NT是什么钱chuanglingweilai.com 小孩子走神是什么原因beikeqingting.com 大姨妈期间适合吃什么水果hcv9jop5ns3r.cn 土鳖是什么意思hcv8jop9ns3r.cn 嗜什么意思hcv7jop9ns5r.cn
正负得什么hcv9jop1ns9r.cn 软柿子是什么意思hcv8jop3ns0r.cn 戴银镯子对身体有什么好处gangsutong.com 子宫腺肌症是什么原因引起的mmeoe.com 蛋白肉是什么东西做的hcv9jop1ns7r.cn
牛皮和牛皮革有什么区别hcv8jop4ns6r.cn ex什么意思hcv9jop0ns0r.cn 掉头发多是什么原因hcv8jop2ns7r.cn 双鱼座的幸运色是什么颜色hcv7jop9ns2r.cn 红肉是什么肉hcv7jop5ns2r.cn
扬长而去是什么意思hcv7jop5ns6r.cn 梦到前任预示着什么hcv9jop8ns0r.cn jm是什么hcv8jop6ns1r.cn 厚颜无耻是什么意思hcv8jop1ns2r.cn lh是什么激素hcv9jop2ns8r.cn
百度