Back home
中文
H7 / SECURITY RESEARCH NOTES

Solving the Graphics Driver Problem in Kali 2020.3

On this page7 sections

Preface

After installing Kali Linux 2020.3 on my desktop, I noticed that the discrete graphics card fan was extremely loud and constantly ran at full speed while the system was running. I wondered why, and an online search showed that Kali Linux uses the open-source Nidia driver, which has poor compatibility with the graphics card, so I had to install the driver myself. When I searched online for tutorials, I found all kinds of approaches, but none solved the problem. After spending a day on it and combining information from various Chinese and international articles, I finally solved the problem. I therefore had to record it, or I might spend another day on it next time.

Resolution Process

1. Preparation

Installing the Linux Kernel Packages

  • Check Whether Kernel Packages Are Missing

Enter the following command:

apt-cache search linux-headers  # 搜索是否存在内核头,如果没有那就啥都搜不到,如图

image.png

  • Download the Kernel Packages

Next, begin downloading the kernel packages. (1) First method (download from the software repository) (generally does not work, but give it a try):

sudo apt-get update && sudo apt-get install linux-headers-$(uname -r)  # 更新一下本地软件源并下载本机的内核包,结果如图

image.png

The image shows that this kernel package is not available in the software repository. The section underlined in red in the image is the kernel package we need to download. Copy it now so it is easier to search for later.

(2) Second method (download from the official site): Download address: http.kali.org/kali/pool/main/l/linux/ Open it in Firefox to see many files. We need to find the kernel package copied earlier; mine is linux-headers-5.7.0-kali1-amd64. Use ctrl+F to find this package in the browser, as shown below:

image.png

Download it locally, then compile it with dpkg -i linux-headers-5.7.0-kali1-amd64 , as shown below:

image.png

As the image shows, three other kernel packages must be installed before this one. Find each of them in turn. Be careful to choose kernel packages with approximately matching versions because some packages have several variants. Here are screenshots of the packages to find:

image.png

image.png

image.png

After downloading and compiling each package above, compile the first package we initially downloaded, and that is it!

Installing Missing System Firmware

(1) First check which firmware is missing by entering sudo update-initramfs -u, as shown below:

image.png

The image shows that a lot of firmware is missing. Do not panic, because we only need to install the firmware indicated by my arrow (none of the firmware for module nouveau needs to be installed; that is firmware for the open-source driver, which we are not using).

Download address: https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/rtl_nic/, as shown below:

image.png

Download the corresponding firmware, then move it to the appropriate missing directory. Here, it is moved into /lib/firmware/rtl_nic/.

2. Driver Installation

  • Disable the nouveau Driver

sudo systemctl set-default multi-user.target  # 设置开机在命令行界面
sudo reboot # 重启电脑

At the GRUB boot screen, press E to enter the editing screen. On the third line from the bottom, add the following after quiet. Remember, it can only be added after the word quiet.

nouveau.modeset=0  # 设置这个选项目的是为了禁用noveau,必须设置!
  • Download and Install the nvidia Driver

(1) After booting and logging in through the command-line interface, start downloading the nvidia driver.

sudo apt-get update && sudo apt-get install nvidia-smi  # 开始下载nvidia驱动

(2) After the download completes, switch the system back to the graphical interface, set the graphical interface to start by default at boot, and then restart.

sudo init 5  # 切回图形化界面
sudo systemctl set-default graphical.target  # 设置开机默认启动图形界面
sudo reboot  # 重启电脑
  • Verify Success

After restarting, check whether the open-source driver was successfully disabled and whether the nvidia driver was installed.

sudo lsmod | grep -i 'nouveau'  # 如果没有任何显示,说明开源驱动禁用成功
sudo lsmod | grep -i 'nvidia' # 如果有显示,说明安装成功

The display after a successful installation is shown below:

image.png

3. Reference Articles

https://blog.csdn.net/qq_21774161/article/details/68070594
https://www.cnblogs.com/magikos/p/Possible-missing-firmware.html
https://blog.csdn.net/weixin_38835814/article/details/105609939