How to configure X server to work headless as well with any monitor connected?

I have Debian installed on USB flash with special interactive and non-interactive GUI software. I want to boot Debian and start this applications on different systems which are quite different: servers are headless, workstations with CRT, DVI or HDMI monitors.
Is it possible to create universal xorg.conf for work headless and with monitor without change any settings from one case to another?
I tried play with ConnectedMonitor option (Option “ConnectedMonitor” “CRT-0, CRT-1, HDMI-0, HDMI-1, DVI-I-0, DVI-I-1”). Headless mode works fine, on systems with connected monitors I have mess of multiple “connected” outputs which cause problems with desktop environment.

Currently, no. I added an AllowEmptyInitialConfiguration (and corresponding nvidia-xconfig --allow-empty-initial-configuration) option for exactly that scenario that should first show up in the 331.* driver series.

Hello,

I have managed to start Xserver without any screen attached to server.

First: I have created xorg file with nvidia-xconfig tool.
Second: I have set Option “AllowEmptyInitialConfiguration”

Now I can connect to machine with VNC but I can not set a resolution bigger than 640x480

[ 9.672] (II) NVIDIA(0): Virtual screen size determined to be 640 x 480
[ 9.697] (WW) NVIDIA(0): Unable to get display device for DPI computation.

Do you know how can I set a bigger resolution for virtual screen?

Regards,

David

Just add to the Screen Section of xorg.conf

SubSection     "Display"
        Virtual     1920 1080
    EndSubSection
2 Likes

It worked.

Thank you!

Aaron, When we upgraded from Debian 9 to Debian 10, this advice stopped working. Headless machines do indeed boot, but the advice:

Just add to the Screen Section of xorg.conf

SubSection “Display”
Virtual 1600 1200
EndSubSection

…no longer works; the display comes up with much less resolution. Things work fine if we (1) connect a monitor and (2) systemctl restart lightdm, but that’s a pretty inconvenient procedure to use every time we reboot.

We’re using Nvidia Quadro 600 cards in our (most of the time) headless machines.

will it work for Jetson NX?
Any alternatives?

I think you missed the Identifier. It works for me when I put :

(...omission of contents)

Section "Screen"
    Identifier    "Default Screen"
    Monitor       "Configured Monitor"
    Device        "Configured Video Device"
    DefaultDepth  24
    SubSection    "Display"
      Depth       24
      Virtual     1920 1080
    EndSubSection
EndSection
2 Likes

That wasn’t the problem. The problem remains; if the monitor is connected at boot time, it works. If it wasn’t connected, I have to restart X before it works. Here’s my entire “Screen”:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration" "True"
    SubSection     "Display"
        Depth       24
        Virtual     1600 900
    EndSubSection
EndSection