Showing posts with label X. Show all posts
Showing posts with label X. Show all posts

2012-01-13

Xvnc black screen

I was configuring my workstation for remote VNC login following this blog post.
The checklist ends suggesting a reboot command.
If you don't obey, you'll only get a black screen on a VNC connection.
That seems to break the spell: no reboots under linux!

After some investigation it seems that the cause was gdm not accepting tcp connections from Xvnc.
A full reboot is not necessary, just a gdm restart:

Find the gdm instance started by init:

# ps -ef --forest

search the process tree for something like this:

root      3621     1  0 14:35 ?        00:00:00 /usr/sbin/gdm-binary -nodaemon
root      3707  3621  0 14:35 ?        00:00:00  \_ /usr/sbin/gdm-binary -nodaemon
root      3713  3707  0 14:35 tty7     00:00:00      \_ /usr/bin/Xorg :0 -br -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7
gdm       3734  3707  0 14:35 ?        00:00:00      \_ /usr/libexec/gdmgreeter

the parent gdm here has PID 3621

# kill -1 3621

The console X session will restart, and after that, VNC logins will work.

Update:
On RHEL/CentOS 6, you must use kill -9 to reload gdm, and the vnc-server package is called tigervnc-server

2011-09-19

An alternative to Xming: an X Window virtual appliance

sometimes Xming misbehave connecting to some machines, so i devised a way to use a real, native, X server on a windows desktop.

install VMware player and create a new VM with the following parameters:
128MB
1CPU
5GB HD
NAT networking

i used Red Hat 5, but other linux distribution will do: just make sure you choose one that supports Unity (seamless integration of VM windows on the Windows host desktop).
install only the base X, and do not select any graphic desktop.

after base OS install, add the packages that are needed to support graphics connections:

yum install gnome-terminal
yum install *metacity*
yum install gnome-themes
yum install gnome-session

make sure VMware tools are installed by now
edit Xclients to make sure a terminal is spawned at startup

#vi /etc/X11/xinit/Xclients

change the bottom of the file to look like this:

# Argh! Nothing good is installed. Fall back to twm
{
    # gosh, neither fvwm95 nor fvwm2 is available;
    # fall back to failsafe settings
    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'

#    if [ -x /usr/bin/xclock ] ; then
#       /usr/bin/xclock -geometry 100x100-5+5 &
#    elif [ -x /usr/bin/xclock ] ; then
#       /usr/bin/xclock -geometry 100x100-5+5 &
#    fi
#    if [ -x /usr/bin/xterm ] ; then
#        /usr/bin/xterm -geometry 80x50-50+150 &
#    fi
#    if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
#       /usr/bin/firefox /usr/share/doc/HTML/index.html &
#    fi
    if [ -x /usr/bin/metacity ] ; then
        /usr/bin/gnome-terminal &
        exec /usr/bin/metacity
    fi
    if [ -x /usr/bin/twm ] ; then
        exec /usr/bin/twm
    fi
}


add an unprivileged user

#useradd user

enable it to sudo

#visudo

add this line at the end of file

user    ALL=(ALL)       NOPASSWD: ALL

set autologon to user

#vi /etc/gdm/custom.conf

in the [deamon] section add the following lines

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=user


now it's time to trim down the VM by stripping all the unneeded packages:

yum remove yum-updates ypbind wpa_supplicant wdaemon
yum erase xinetd yum-updatesd
yum erase vnc-server
yum erase openssh-server smart* sendmail*
yum erase system-config-*
yum erase nfs*
yum erase cyrus-sasl
yum erase rhnsd
yum erase readahead*
yum erase iputils
yum erase portmap pcsc* bluez*
yum erase anacron
yum erase atd
yum erase audit
yum erase cups
yum erase dnsmasq
yum erase iptables*
yum erase krb5*
yum erase krb5-wo*
yum erase mcstrans
yum erase ntp psacct
yum erase irda*

and switch off what we can't remove

chkconfig atd off
chkconfig avahi-daemon off
chkconfig avahi-dnsconfd off
chkconfig gpm off
chkconfig mcstrans off
chkconfig netfs off
chkconfig restorecond off

create a windows shortcut to start your VM in Unity mode like this:



put a "-U" before the pathname of your vmx file: that will cause the VM to startup in Unity mode.
Launching that shortcut will open a gnome terminal right on your desktop.
From there you can connect to other machines with

ssh -X l user remotehost

and then run any graphic application alongside other windows applications on your desktop.