无法在 Kali Linux 上获取第二个屏幕(配备 Nvidia RTX 的 Lenovo Legion 5)

无法在 Kali Linux 上获取第二个屏幕(配备 Nvidia RTX 的 Lenovo Legion 5)

我无法让笔记本电脑(Lenovo Legion 5)识别我的第二个屏幕。它有 Nvidia RTX 3060 和第二张卡:

❯ lspci -nnk | grep "VGA\|'Kern'\|3D\|Display" -A2 
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] [10de:2560] (rev a1)
    Subsystem: Lenovo GA106M [GeForce RTX 3060 Mobile / Max-Q] [17aa:3a81]
    Kernel driver in use: nvidia
--
06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [1002:1638] (rev c6)
    Subsystem: Lenovo Cezanne [17aa:3a81]
    Kernel driver in use: amdgpu

在 中 update-alternatives,使用“当前”:

❯ sudo update-alternatives --config nvidia
Il existe 2 choix pour l'alternative nvidia (qui fournit /usr/lib/nvidia/nvidia).

  Sélection   Chemin                     Priorité  État
------------------------------------------------------------
  0            /usr/lib/nvidia/tesla-510   510       mode automatique
* 1            /usr/lib/nvidia/current     470       mode manuel
  2            /usr/lib/nvidia/tesla-510   510       mode manuel

Hashcat 正确检测 CUDA:

❯ 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 RTX 3060 Laptop GPU
  Processor(s)...: 30
  Clock..........: 1425
  Memory.Total...: 5946 MB
  Memory.Free....: 5838 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.231

  Backend Device ID #2 (Alias: #1)
    Type...........: GPU
    Vendor.ID......: 32
    Vendor.........: NVIDIA Corporation
    Name...........: NVIDIA GeForce RTX 3060 Laptop GPU
    Version........: OpenCL 3.0 CUDA
    Processor(s)...: 30
    Clock..........: 1425
    Memory.Total...: 5946 MB (limited to 1486 MB allocatable in one block)
    Memory.Free....: 5824 MB
    OpenCL.Version.: OpenCL C 1.2 
    Driver.Version.: 470.129.06
    PCI.Addr.BDF...: 01:00.0

OpenCL Platform ID #2
  Vendor..: The pocl project
  Name....: Portable Computing Language
  Version.: OpenCL 2.0 pocl 1.8  Linux, None+Asserts, RELOC, LLVM 11.1.0, SLEEF, DISTRO, POCL_DEBUG

  Backend Device ID #3
    Type...........: CPU
    Vendor.ID......: 1
    Vendor.........: AuthenticAMD
    Name...........: pthread-AMD Ryzen 5 5600H with Radeon Graphics
    Version........: OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-generic
    Processor(s)...: 12
    Clock..........: 3300
    Memory.Total...: 11857 MB (limited to 2048 MB allocatable in one block)
    Memory.Free....: 5896 MB
    OpenCL.Version.: OpenCL C 1.2 pocl
    Driver.Version.: 1.8

我没有任何 /etc/X11/xorg.conf 文件。如果我用 生成了一个文件nvidia-xconfig,则在重启时会出现闪烁的光标。

BIOS 中已启用可切换显卡。

当我通过 HDMI 连接屏幕时,什么也没有发生...并且热键 Win+P 或 Fn+F7 没有任何反应。

任何想法 ?

答案1

经过几个小时的思考和各种不同的想法,我终于成功让它发挥作用,并给出了“我的”解决方案。虽然没有什么黑魔法,但对我来说它确实有效......

  1. 不要使用 Nvidia 专有驱动程序(此处为 nvidia-tesla510)或任何其他软件包,如 optimus、prime、bumblebee 等。为安全起见:删除所有当前 Nvidia 驱动程序,无一例外:sudo apt purge nvidia-*。如果有任何关于依赖项的错误,请将其删除。然后重启。验证您的系统上没有安装任何 Nvidia 软件包(包括 Cuda)。使用 删除任何多余的软件包apt autoremove。我个人建议不要安装任何非稳定存储库官方分发的软件包。重启。
  2. 按照 Kali 安装指南进行操作,基本上:
sudo apt update
sudo apt -y full-upgrade -y
[ -f /var/run/reboot-required ] && sudo reboot -f
sudo apt install -y nvidia-driver nvidia-cuda-toolkit
  1. 对于已连接第二个屏幕的屏幕检测:xrandr -q。您应该会在列表中看到已连接的第二个屏幕。但是,即使这样,也不足以让信号通过第二个屏幕。
  2. 您现在可以重新启动(可能没什么用——我知道)
  3. 写下你自己的/etc/X11/xorg.conf,灵感来自:http://us.download.nvidia.com/XFree86/Linux-x86/375.39/README/randr14.html。或者您可以使用包nvidia-xconfigapt install nvidia-xconfig)然后启动: 。您可以验证是否已写入sudo nvidia-xconfig新文件。这是我的:/etc/X11/xorg.conf
❯ cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 470.103.01

Section "ServerLayout"
    Identifier     "layout"
    Screen      0  "nvidia" 0 0
    Inactive       "amdgpu"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
    BusID          "PCI:01:0:0"
EndSection

Section "Device"
    Identifier     "amdgpu"
    Driver         "modesetting"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration"
    SubSection     "Display"
        Depth       24
        Modes      "nvidia-auto-select"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "amdgpu"
    Device         "amdgpu"
    Monitor        "Monitor0"
EndSection

如果您拥有基于英特尔的混合显卡,那么您将看到“intel”而不是“amdgpu”。

  1. 重启,祈祷,你就大功告成了。如果它不起作用(光标闪烁、屏幕变黑……),请进入另一个终端(Alt+F2),删除xorg.conf,重启,然后继续责怪 Nvidia、Intel、AMD 和您最喜欢的制造商对 Linux 的良好软件支持,尝试寻找其他解决方案。祝你好运。

答案2

(Legion 5),Amd 按 F9 进入 Bios 设置菜单并选择独立显卡并重新启动系统。

相关内容