Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to interpret blacklist.conf in linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I would like to talk to you about how to interpret blacklist.conf in linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something from this article.

When we install drivers in linux, we sometimes encounter limitations or conflicts, and the usual solution is to modify blacklist.conf, so how to understand and understand it in depth? Let's read it next.

1. Blacklist blacklist

For kernel modules, a blacklist is a mechanism that forbids a module from loading

Create a .conf file in / etc/modprobe.d/ and use the blacklist keyword to mask unnecessary modules, such as if you do not want to load the pcspkr module:

/ etc/modprobe.d/blacklist.conf

Blacklist pcspkr

Or through the command line mode

Modprobe.blacklist=modname1,modname2

From this we can see that blacklist is a module parameter, in fact, in linux/module.c

The source code is as follows:

Static bool blacklisted (const char module_name)

{

Const char p

Size_t len

# if you can see that the list of module_blacklist is null, then return false directly

If (! module_blacklist)

Return false

# compare whether the module's name is in the module_blacklist by querying the list. If so, return true, then the module will not be loaded in the load # layout_and_allocate function

For (p = module_blacklist; p; p + = len) {

Len = strcspn (p, ",")

If (strlen (module_name) = = len & &! memcmp (module_name, p, len))

Return true

If (p [len] = =',')

Len++

}

Return false

}

Core_param (module_blacklist, module_blacklist, charp, 0400)

The function blacklisted is loaded in layout_and_allocate

Static struct module layout_and_allocate (struct load_info info, int flags)

{

/ Module within temporary copy. /

Struct module mod

Unsigned int ndx

Int err

Mod = setup_load_info (info, flags); if (IS_ERR (mod)) return mod;# can see that if blacklisted returns true, layout_and_allocate returns-EPERM, indicating that the module if (blacklisted (info- > name)) return ERR_PTR (- EPERM) is not loaded

}

2. Example of nvidia graphics card driver

The Linux system generally installs the open source nouvea graphics card driver by default, which conflicts with the nvidia graphics card driver. If you want to install nvidia, you must disable nouvea! Secondly, the Nvidia driver installs the OpenGL desktop by default, but this conflicts with the GNOME desktop. In order to avoid system downtime, you also need to disable the OpenGL of nvidia. In the process, you need to build gcc, kernel and other environments. In this way, the NVIDIA graphics card driver can be installed smoothly.

1. Close secure boot first

Restart the computer and enter BIOS

Find seure boot, usually in the boot option

Change "Enable" to "Disable"

2. Check the NVIDIA driver lspci that exists in the system | grep-I nvidia

Select the nvidia official website driver suitable for the host linux, and click search to download it.

Because the driver compiles with the kernel source code, you need to install the following kernel-related packages, as well as some toolkits for compiling the source code:

Yum install kernel-devel kernel-doc kernel-headers gcc* glibc* glibc-*

Sometimes glx-utils.x86_64 conflicts with the driver, so it's best to delete it first:

Yum remove glx-utils

3. Add the driver to the blacklist: / etc/modprobe.d/blacklist.conf add:

# blacklist nvidiafb comment out nvidiafb

Then add two lines

Blacklist nouveau

Options nouveau modeset=0

Modify / etc/default/grub file

Add in GRUB_CMDLINE_LINUX

Rd.driver.blacklist nouveau nouveau.modeset=0

4. Rebuild initramfs image

Mv / boot/initramfs-$ (uname-r). Img / boot/initramfs-$ (uname-r). Img.bak

Dracut / boot/initramfs-$ (uname-r) .img $(uname-r)

5. Install the compilation environment

Yum install gcc kernel-devel kernerl-hearders-y

Or yum-y install gcc kernel-devel

6. Install the NVIDIA driver

Add executable permissions

Chmod + x NVIDIA-Linux-x86_64-375.39.run

7. Exit the X-server graphic, enter text mode or modify the inittab

Init 3

8. Execute

Sh NVIDIA-Linux-x86_64-375.39.run-- no-opengl-files

9. OK, Accept and yes will be installed in the back.

10. Finally, use the nvidia-smi command to see the details of the driver.

Note: depmod-an is dependent on all module checks

Echo modprobe wl > > / etc/rc.local after reading the above, do you have any further understanding of how to interpret blacklist.conf in linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report