Detecting remote monitor in Live session Debian via CLI
Hello everyone :),
I have a Debian system in a Live session (custom Clonezilla with, among other things, useful packages for system and network administration), which I access remotely via SSH (no GUI, just CLI). From there, I want to test various VGA monitors (unplugging and replugging) on VGA and Display Port, and see that they work. The problem is that as soon as I unplug the first monitor, when I replug the next one (functional, I should add), the screen remains black and it is not detected.
In this scenario, what would you do to re-detect the monitors without having to reboot and reload the Live session (currently, it is performing a delicate task that cannot be interrupted)?
The idea behind this is to be able to use a "Live session" for various operations without having to restart it, including testing non plug-and-play hardware.
I’m not sure if my request is clear; I can clarify ...
Note: to be sure we are on the same page, there is no Xorg environment or anything since it's CLI.
With friendship,
lnj
6 answers
Hello lenainjaune,
The only command I know to list the screens (including the "DP" you mentioned) is the xrandr command, which as its name suggests relies on the graphical server.
In principle, you can manage with the content of /sys/class/drm which is populated even if you don't have a graphical server.
(mando@silk) (~) $ ls /sys/class/drm card0 card0-eDP-1 card0-HDMI-A-1 renderD128 version It would be interesting to see what the logs say when you plug/unplug a screen:
sudo tail -f /var/log/*
Good luck
Hello,
There's something I don't understand in your question: if you have the ability to change the screen on the computer, why do you need ssh? Why not work directly with the operating system running on the computer to which you're connecting your screens?
In theory, even in text mode, your video card is supposed to recognize when you connect/disconnect a screen. Is it not simply that your screen has multiple input interfaces (like VGA, DVI, display port) and isn't reading the signal from the correct input? If that's the case, it's not an issue at the Linux level but rather something that needs to be addressed at the screen's button level?
Good luck
Hello mamiemando and thank you for helping me once again ;)
After booting the Live USB, I started the delicate process while the monitor was connected to the VGA port and functioning. As I wanted to test a Display port-VGA adapter and didn't have another screen, I unplugged it from the VGA connector and plugged it into the DP. Since I had no display, I switched back to the VGA which no longer shows anything either!
I know that in a standard system (let's say Debian), you can plug/unplug without rebooting but since I'm in a Live environment, the usual processes that refresh things might not be running.
What I would like to know is how screens are detected behind the scenes so I can re-trigger their detection without having to reboot, etc. I've already done this for USB (for example, see this thread), so it should be possible.
PS: off topic, but I still have a response to give you since some time (see here) but since I haven't returned to the subject, I haven't had the chance to respond. It will come soon, as I need to boost the old laptop in question for my partner.
Hello,
It may be necessary to reattach the console with the display:
echo 1 > /sys/class/vtconsole/vtcon0/bind
(to be adapted according to the vtconX on your system)
See here: https://www.kernel.org/doc/html/latest/fb/fbcon.html
Hello :)
I believed it ... but it didn't work, but that's the kind of response I'm looking for.
Note:
- for the vtconX I have vtcon0 and vtcon1 and the operation didn't yield anything on either of them
- weirdly, the DP since this Live Session supports plug and play, but not the VGA (?)
- from another live session on another PC (which I was able to test temporarily during the break), the VGA works in PnP
In the end, I don't know why I'm not seeing the same behavior on the two machines.
Note: I will study the link you proposed carefully but not now because I have urgent matters and especially I don't have Internet at home yet after a move (I'm at work right now).
Hello,
You might try removing (modprobe -r ...) and then reloading (modprobe ...) the driver(s) corresponding to your GPU, although this can lead to unstable behaviors or freezes.
Another technique could be to eject the GPU and then scan the PCI devices to locate it again. See here.
I seem to have noticed this during the Live session (I can't confirm it due to a hardware issue - see below):
- if I connect the screen via DP before booting the system, the VGA will be unavailable
- if I connect the screen to the VGA, the DP will be unavailable
To top it all off, I just found that out of the 2 DP-VGA adapters we just ordered, the first one never worked and the second one was working but now has erratic behavior (real nice sh*t, huh!), so while waiting for the replacement DP adapters, I can no longer test the DP.
However, I gathered the information and followed your suggestions.
Information gathered:
root@cz-live:~# dmidecode -t 8 | awk -v RS="" -v ORS="\n\n" '/VGA|DISPLAY PORT/' Handle 0x001A, DMI type 8, 9 bytes Port Connector Information Internal Reference Designator: 00H Internal Connector Type: None External Reference Designator: VGA Port External Connector Type: DB-15 female Port Type: Video Port Handle 0x001B, DMI type 8, 9 bytes Port Connector Information Internal Reference Designator: 00H Internal Connector Type: None External Reference Designator: DISPLAY PORT External Connector Type: Other Port Type: Video Port root@cz-live:~# lshw -c display *-display NON-CLAIMED description: VGA compatible controller product: 2nd Generation Core Processor Family Integrated Graphics Controller manufacturer: Intel Corporation hardware identifier: 2 bus info: pci@0000:00:02.0 version: 09 bits: 64 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list configuration: latency=0 resources: memory:e0c00000-e0ffffff memory:d0000000-dfffffff ioport:3000(size=64) memory:c0000-dffff *-graphics product: VESA VGA hardware identifier: 1 logical name: /dev/fb0 capabilities: fb configuration: depth=16 resolution=800,600 root@cz-live:~# lspci -vv | awk -v RS="" -v ORS="\n\n" '/ VGA /' 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller]) DeviceName: Onboard IGD Subsystem: Dell 2nd Generation Core Processor Family Integrated Graphics Controller Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0 Interrupt: pin A routed to IRQ 11 Region 0: Memory at e0c00000 (64-bit, non-prefetchable) [size=4M] Region 2: Memory at d0000000 (64-bit, prefetchable) [size=256M] Region 4: I/O ports at 3000 [size=64] Expansion ROM at 000c0000 [virtual] [disabled] [size=128K] Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit- Address: 00000000 Data: 0000 Capabilities: [d0] Power Management version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME- Capabilities: [a4] PCI Advanced Features AFCap: TP+ FLR+ AFCtrl: FLR- AFStatus: TP- Kernel modules: i915 Your suggestions:
root@cz-live:~# echo 1 > /sys/bus/pci/rescan => KO the screen remains off root@cz-live:~# lsmod | grep i915 | sort cec 61440 2 drm_dp_helper,i915 drm 614400 5 drm_dp_helper,drm_kms_helper,drm_buddy,i915,ttm drm_buddy 20480 1 i915 drm_dp_helper 159744 1 i915 drm_kms_helper 192512 2 drm_dp_helper,i915 i2c_algo_bit 16384 1 i915 i915 3166208 0 ttm 86016 1 i915 video 57344 1 i915 root@cz-live:~# modprobe -r i915 root@cz-live:~# lsmod | grep i915 | wc -l 0 root@cz-live:~# modprobe i915 root@cz-live:~# lsmod | grep i915 | wc -l 9 => KO the screen remains off root@cz-live:~# for d in $( find /sys/bus/pci/devices -maxdepth 1 -type l ) ; do echo 1 > "$d/rescan" ; done => KO the screen remains off Note: I don't know how to check if the system detects the screen via DP in Live Session in CLI, so outside of a graphical X session (xrandr); in particular journalctl -f does not show any activity ...
Hello,
Reloading the graphics card module can indeed unlock the solution. But in my opinion, you should ensure that the acpid and udev packages are properly installed on your live system.
sudo apt update sudo apt install udev acpid acpi-support-base
If that doesn’t help, have you looked at this tutorial and are you able to apply it?
Good luck
In my case, it was missing: acpi-support-base acpid and the dependency libudev1
I tried (see post #7):
root@cz-live:~# echo 1 > /sys/bus/pci/rescan root@cz-live:~# modprobe -r i915 root@cz-live:~# modprobe i915 root@cz-live:~# for d in $( find /sys/bus/pci/devices -maxdepth 1 -type l ) ; do echo 1 > "$d/rescan" ; done and a VGA->DP hot-plug
=> KO the screen remains off
I'm going to test the tutorial, but I feel like it requires an X server, in my case I'm only in CLI.
{edit]
udevadm monitor doesn't seem to detect the plugs/unplugs of the monitors
Any idea:
I can find the driver for VGA (here i915) using lspci -vv but how do I find it for DP since it is not listed by lspci?
[/edit]
Hello,
Regarding message #16:
Yes, xrandr requires that the graphical server is running. Be careful, it should not be launched as root (since there is no reason for it to be), just as the graphical server. So this is not a good track if you don’t want to install and run a graphical server.
Back to your problem
Regarding /sys/class/drm, it is populated by the video card driver (see for example this discussion and this discussion), but on a live system, there is a good chance that you are loading only very basic modules to support it. This would explain why in your case /sys/class/drm is empty.
In the case of your video card, see this link. Fortunately, I have this video card on my laptop, so here are the modules that are loaded under normal conditions:
(mando@silk) (~) $ lsmod | grep i915 i915 2965504 76 drm_buddy 20480 1 i915 i2c_algo_bit 16384 1 i915 drm_display_helper 180224 1 i915 cec 61440 2 drm_display_helper,i915 ttm 90112 1 i915 drm_kms_helper 192512 2 drm_display_helper,i915 drm 602112 17 drm_kms_helper,drm_display_helper,drm_buddy,i915,ttm video 57344 2 asus_wmi,i915 I think that in your case, loading the drm module should be enough to cascade-load all the aforementioned modules and populate /sys/class/drm. As root or via sudo:
modprobe drm ls /sys/class/drm
Good luck
So the DPs are not listed but I wanted to dig deeper into the drm issue:
=> there seems to be the drm_dp_helper driver (dp = Display Port ?)
PS: seems confirmed by https://sources.debian.org/src/linux/5.10.140-1/include/drm/drm_dp_helper.h
By the way, thanks :) for tail -f /var/log/* which is very handy for watching the progress in all files (I was using tail -f on a single file)
I forgot:
Does not detect anything regarding VGA/DP plug/unplug
Can you confirm that xrandr is not installed? If that's the case, can't you consider a more complete live version (for example, Ubuntu) to have it?
Since this is a CLI session, there is no X server.
Yes, I could try another Live Session (I tested Porteus based on Slackware which I found really great in graphical Live session). But I admit I have a soft spot for Clonezilla based on Debian that I know well (simple, light, fast, configurable as I wish because I know how to add all the packages I need into the internal image). Also, I don’t want to multiply the supports. I prefer to have a few and be able to do everything with them (or almost).
Unrelated, but I’m currently trying to find a solution to defragment a Windows system ... from Linux (which would spare me all the MicromSoft tools and allow me to stay on my Live Session).
But beyond that, I’d like to understand ... and I imagined it would be simpler (earlier I was talking about a solution to refresh USB device recognition, if you're following the thread, there's a dev who created a tiny program to compile and run that works wonders)!
I’m leaving the thread open and when I have more expertise on the subject, I’ll give feedback (I believe in it :) )
Good luck