2

I cannot manage to have my second screen recognized by my laptop (Lenovo Legion 5). It has Nvidia RTX 3060 and a second card :

❯ 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

In update-alternatives, the "current" is used:

❯ 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 detect correctly 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

I do not have any /etc/X11/xorg.conf file. If I generated one with nvidia-xconfig, I get a blinking cursor on reboot.

Switchable Graphics is enabled in BIOS.

When I connect the screen in HDMI, nothing happens ... And hotkeys Win+P or Fn+F7 does nothing.

Any idea ?

2 Answers2

4

After several hours and mixing a lot of different ideas, I have just managed to get it to work and I deliver "my" solution. There is little black magic out there, but it worked on my side ...

  1. Do not use Nvidia proprietary drivers (here nvidia-tesla510) or any other packages like optimus, prime, bumblebee, etc. To be safe: remove all current Nvidia drivers, without exception: sudo apt purge nvidia-*. If there is any error about dependency, remove it. Then reboot. Verify you do not have any Nvidia package installed on your system (Cuda included). Remove any superfluous packages with apt autoremove. I personnally advise to not install any package not officially distributed by the stable repositories. Reboot.
  2. Follow the Kali install guide, basically:
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. For screen detections with the second screen connected: xrandr -q. You should see the second screen connected on the list. But, even with that, it was not sufficient to let the signal go through the second screen.
  2. You can reboot now (maybe not useful - I know)
  3. Write your own /etc/X11/xorg.conf, inspired by: http://us.download.nvidia.com/XFree86/Linux-x86/375.39/README/randr14.html. Or you can use the package nvidia-xconfig (apt install nvidia-xconfig) then launch: sudo nvidia-xconfig. You can verify that a new file /etc/X11/xorg.conf is written. Here is mine:
❯ 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

If you have hybrid graphics based on Intel, you will have "intel" instead of "amdgpu".

  1. Reboot, cross your fingers, and you are done. If it does not work (blinking cursor, black screen ...), go into another terminal (Alt+F2), remove the xorg.conf, reboot, and try to find another solution by continuing to blame Nvidia, Intel, AMD and your favorite manufacturer for their nice software support for Linux. Good luck.
0

(Legion 5), Amd press F9 to get into Bios setup menu and simply select discrete graphics card and reboot the system.