Laptop display issues on Debian 11

Did you have any luck with the first issue?

I’ve got the same issue with a Dell laptop running Debian, with an Internal Intel 630 and an NVIDIA GTX 1050 Ti for external.

Every step included in case it helps someone else.

Initially, I installed the NVIDIA Non-free drivers:
sudo nano /etc/apt/sources.list
Add in:

##------------------------------------------------------------------------------------------
deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian-security bullseye/updates main contrib non-free
deb-src http://deb.debian.org/debian-security bullseye/updates main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free

deb http://ftp.uk.debian.org/debian/ bullseye main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ bullseye main contrib non-free
##------------------------------------------------------------------------------------------

Ctrl+S (save)
Ctrl+X (exit)

Then update the packages list, install and run nvidia-detect to make sure it detects your device and confirms the driver to use:

sudo apt update
sudo apt install nvidia-detect
nvidia-detect

e.g.

$ nvidia-detect
Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] [10de:1c8c] (rev a1)
Checking card: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
Your card is supported by all driver versions.
Your card is also supported by the Tesla 470 drivers series.
Your card is also supported by the Tesla 450 drivers series.
Your card is also supported by the Tesla 418 drivers series.
It is recommended to install the
nvidia-driver
package.

Install (if they’re already installed, they should say they are both say they’re the latest)

sudo apt install linux-headers-amd64
sudo apt install nvidia-driver firmware-misc-nonfree
sudo apt install nvidia-driver

(accept the warning and reboot after)

Once back up, and after each login, manually connect the external display (the actual config will differ for each users’ setup):

sudo xrandr --setprovideroutputsource NVIDIA-G0 modesetting
sudo xrandr --auto
xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto; xrandr --output eDP-1-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-0 --mode 1920x1080 --pos 1920x0 --rotate normal --right-of eDP-1-1

I also used the nvidia-configure, which created the xorg.conf file, I’ve since deleted that.

Following the amazing support from @generix (and others) on nvidia-xconfig doesnt do what i want it to, nor does nvidia-settings - #7 by generix (I can’t post more than one link), I’ve done the following:

sudo nano usr/share/X11/xorg.conf.d/10-amdgpu.conf (only set Driver to “modesetting”)

Section “OutputClass”
Identifier “AMDgpu”
MatchDriver “amdgpu”
Driver “modesetting”
EndSection

sudo nano /usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf (no change)

#This xorg.conf.d configuration snippet configures the X server to
#automatically load the nvidia X driver when it detects a device driven by the
#nvidia-drm.ko kernel module. Please note that this only works on Linux kernels
#version 3.9 or higher with CONFIG_DRM enabled, and only if the nvidia-drm.ko
kernel module is loaded before the X server is started.
Section “OutputClass”
Identifier “nvidia”
MatchDriver “nvidia-drm”
Driver “nvidia”
EndSection

sudo nano /usr/share/X11/xorg.conf.d/10-nvidia.conf (didn’t exist, so created)

Section “OutputClass”
Identifier “nvidia”
MatchDriver “nvidia-drm”
Driver “nvidia”
Option “AllowEmptyInitialConfiguration”
Option “PrimaryGPU” “Yes”
ModulePath “/usr/lib/x86_64-linux-gnu/nvidia/xorg”
EndSection

/xorg doesn’t exist, I tried changing it to /current and it does exactly the same:

$ ls /usr/lib/x86_64-linux-gnu/nvidia/
current  libnvidia-cfg.so.1
$ ls -Al /usr/share/X11/xorg.conf.d/
10-amdgpu.conf
10-nvidia.conf
10-quirks.conf
10-radeon.conf
40-libinput.conf
70-wacom.conf
nvidia-drm-outputclass.conf -> /etc/alternatives/glx--nvidia-drm-outputclass.conf

sudo nano /etc/xdg/autostart/optimus.desktop (created the file)

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto; xrandr --output eDP-1-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-0 --mode 1920x108>
NoDisplay=false
X-GNOME-Autostart-Phase=DisplayServer

Copied the file to the second folder
sudo cp /etc/xdg/autostart/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop

From all this, I’ve configured it to start at boot. The external display is now the one with the login dialog, like yours, the built-in display is blank until logged in, at which point, it correctly becomes the default display and the external display is working as expected.

The problem I have is: if the external display is not connected, I can’t see anything on the internal display until I type in my username/password into the invisible login prompt.

$ sudo lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)

$ xrandr | grep connect
HDMI-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm
eDP-1-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
DP-1-1 disconnected (normal left inverted right x axis y axis)

I don’t know how to start startx with logverbose 6, but I’ve run sudo nvidia-bug-report.sh and attached.
nvidia-bug-report.log.gz (641.2 KB)