I spent total around 50 hours, because while fixing one, another was appearing.
I will describe step by step what I did to fix all of this and hope my knowledge will save some time for somebody else.
Note: we are rebooting after each step. I would strongly recommend to do it, otherwise some settings may clash.
Disabled Wayland
sudo vim /etc/gdm3/custom.conf
- Set
WaylandEnable=false
- reboot
Update NVIDIA driver to 520.56.06
- You can find lots of tutorials how to do it
- reboot
Modify grub
sudo vim /etc/default/grub
- Update/append your
GRUB_CMDLINE_LINUX
to GRUB_CMDLINE_LINUX="intel_iommu=off nouveau.modeset=0 nouveau.blacklist=1"
sudo update-grub
- reboot
Next, to solve issue when one of the screens is remained black and could not be turned on. But it might also affect the audio.
Fix for me was to add a custom frequency for the Huawei screen.
By default, it was only 60hz, but I think when you have two 4k monitors it might be that it is not enough bandwidth to pass such frequency.
modify
vim ~/.xprofile
Set following content:
#!/bin/sh
xrandr --newmode "3840x2560_30.00" 406.50 3840 4112 4520 5200 2560 2563 2573 2606 -hsync +vsync
xrandr --addmode DP-1-2 3840x2560_30.00
see How do I set a custom resolution?
Then
- set Samsung screen to 1280x1024
- disable built-in screen
- set Huawei to the same low resolution. Idea is to set both screens to low resolution.
- Apply changes
- set Huawei to newly added resolution (3840x2560 30Hz).
- Apply changes.
- Then increase resolution for Samsung to 4k
- Apply changes
Small issue that your login screen is still on built-in monitor
sudo cp ~/.config/monitors.xml ~gdm/.config/monitors.xml
sudo chown gdm:gdm ~gdm/.config/monitors.xml
See Is there to make the login screen appear on the external display in 18.04?
Finally, refresh your pulseaudio
. (Install if not installed via sudo apt install pulseaudio
)
mv ~/.config/pulse ~/.config/old_pulse
- reboot
PS:
In case wiring also plays role. I connected both screens to the dock via DisplayPort cables. Huawei played really bad with HDMI. Dock station is connected to the laptop via Thunderbolt 4.
Power to the laptop is also supplied via Dock Station.
PPS: if still have the issue with black screen then try to remove nvidia services and reboot.
sudo systemctl stop nvidia-suspend.service
sudo systemctl stop nvidia-hibernate.service
sudo systemctl stop nvidia-resume.service
sudo systemctl disable nvidia-suspend.service
sudo systemctl disable nvidia-hibernate.service
sudo systemctl disable nvidia-resume.service
sudo rm /lib/systemd/system-sleep/nvidia