I have a couple of systems (one Leap 15.4 and the others tumbleweed) that are attached to a KVM (HDMI video and USB kbd/mouse), this generally works well except for one thing.
If I reboot the system with the KVM set to another machine, then the monitor is not detected at boot time, which is reasonable, but if I later switch to that machine it is still not detected so I’m left with no monitor. I’m guessing that Linux ‘thinks’ it’s booting headless and acts accordingly. The machine of course works other than that, I can connect to it remotely via ssh or rdp, and everything works as it should.
Is there a way to force it to assume that there is a monitor there?
My setup is two computers with two monitors, NVIDIA graphics. One computer always has a monitor. The second monitor is shared between the two computers via a KVM, which is pretty much your situation.
Computer 1 uses Monitor 1 and Monitor 2 as a large desktop
Computer 2 uses Monitor 2
KVM controls Monitor 2
From the KDE desktop, I have System Settings/Startup and Shutdown/Background Services/KScreen 2 turned off. I found that this service will try to automatically “mount/unmount” monitors as the computers detect them. Through a KVM, I want the monitors to persist between switching computers, as you do. This may be all you need and it’s the easiest to try. You will want the KVM switched to the computer that is being turned on for the computer to detect the monitor on boot, then after that, KVM switching should be fine.
If turning off KScreen2 isn’t enough, you can also force the computers/graphics cards to not detect the monitors on boot and use a specific monitor definition. For that, you can use nvidia-settings to generate an /etc/X11/xorg.conf file and modify it. You’ll need to do this for both computers. I included mine below.
The important parts are:
#keep displays active, two or three displays and the two lines below it. Your line will read more like, Option "ConnectedMonitor" "DFP-0", since you only have one monitor.
Force no checking. #no checks Option "ModeValidation" "NoDFPNativeResolutionCheck,NoVirtualSizeChe ck,NoMaxPClkCheck,NoHorizSyncCheck,NoVertRefreshCheck,NoWidthAlignmentCheck"
#two or three displays and the three Option lines below it. The first line, for you, will only specify one monitor with resolution. Mine uses two monitors. You can ignore the second line, as that allows me a third monitor. The third line does resolution auto select, which gets confused when the KVM is switched, so I have it turned off.
/etc/X11/xorg.conf (or can be /etc/X11/xorg.conf.d/10-nvidia.conf)