我正在尝试让 Kali 识别我的 NVIDIA 显卡并使用它,而不是集成图形处理器。我正在链接NVIDIA 驱动程序分步手册来自我关注的 Kali 网页,但它给出的结果与网页预期的不同。
第一次按照说明操作时,我没有遇到任何错误。但是,由于内部处理器仍在使用中,因此卡安装不正确。我清除了所有软件包,但最终软件包损坏,无法手动重新安装它们。为了解决这个问题,我重新执行了所有步骤,但使用了aptitude
而不是apt
来重新安装所有缺失的引用。
我现在有以下内容。请打开上面的链接以比较输出。
1. sudo aptitude update
2. sudo aptitude -y full-upgrade -y
3. [ -f /var/run/reboot-required ] && sudo reboot -f
4. lspci | grep -i vga
-> 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
5. sudo aptitude install nvidia-detect
6. nvidia-detect
-> Detected NVIDIA GPUs:
01:00.0 3D controller [0302]: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] [10de:1c8d] (rev a1)
Checking card: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
Uh oh. Failed to identify your Debian suite.
7. lspci -s 01:00.0 -v
-> 01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
Subsystem: Acer Incorporated [ALI] GP107M [GeForce GTX 1050 Mobile]
Flags: bus master, fast devsel, latency 0, IRQ 133, IOMMU group 1
Memory at a3000000 (32-bit, non-prefetchable) [size=16M]
Memory at 90000000 (64-bit, prefetchable) [size=256M]
Memory at a0000000 (64-bit, prefetchable) [size=32M]
I/O ports at 4000 [size=128]
Capabilities: <access denied>
Kernel driver in use: nvidia
Kernel modules: nvidia
现在我们可以看到正在使用的内核驱动是nvidia
,它已经与 有所不同了nouveau
。
8. sudo aptitude install -y nvidia-driver nvidia-cuda-toolkit
9. sudo reboot -f
10. nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.103.01 Driver Version: 470.103.01 CUDA Version: 11.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 Off | N/A |
| N/A 36C P8 N/A / N/A | 4MiB / 4042MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 720 G /usr/lib/xorg/Xorg 4MiB |
+-----------------------------------------------------------------------------+
目前我不确定一切是否正常,因为手册中的相应表格显示了更多数据,并且包含xfwm4
在我这边未激活的进程。
11. lspci | grep -i vga
-> 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
此时,手册中必须显示我的 NVIDIA 卡。相反,仅列出了集成处理器。
12. lspci -s 00:02.0 -v
-> 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04) (prog-if 00 [VGA controller])
Subsystem: Acer Incorporated [ALI] HD Graphics 630
Flags: bus master, fast devsel, latency 0, IRQ 129, IOMMU group 2
Memory at a2000000 (64-bit, non-prefetchable) [size=16M]
Memory at b0000000 (64-bit, prefetchable) [size=256M]
I/O ports at 5000 [size=64]
Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: i915
Kernel modules: i915
13. lspci -s 01:00.0 -v
-> 01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
Subsystem: Acer Incorporated [ALI] GP107M [GeForce GTX 1050 Mobile]
Flags: bus master, fast devsel, latency 0, IRQ 133, IOMMU group 1
Memory at a3000000 (32-bit, non-prefetchable) [size=16M]
Memory at 90000000 (64-bit, prefetchable) [size=256M]
Memory at a0000000 (64-bit, prefetchable) [size=32M]
I/O ports at 4000 [size=128]
Capabilities: <access denied>
Kernel driver in use: nvidia
Kernel modules: nvidia
14. sudo aptitude install -y hashcat
15. hashcat -I
-> hashcat (v6.2.5) starting in backend information mode
CUDA Info:
==========
CUDA.Version.: 11.4
Backend Device ID #1 (Alias: #2)
Name...........: NVIDIA GeForce GTX 1050
Processor(s)...: 5
Clock..........: 1493
Memory.Total...: 4042 MB
Memory.Free....: 3996 MB
PCI.Addr.BDFe..: 0000:01:00.0
OpenCL Info:
============
OpenCL Platform ID #1
Vendor..: NVIDIA Corporation
Name....: NVIDIA CUDA
Version.: OpenCL 3.0 CUDA 11.4.189
Backend Device ID #2 (Alias: #1)
Type...........: GPU
Vendor.ID......: 32
Vendor.........: NVIDIA Corporation
Name...........: NVIDIA GeForce GTX 1050
Version........: OpenCL 3.0 CUDA
Processor(s)...: 5
Clock..........: 1493
Memory.Total...: 4042 MB (limited to 1010 MB allocatable in one block)
Memory.Free....: 3968 MB
OpenCL.Version.: OpenCL C 1.2
Driver.Version.: 470.103.01
PCI.Addr.BDF...: 01:00.0
...
当我尝试排除故障时:
16. sudo aptitude install -y clinfo
17. clinfo
-> Number of platforms 2
Platform Name NVIDIA CUDA
Platform Vendor NVIDIA Corporation
Platform Version OpenCL 3.0 CUDA 11.4.189
Platform Profile FULL_PROFILE
...
...
Platform Name NVIDIA CUDA
Number of devices 1
Device Name NVIDIA GeForce GTX 1050
Device Vendor NVIDIA Corporation
Device Version OpenCL 3.0 CUDA
Driver Version 470.103.01
Device OpenCL C Version OpenCL C 1.2
...
...
18. dpkg -l | grep -i icd
ii nvidia-egl-icd:amd64 470.103.01-3 amd64 NVIDIA EGL installable client driver (ICD)
ii nvidia-opencl-icd:amd64 470.103.01-3 amd64 NVIDIA OpenCL installable client driver (ICD)
ii nvidia-vulkan-icd:amd64 470.103.01-3 amd64 NVIDIA Vulkan installable client driver (ICD)
ii ocl-icd-libopencl1:amd64 2.2.14-3 amd64 Generic OpenCL ICD Loader
ii ocl-icd-opencl-dev:amd64 2.2.14-3 amd64 OpenCL development files
ii pocl-opencl-icd:amd64 1.8-3 amd64 pocl ICD
19. dpkg -l | grep -i mesa-opencl-icd
-> (nothing)
20. clinfo | grep -i "icd loader"
ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.14
ICD loader Profile OpenCL 3.0
21. nvidia-smi -i 0 -q
==============NVSMI LOG==============
Timestamp : Thu Apr 21 17:56:28 2022
Driver Version : 470.103.01
CUDA Version : 11.4
Attached GPUs : 1
GPU 00000000:01:00.0
Product Name : NVIDIA GeForce GTX 1050
Product Brand : GeForce
Display Mode : Disabled
Display Active : Disabled
Persistence Mode : Disabled
MIG Mode
Current : N/A
Pending : N/A
Accounting Mode : Disabled
Accounting Mode Buffer Size : 4000
Driver Model
Current : N/A
Pending : N/A
Serial Number : N/A
GPU UUID : GPU-ebf9898c-5602-0704-980f-3c0d37c16812
Minor Number : 0
VBIOS Version : 86.07.3C.00.13
MultiGPU Board : No
Board ID : 0x100
GPU Part Number : N/A
Module ID : 0
Inforom Version
Image Version : N/A
OEM Object : N/A
ECC Object : N/A
Power Management Object : N/A
GPU Operation Mode
Current : N/A
Pending : N/A
GSP Firmware Version : N/A
GPU Virtualization Mode
Virtualization Mode : None
Host VGPU Mode : N/A
IBMNPU
Relaxed Ordering Mode : N/A
PCI
Bus : 0x01
Device : 0x00
Domain : 0x0000
Device Id : 0x1C8D10DE
Bus Id : 00000000:01:00.0
Sub System Id : 0x11281025
GPU Link Info
PCIe Generation
Max : 3
Current : 1
Link Width
Max : 16x
Current : 16x
Bridge Chip
Type : N/A
Firmware : N/A
Replays Since Reset : 0
Replay Number Rollovers : 0
Tx Throughput : 0 KB/s
Rx Throughput : 0 KB/s
Fan Speed : N/A
Performance State : P8
Clocks Throttle Reasons
Idle : Active
Applications Clocks Setting : Not Active
SW Power Cap : Not Active
HW Slowdown : Not Active
HW Thermal Slowdown : Not Active
HW Power Brake Slowdown : Not Active
Sync Boost : Not Active
SW Thermal Slowdown : Not Active
Display Clock Setting : Not Active
FB Memory Usage
Total : 4042 MiB
Used : 4 MiB
Free : 4038 MiB
BAR1 Memory Usage
Total : 256 MiB
Used : 2 MiB
Free : 254 MiB
Compute Mode : Default
Utilization
Gpu : 0 %
Memory : 0 %
Encoder : 0 %
Decoder : 0 %
Encoder Stats
Active Sessions : 0
Average FPS : 0
Average Latency : 0
FBC Stats
Active Sessions : 0
Average FPS : 0
Average Latency : 0
Ecc Mode
Current : N/A
Pending : N/A
ECC Errors
Volatile
Single Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Double Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Aggregate
Single Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Double Bit
Device Memory : N/A
Register File : N/A
L1 Cache : N/A
L2 Cache : N/A
Texture Memory : N/A
Texture Shared : N/A
CBU : N/A
Total : N/A
Retired Pages
Single Bit ECC : N/A
Double Bit ECC : N/A
Pending Page Blacklist : N/A
Remapped Rows : N/A
Temperature
GPU Current Temp : 39 C
GPU Shutdown Temp : 102 C
GPU Slowdown Temp : 97 C
GPU Max Operating Temp : 94 C
GPU Target Temperature : N/A
Memory Current Temp : N/A
Memory Max Operating Temp : N/A
Power Readings
Power Management : N/A
Power Draw : N/A
Power Limit : N/A
Default Power Limit : N/A
Enforced Power Limit : N/A
Min Power Limit : N/A
Max Power Limit : N/A
Clocks
Graphics : 139 MHz
SM : 139 MHz
Memory : 405 MHz
Video : 544 MHz
Applications Clocks
Graphics : N/A
Memory : N/A
Default Applications Clocks
Graphics : N/A
Memory : N/A
Max Clocks
Graphics : 1911 MHz
SM : 1911 MHz
Memory : 3504 MHz
Video : 1708 MHz
Max Customer Boost Clocks
Graphics : N/A
Clock Policy
Auto Boost : N/A
Auto Boost Default : N/A
Voltage
Graphics : N/A
Processes
GPU instance ID : N/A
Compute instance ID : N/A
Process ID : 720
Type : G
Name : /usr/lib/xorg/Xorg
Used GPU Memory : 4 MiB
这里看起来 NVIDIA 无法被正确识别,在许多领域被“禁用”或“N/A”。
22. sudo aptitude install -y mesa-utils
23. glxinfo | grep -i "direct rendering"
-> direct rendering: Yes
现在我不知道该怎么做。有些步骤似乎成功了,但我不明白为什么 NVIDIA 卡没有列在 VGA-s 下,以及为什么笔记本不想使用它。
您知道如何修复安装或问题出在哪里吗?
答案1
这是官方文档https://www.kali.org/docs/general-use/install-nvidia-drivers-on-kali-linux/
对于 Optimus(笔记本电脑和笔记本),您将看不到主卡的 NVIDIA。您甚至可能根本看不到列出的 NVIDIA。您可以通过执行以下操作来查看主卡:
kali@kali:~$ lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)
kali@kali:~$
答案2
在 Kali Linux 上安装 Nvidia 驱动程序
教程位于Kali 官方网站截至 2018 年 4 月 11 日已损坏
在花了几天时间研究如何安装 nvidia 驱动程序并调试启动时黑屏问题后,我终于找到了解决所有问题的方法。我写这篇文章的主要原因是让你知道,截至 2018 年 4 月 11 日,Kali 官方网站上的教程已经失效。根据他在其网站上提到的,您可能能够成功安装软件包 - ocl-icd-libopencl1、nvidia-driver、nvidia-cuda-toolkit,但您可能会在重启时遇到问题。您可能会看到黑屏,并且无法通过 GUI 登录。
尝试查看这个 repohttps://github.com/europa502/Installing-Nvidia-drivers-on-Kali-Linux.git