External monitor not detected on Debian 11 with RTX 3050 (LEGION 5i Pro)

I have installed Debian 11 on a new Lenovo LEGION 5i Pro with Nvidia RTX 3050 and followed the instructions to install the drivers:

$ sudo apt-get install nvidia-driver firmware-misc-nonfree

I have plugged in an external monitor using the HDMI port, but it’s not being detected, it’s not showing on the Displays settings page.
But when I open the nvidia-settings GUI I can see under GPU-0 an entry for HDMI-1-0 with the name of the monitor so it is connected and I think it’s only a problem with configuration.

These are my xrandr outputs:

$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 16384 x 16384
eDP-1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 345mm x 215mm
   2560x1600    165.02 +  60.01 +  59.99    59.97  
   2560x1440     59.99    59.99    59.96    59.95  
   2048x1536     85.00    75.00    60.00  
   1920x1440     85.00    75.00    60.00  
   1856x1392     75.00    60.01  
   1792x1344     75.00    60.01  
   2048x1152     59.99    59.98    59.90    59.91  
   1920x1200     59.88*   59.95  
   1920x1080     60.01    59.97    59.96    59.93  
   1600x1200     85.00    75.00    70.00    65.00    60.00  
   1680x1050     84.94    74.89    69.88    59.95    59.88  
   1600x1024     60.17  
   1400x1050     85.00    74.76    70.00    59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     85.02    75.02    60.02  
   1440x900      59.89  
   1400x900      59.96    59.88  
   1280x960      85.00    60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1360x768      59.80    59.96  
   1280x800      59.99    59.97    59.81    59.91  
   1152x864     100.00    85.06    85.00    75.00    75.00    70.00    60.00  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      85.00    75.05    60.04    85.00    75.03    70.07    60.00  
   1024x768i     86.96  
   960x720       85.00    75.00    60.00  
   928x696       75.00    60.05  
   896x672       75.05    60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   832x624       74.55  
   960x540       59.96    59.99    59.63    59.82  
   800x600       85.00    75.00    70.00    65.00    60.00    85.14    72.19    75.00    60.32    56.25  
   840x525       85.02    74.96    69.88    60.01    59.88  
   864x486       59.92    59.57  
   800x512       60.17  
   700x525       85.08    74.76    70.06    59.98  
   800x450       59.95    59.82  
   640x512       85.02    75.02    60.02  
   720x450       59.89  
   700x450       59.96    59.88  
   640x480       85.09    60.00    85.01    72.81    75.00    59.94  
   720x405       59.51    58.99  
   720x400       85.04  
   684x384       59.88    59.85  
   680x384       59.80    59.96  
   640x400       59.88    59.98    85.08  
   576x432      100.11    85.15    85.09    75.00    75.00    70.00    60.06  
   640x360       59.86    59.83    59.84    59.32  
   640x350       85.08  
   512x384       85.00    75.03    70.07    60.00  
   512x384i      87.06  
   512x288       60.00    59.92  
   416x312       74.66  
   480x270       59.63    59.82  
   400x300       85.27    72.19    75.12    60.32    56.34  
   432x243       59.92    59.57  
   320x240       85.18    72.81    75.00    60.05  
   360x202       59.51    59.13  
   360x200       85.04  
   320x200       85.27  
   320x180       59.84    59.32  
   320x175       85.27  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)
$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x4a cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 4 outputs: 7 associated providers: 0 name:modesetting
Provider 1: id: 0x2af cap: 0x2, Sink Output crtcs: 4 outputs: 6 associated providers: 0 name:NVIDIA-G0
$ xrandr --listmonitors
Monitors: 1
 0: +*eDP-1 1920/345x1200/215+0+0  eDP-1

I don’t have a config file at /etc/X11/xorg.conf but when I generate one using nvidia-xconfig I get the external monitor working but if I unplug it and try to use the laptop without it, I get a blank screen on the built-in display, I can fix the problem by removing the /etc/X11/xorg.conf config file and rebooting.

Here’s the generated config file:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 460.32.03

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
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 "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

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

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I have also tried a command that I’ve found somewhere online:

$ xrandr --setprovideroutputsource 1 0

It worked, I was able to see and configure both the built-in display and the external monitor on the settings page, but the changes did not persist after reboot and also after checking top the Xorg process was using about 30-40% CPU alone and there was lagging on the external screen.

I already have secure boot disabled in the BIOS, and I’m using the 5.10 Linux kernel.

So what am I missing here? How can I properly configure my OS to use both displays?

Thank you very much.

Update:
I tried installing the latest version (470) manually using the .run file, but it seems that the drivers is not being used at all as the output of nvidia-smi does not show any process using it and the xrandr output differ a lot from the above, showing only 1 provider, I couldn’t find any instructions on how to make it work like the one installed from the debian repository.

xrandr output:

$ xrandr 
Screen 0: minimum 16 x 16, current 1920 x 1200, maximum 32767 x 32767
XWAYLAND0 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 340mm x 220mm
   1920x1200     59.86*+

inxi -G output:

$ inxi -G
Graphics:  Device-1: Intel driver: i915 v: kernel 
           Device-2: NVIDIA driver: nvidia v: 470.94 
           Device-3: Chicony Integrated Camera type: USB driver: uvcvideo 
           Display: wayland server: X.Org 1.20.11 driver: loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa 
           resolution: 1920x1200~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics (TGL GT1) v: 4.6 Mesa 20.3.5

Have you selected switchable or discrete graphics in the BIOS/UEFI?

The Legion 5 has the internal panel wired to the iGPU and external ports to the dGPU, so the dGPU needs to be active for anything to display on the external outputs.

If you want to use switchable graphics then I suspect you’ll need to configure reverse PRIME somewhere along the line, and the Debian documentation and forum will be best placed for that.

2 Likes

Thank you very much, I didn’t know about this feature until now.

I have tried setting “Discrete Graphic” mode and now the external monitor works fine, so yes the HDMI port seems to be wired to the dGPU.

Thanks again.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.