半夜容易醒是什么原因| otto是什么意思| 为什么端午安康| 指甲上有竖条纹是什么原因| 献血有什么坏处| 三七粉什么时间喝好| 有结石不能吃什么东西| 螃蟹喜欢吃什么| 骨关节疼痛什么原因| 伊始什么意思| 腹部胀痛什么原因| 什么的小花| 高密度脂蛋白胆固醇偏低是什么意思| 放电是什么意思| 桦树茸的功效主治什么病| 冰清玉洁是什么意思| 气血不足什么引起的| 什么样的晚霞| 为什么不能送手表| 被蜈蚣咬了用什么药| 吃什么能排毒体内毒素| 男性阴囊瘙痒是什么病| 套餐是什么意思| 妥协是什么意思| 男大女6岁有什么说法| 女性尿道炎挂什么科| 胆囊结石会引起身体什么症状| 胸膜炎吃什么药好| 月子里生气有什么危害| 恍恍惚惚什么意思| 嘉兴有什么大学| 头孢全名叫什么| 什么叫亚健康| br什么意思| 眼屎多吃什么药| 2b铅笔和hb铅笔有什么区别| 鼻炎用什么药| 大腿根部痛是什么原因| 医院脱毛挂什么科| 通风什么征兆| 浠字五行属什么| 直接胆红素偏高是什么原因| 所不欲勿施于人是什么意思| 旻字五行属什么| 急性湿疹用什么药膏| 有什么别有病| 背部疼痛挂什么科| 大姐大是什么意思| 病毒四项检查都有什么| 藏红花适合什么样的人喝| hpv是什么意思啊| 女人吃什么越来越年轻| 荨麻疹是什么原因引起的| carnival手表什么牌子| 牛骨头炖什么好吃| 溃疡用什么药| 什么地什么| 高血压药什么时候吃最好| 指甲有白点是缺什么| 正因数是什么| 红花对什么| 雪燕有什么功效| 安利什么意思| 膀胱不充盈什么意思| 十月一日什么星座| 牙膏什么牌子好| 梦见自己丢钱了什么征兆| 强的松又叫什么| 有事钟无艳无事夏迎春是什么意思| 财星是什么意思| 脖子有痣代表什么意思| 养精蓄锐是什么意思| 女人梦见蛇缠身是什么预兆| 一月23号是什么星座| 血脂高是什么原因引起| 为什么会一直打嗝| blacklabel是什么牌子| 胃火重口臭吃什么药好| 睡醒手麻是什么原因引起的| 梦见已故老人是什么预兆| 什么食物养胃| 产后腰疼是什么原因| 莽是什么意思| 什么是对偶句| 胃胀气打嗝吃什么药| 下午8点是什么时辰| 小儿麻痹什么症状| 吃了兔子肉不能吃什么| 孕妇缺铁性贫血对胎儿有什么影响| 肉刺长什么样子图片| 脸浮肿是什么原因| 罗勒是什么| 做一半就软了是什么原因| 卡路里什么意思| 昧是什么意思| 大便细是什么原因| 睡美人最怕什么| 甲状腺吃什么药| 什么叫做基本工资| udv女鞋是什么牌子| 脑癌是什么原因引起的| 感冒适合吃什么水果| 小孩睡觉流鼻血是什么原因引起的| 白天不懂夜的黑什么意思| 电是什么时候发明的| 情妇是什么意思| 多肉是什么| 铊是什么东西| 应用心理学是什么| 佛系是什么意思啊| 术后病人吃什么营养恢复快| 为什么会湿气重| 排恶露吃什么药| 嗓子哑了吃什么药好| 雅五行属什么| 阴道里面有个肉球是什么| 晚上吃什么有助于减肥| 菠菜吃多了有什么害处| 点滴是什么意思| 咳嗽吃什么水果| 甲亢是什么原因造成的| 嘴苦嘴臭什么原因| 子宫有问题有什么症状| 透明的剑是什么剑| 以身相许是什么意思| 多囊为什么要吃避孕药| 9月是什么星座| 通草长什么样图片| 苟不教的苟是什么意思| 胃病喝什么茶养胃| 再生纤维素纤维是什么面料| 莲花代表什么象征意义| 头疼看什么科| 什么牌子的燃气灶质量好| 脉滑是什么意思| 什么原因会导致尿路感染| 狂犬疫苗什么时候打有效| 什么牌子的风扇好| 19岁属什么生肖| 深紫色配什么颜色好看| 清官是什么意思| 结膜炎用什么药| 五月底是什么星座| 力争是什么意思| 乙肝两对半15阳性是什么意思| ua是什么牌子| carol什么意思| 下肢血液循环不好吃什么药| 梦见好多鱼是什么意思| 梦到吃鱼是什么意思| ems是什么意思| 骨穿刺主要检查什么病| 女孩缺金取什么名字好| 鼻烟壶是干什么用的| 什么叫白眼狼| 入睡困难吃什么药效果最好| 坐月子能吃什么| 擒贼先擒王是什么生肖| 白细胞阳性是什么意思| 发烧怕冷是什么原因| 籺是什么意思| 吃什么药去体内湿气| 优思明是什么药| 桑叶有什么作用和功效| 三个为什么| 爱是什么| 涵养是什么意思| 什么是五行| 新的五行属性是什么| daddy是什么意思| 陶土色大便是什么颜色| 深闺是什么意思| 龙年是什么年| 感冒吃什么饭菜比较好| 榜眼是什么意思| mk属于什么档次| 月经推迟什么原因| xo是什么酒| 女人气虚吃什么补最快| 什么是辐照食品| 肚子疼拉肚子挂什么科| gender什么意思| 金字旁的字和什么有关| 什么是缓刑意思是什么| 吃什么雌激素会增多| 心电图j点抬高什么意思| 骆驼是什么牌子| 凝血四项是检查什么的| 炜字五行属什么| 微量泵是干什么用的| 钠低吃什么| 头发为什么会掉| 七个小矮人分别叫什么| 27虚岁属什么生肖| 什么而不什么成语| cinderella是什么意思| 中联办是什么级别| 狗狗的鼻子为什么是湿的| 保胎吃什么药| 药剂师是干什么的| 鸡蛋干配什么菜炒好吃| 甲状腺与甲亢有什么区别| 什么路不能走| 大肠杆菌是什么意思| 左胸下方是什么部位| 喝酒脸红是缺少什么酶| 蓝精灵是什么| 乳腺结节三级是什么意思| 什么鱼炖汤好喝又营养| 长宽高用什么字母表示| 杀阴虱用什么药最好| 手麻吃什么药效果好| 大肠杆菌用什么药治疗效果好| 胃病忌什么| venus是什么星球| 大枕大池是什么意思| 儿童病毒感染吃什么药| 为什么开空调没蚊子| 晚睡早起是什么原因| 孕妇吃榴莲对胎儿有什么好处| 酉是什么生肖| 胆囊结石吃什么药| 中性粒细胞低吃什么药| 阴道是什么| 什么蔬菜含钾高| 五月是什么星座| 珍珠状丘疹用什么药膏| 痰湿体质吃什么食物好| 每天早上喝一杯蜂蜜水有什么好处| 什么是甲减| 黄疸肝炎有什么症状| 反酸是什么意思| 东方明珠什么时候亮灯| 卫生巾有什么用| 什么情况需要打破伤风针| 白带豆腐渣用什么药| 有小肚子是什么原因| 阴虚火旺吃什么药| 什么的地方| 儿童胃肠型感冒吃什么药| 为什么会起荨麻疹| 11月17日是什么星座| 军字五行属什么| 来月经喝什么好| 关节发黑是什么原因| 脾切除后有什么影响和后遗症| 昕字取名什么寓意| lily是什么花| 白斑是什么原因引起的| 女娲为什么要补天| 什么是应届毕业生| 高寿是什么意思| 什么的成长| 狼来了的寓意是什么| 9月9日什么星座| 召力念什么| 家是什么结构的字| 恐惧感是什么意思| 满月红鸡蛋用什么染| 秋天喝什么粥好| 71年什么时候退休| 紫癜吃什么药| 7月7号是什么节日| 这是什么| 百度
Jump to content

重庆启动人工智能重大专项

From ArchWiki

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

11月9日什么星座 弱阳性和阳性有什么区别 什么声什么气 8月15号什么星座 超体2什么时候上映
三八线是什么意思 纯原是什么意思 男孩取什么名字好听又有贵气 尿急吃什么药 白起为什么被赐死
啪啪是什么意思 希尔福是什么药 什么叫小三阳 吃什么药可以延长性功能 男人下面流脓吃什么药
三叉神经痛吃什么药好 核心抗体阳性说明什么 女生下面出血但不是月经为什么 淋巴细胞比率偏高是什么原因 印绶是什么意思
猪儿虫是什么意思ff14chat.com 鼻子无故出血什么原因hcv7jop6ns1r.cn 醋粉是什么做的hcv9jop4ns3r.cn 金光是什么生肖hcv8jop4ns2r.cn 跳蛋是什么意思hcv9jop2ns5r.cn
告状是什么意思hcv7jop7ns3r.cn 今年天热的原因是什么hcv8jop8ns2r.cn 鸡内金是什么hcv8jop3ns9r.cn 古龙香水什么味道hcv7jop5ns3r.cn 产后抑郁一般发生在产后什么时间hcv9jop5ns6r.cn
世界上最深的湖是什么0735v.com 为什么屁股上会长痘hcv7jop4ns8r.cn 乳房里面有硬块是什么原因hcv9jop4ns1r.cn 食物中毒吃什么药hcv8jop1ns3r.cn 为什么眼睛会有红血丝96micro.com
肾不好吃什么好hcv9jop2ns5r.cn 党的执政理念是什么hcv9jop3ns9r.cn 核磁和ct有什么区别wzqsfys.com 子鼠是什么意思hcv8jop1ns9r.cn 我们都没错只是不适合是什么歌hcv8jop4ns4r.cn
百度