No signal on monitor after plug it to a linux box

I use my old computer as an NAS, so I remove the monitor after I installed linux on it (disconnect vga cable). I use ssh to control the machine and it works fine. Until some day, after kernel/softare upgrade or messing up some configs, I cannot connect to it through ssh, then I have to plug the monitor back, but the monitor says "No input signal". So I have to restart the computer WITH the monitor connected, and the monitor's back!

I think the computer/linux kernel doesn't detect the monitor plug-in event. So how can I start my linux box without a monitor, but when it goes wrong I can still plug my monitor (vga) back and use the console.

Edit: just one pci-e video card, has dvi, vga, tv/out (s-video)

Edit2: Xorg is not running. I just need the console (CTRL+ALT+F1). The problem is, if the machine booted without a monitor connected, it won't give me a pseudo terminal after I attach the vga cable while it's running. Clearly the monitor is not auto detected as usb device. I'm wondering how to let the monitor auto detected.


This maybe years too late however I was coming across the same issue when I ran into this question but no suitable answer has been given, and I imagine other people having the same problem have came across this question as well.

My fix that seems to work brilliantly is to trick the kernel into thinking a VGA is already connected by adding a kernel parameter (this might be specified in the grub configuration file) which is

video=VGA-1:e

the video parameter could be specified more than once for the kernel so if you already have a video= parameter then just add a new video= parameter (unless of course the existing parameter you believe would conflict with the above fix)


adam3141's answer is great! I still don't have enough reputation to up-vote it but it's definitly the best answer for this problem I've been looking for days!

The solution works both if a monitor is connected or not, and in both cases you can remote connect with x11vnc. It also allows to connect a monitor AFTER the X server has been started if needed.

By default, with this configuration, the X server will use a 1024x768 resolution because it cannot read the supported resolutions from the monitor. To fix this you can change the configuration of the default monitor in /etc/X11/xorg.conf (create the file if it does not exist) and add the modelines to support the resolutions you want. For example:

Section "Monitor"
    Identifier "<default monitor>"
    Modeline "1680x1050" 146.25 1680 1784 1960 2240 1050 1053 1059 1089
EndSection

By the way, you can find more info on the "video" kernel parameter here: http://distro.ibiblio.org/fatdog/web/faqs/boot-options.html