Unplugging external monitor hangs FreeBSD

I'm using KDE 6 on FreeBSD 14.4. I'm also using an external monitor via VGA port. When the external monitor cable unplugs, the entire system hangs - nothing works, even the USB keyboard's NumLock won't toggle. So I have to hard reset the computer to get it working again.

Interestingly, it seems to be a KDE issue because I can unplug and plug the external monitor back in before I load KDE without any issues.

Is this one of those things we have to live with (along with inability to put the computer to sleep, etc)? Anyone has this problem too?
 
Never heard of that one before, very unusual. Can you still ssh into the box from another machine? If so you could look at what is running, if any processes are hogging 100% cpu, or blocked waiting on i/o... of course if it's the kernel that is doing it you won't be able to ssh in. If you haven't got another machine handy, you can install termux on android and ssh from the termux shell, it's got an ssh client, openssh I believe.
 
Never heard of that one before, very unusual. Can you still ssh into the box from another machine? If so you could look at what is running, if any processes are hogging 100% cpu, or blocked waiting on i/o... of course if it's the kernel that is doing it you won't be able to ssh in. If you haven't got another machine handy, you can install termux on android and ssh from the termux shell, it's got an ssh client, openssh I believe.
I don't have another machine I can use to ssh, but I do have an Android with termux, so I might try that. I don't think it'll work because everything becomes frozen, even the keyboard won't toggle NumLock or the power button press won't initiate a shutdown!
 
I've never heard of this before. Does this still happen if you remove the display before disconnecting the monitor? That's the first thing I'd try and if so, it's always possible to set up a short cut to just do that if nothing else works.
 
I've never heard of this before. Does this still happen if you remove the display before disconnecting the monitor? That's the first thing I'd try and if so, it's always possible to set up a short cut to just do that if nothing else works.
Remove the display as in uncheck "Enabled" for the external monitor in KDE's Display Configuration? Still hangs.
Wayland or X?
Wayland.
 
Try running KDE with X.org. I had all kinds of weird hangs with Wayland. One of those was when I let the computer running, it was supposed to turn off the monitor after 15mins. It did that, but then upon moving the mouse, the monitor woke up, the password dialog showed up and the system froze.

Exactly as you describe, no ctrlaltdel, no dropping to tty, no pressing the power button, nothing helped, only hard power off.

Interestingly, there was nothing related to be found in /var/log/ files
 
Try running KDE with X.org. I had all kinds of weird hangs with Wayland. One of those was when I let the computer running, it was supposed to turn off the monitor after 15mins. It did that, but then upon moving the mouse, the monitor woke up, the password dialog showed up and the system froze.

Exactly as you describe, no ctrlaltdel, no dropping to tty, no pressing the power button, nothing helped, only hard power off.

Interestingly, there was nothing related to be found in /var/log/ files
I had something like that, but I think it was related to Suspend together with the timed monitor off. Now, the monitor can be turned off on timer ok.

You are right, though, it's probably Wayland related, but I will never stop using Wayland because Xorg is insecure as hell. It might be that it's a security thing that Wayland enforces, which is fine by me, if that's what it is, ya know?
 
I've never experienced such a behavior on X11 with Mate DE and Compiz-reloaded. But it's with DP, HDMI or DP-over-USB.

Decades ago, X11 (at that era, XFree86) with twm or fvwm worked without issue on VGA switches via VGA switcher (which doesn't mimic as if VGA monitor is kept on connected when switched to another computer), but in this era I was using proprietary Accelerated X as GPU driver.

A bit later, I've used a monitor having 2 DVI-A inputs, switched without issue. But not sure how signalings were treated internally.

Never tried switching until any Wayland compositor is running.

It's not applicable with your case, but if the connection is via USB, your USB/TB port is driven by unsupported TB controller like Titan Ridge and already connected on powering on, disconnection could cause crash/hang/panic.
Not sure it applies to displays, as when I've been bitten the device was USB hub having SD slot in it or TB-only external SSD and they were identified as internal PCIe device that does NOT support hot plugging.
 
I know HDMI contains i2c signalling and I suppose you could put that bus into an error state. Maybe the external is sharing i2c with internal laptop screen. Disconnecting causes system bus error.
So I think this suggestion is worth trying:
Does this still happen if you remove the display before disconnecting the monitor?
I really don't think this is is KDE related but probably lower level.

I would try removing monitor via xrandr and then disconnecting physically. See if it survives.

VGA does not use i2c for signalling but it uses DDC for internal communications. Maybe the DDC bus is shared and erroring.
These internal protocols provide the OS with the different resolutions available for the monitor along with other things like frequency. EDID.

Perhaps an orderly monitor removal helps?
 
From a terminal window under your Window Manager you want to run xrandr to determine your DISPLAYS ID.
Possibly VGA0 or VGA1

From there disable the external monitor
xrandr --output VGA1 --off
Now try and physically disconnect the monitor.
 
From a terminal window under your Window Manager you want to run xrandr to determine your DISPLAYS ID.
Possibly VGA0 or VGA1

From there disable the external monitor
xrandr --output VGA1 --off
Now try and physically disconnect the monitor.
I'm on Wayland. xrandr doesn't work for this.
 
Try wlr-randr. Or better yet use kanshi

cat .config/kanshi/config
profile dock {
output HDMI-A-1 enable
output eDP-1 disable
}

profile main {
output eDP-1 enable
}
 
Back
Top