Thursday, March 22, 2012

Quick Configurations Make For Trouble

I'm a few days behind in my studies for the RHCSA. I've scheduled the exam which has the added effect of pressure to be done within a certain time frame even though, I can of course, reschedule. Who wants to do that though!

For labbing I enabled X11 over SSH and am running GUI tools like virt-manager and system-config-firewall (iptables shell commands changed with RHEL 6 and I'm working on gotten it all sorted out) while not at home. Even at home though, I connect via VNC from my Mac Pro to the VM server.


The VM server built with Scientific Linux 6 and Tigervnc (quasi Xvnc)  is their default VNC server from their SL repo. So, it is what I went with to get things up quickly.

[root@shuttlehosti ~]# yum search vnc server
...
tigervnc-server.x86_64 : A TigerVNC server
...
[root@shuttlehosti ~]# yum install tigervnc-server.x86_64
Done.

Ok, I installed, configured it under my user account, according to this post from server-world.info. Then checked to see if it was persistent through reboots and it wasn't. That's fine. I only wanted my user account to be able to have access, I wrote a super simple bash script and dropped it in my .bashrc file.

[root@shuttlehosti ~]# less /home/kim/vnc-start.sh

#!/bin/bash

vncserver :1 -geometry 1280x1024 -depth 24
/home/kim/vnc-start.sh (END)

...
[root@shuttlehosti ~]# less /home/kim/.bashrc

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions
/home/kim/vnc-start.sh
/home/kim/.bashrc (END)

Each time I log in to the machine it launches the vnc service for display :1 and fails out if display :1 is already open. Great until I have more time to focus on shell scripting. 

Yesterday, I started having issues with the VNC server and my connection attempts were getting refused. I would log out or reboot and try the connection and get be refused. Ok, disable IPtables, SELinux and try it again. Still nothing. Even running "vncserver -kill :1" didn't stop the process or allow me to log in.

So, whats the vnc process up to?  I do a

[root@shuttlehosti ~]#ps -efH | grep vnc
qemu      7458     1  0 Mar08 ?        00:01:28   /usr/libexec/qemu-kvm ...

 There are three processes just like that. Hmm 3 VMs up and running. Which means each VM  takes up a single vnc display when up and running. Curious. I checked out the VNC command options and came up with:

[kim@shuttlehosti ~]$ vncserver -list

TigerVNC server sessions:

X DISPLAY #     PROCESS ID
:2              5931
:1              4007
:3              4206
[kim@shuttlehosti ~]$

The processes correspond to the VM processes noted in the ps command. Jeez. Ok, I shutdown the VMs, kill off the vnc process if any are left, relaunch the vnc process under my user account, and it works like a charm.

The moral of the story? Don't rush through Linux technologies when you need to " to get things up quickly."

So, RHCSA studies can resume. After the exam I would like to figure out how to write a shell script to check for the next available vnc display and to open a IPtables port to allow for connection.

No comments:

Post a Comment