VNC without monitor connected

Hi All

I am very new to Linux and just installed Linux Enterprise Server 11, 32-bit version. Relatively easy I managed to install Oracle, JBoss and other software, connected to it via VNC. Once finished I decided to move the box to far corner and work with it via putty and vnc. But then problems with vnc started. Whenever I tried to connect via vnc I got background screen with cross cursor and then it stuck, no login screen. I spent a lot of time trying to fix it. I red many forums and this one in partucular : VNC is not working - openSUSE Forums Nothing helped. I have noticed that vnc doesn’t work if monitor not physically connected to the box. Once monitor connected, even if monitor is not powered up, vnc resumed to work correctly. But it looked senseless for me, what a point to have Linux box controlled via vnc if I still have to connect monitor, it drove me crazy !

Today I have found a solution and want to share with you. It is not my idea I have found it here :

K7V FreeNAS system won’t start without a monitor. - alt.comp.periphs.mainboard.asus | Google Groups

The idea is to create “fake monitor” which cheats graphic card, makes it think a monitor is connected. I have bought a VGA connector then:

Connect 75 ohm resistor from pin 1 to pin 6
Connect 75 ohm resistor from pin 2 to pin 7
Connect 75 ohm resistor from pin 3 to pin 8

Plug the connector into VGA slot and it is all!
It works ! VNC work now correctly.

However I am still wondering what the real problem is ? Is it a bug ? wrong configuration ? or is it how it should be ? I still would like to solve the problem without using the fake monitor. If anyone knows an answer please tell me.

Regards,
Thanks in advance

ksv689

I know this is an old thread but this is something people may be searching for. The “fake monitor” approach is not needed if you know how to use vncserver. I use it on my machines that don’t and probably never will have a monitor connected (after install).

First, I change /etc/inittab default run level from 5 to 3. This is because OpenSUSE doesn’t like to boot to level 5 correctly if a monitor is not detected. I’m not just talking about the desktop either. Some might argue this isn’t the case but, trust years of experience, even if you get it to work for a while it will eventually stop working. I still haven’t figured out why shrug. If you’re not familiar with OpenSUSE this is near the top of the file and should look like this after the change:

# The default runlevel is defined here
id:3:initdefault:

Second, I create a daemon file in /etc/init.d called vncdaemon with the following contents:

#! /bin/sh
#
# /etc/init.d/vncdaemon
#
##########################################################################
# Provides: vncserver
# chkconfig: 345 85 15
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start the sshd daemon
# description: System startup script for running persistent VNC X11 server
# config: ~\.vnc\startvnc
##########################################################################

. /etc/rc.status

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

# First reset status of this service
rc_reset

# Source function library.
#. /etc/init.d/functions

# Source networking configuration.
#. /etc/sysconfig/network

# Check that networking is up.
# ${NETWORKING} = "no" ] && exit 0

export HOME=/home/myusername
export USER=myusername

prog=$"VNC daemon"
DISPLAY=3
GEOMETRY=1024x768

case "$1" in
    start)
	$0 stop
       sleep 3
	echo -n "Starting $prog:"
	su ${USER} -c "vncserver -geometry ${GEOMETRY} :${DISPLAY}"

	rc_status -v
	;;
    stop)
	echo -n "Shutting down $prog:"

	su ${USER} -c "vncserver -kill :${DISPLAY}"
       sleep 3
	rm /tmp/.X11-unix/X3

	rc_status -v
	;;
    try-restart)
        $0 status >/dev/null &&  $0 restart

        rc_status
        ;;
    restart)
        $0 stop
        sleep 3
        $0 start

        rc_status
        ;;
    status)
	echo -n "Checking for $prog: "

        # Status has a slightly different for the status command:
        # 0 - service running
        # 1 - service dead, but /var/run/  pid  file exists
        # 2 - service dead, but /var/lock/ lock file exists
        # 3 - service not running

	checkproc Xvnc

	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart}"
	exit 1
	;;
esac
#rc_exit

 

I included some commented out lines that you may need depending on your system configuration. This approach has worked reliably for servers and auto-reboot systems that are constantly rebooting to clear before running tests. The HOME env var is required by vncserver (if I remeber correctly) so it knows where to look for config and startup files. Make the file executable and set it to run at startup:

chmod +x /etc/init.d/vncdaemon
chkconfig vncdaemon 35

Third, back in your user’s home directory you may find the ~/.vnc directory. If you don’t see it (make sure hidden files are visible) run vncserver and it should create it. Once it’s there find or create a file called xstartup with the following contents:

#!/bin/sh

startkde

Or you could start your prefered desktop manager here.

Forth, setup vncserver options or if you don’t like vncserver’s options or features all that much you can run x11vnc on top of vncserver using an autostart script and it works beautifully. Just reboot and test and you should be all set.

kwik correction under the stop section:
rm /tmp/.X11-unix/X3

should be:

rm /tmp/.X11-unix/X${DISPLAY}