[CentOS] odd problem with .vnc/xstartup and kdm [RESOLVED]

Thu Apr 25 02:26:08 UTC 2013
Miranda Hawarden-Ogata <hawarden at ifa.hawaii.edu>

On 2013/04/24 12:02, Miranda Hawarden-Ogata wrote:
> I recently switched our workstations from gdm to kdm, because I was 
> receiving some complaints with gdm about having to set the desktop 
> halfway through the login (versus being able to set it from the start 
> of the login process), as well as having the mile long list of 
> previous logins (which, by the way, if anyone knows how to turn that 
> off, lemme know, please!).
>
> After switching the window manager to kdm, we started having problems 
> with our vncserver sessions. Every single session was kde, without 
> regard for the contents of the xstartup file for that particular user. 
> I have users that want gnome and others that want kde, and some 
> project accounts that use some other custom stuff, so obviously this 
> was a problem.
>
> The only "configuration" I did after yum group-installing KDE-Desktop 
> was to set up the /etc/sysconfig/desktop file to contain:
> DESKTOP="KDE"
> DISPLAYMANAGER="KDE"
>
> so I am not sure what is up with kdm to be causing this. I tried 
> looking online but only found some ancient debian/ubuntu questions 
> that are mostly unanswered or resolved in ways that won't work for us 
> (hard coding something in xinitrc, for example).
>
> So, does anyone have any ideas as to what is going on and what I can 
> do to resolve it? I am currently in the process of rolling back the 
> workstations to the gdm configuration as a "fix", but if possible I'd 
> really like to be able to actually sort out what is going on. Our 
> systems are not heavily customized, being "software development 
> workstation" installs with a few extra group installs (including the 
> centos base tigervnc-server package) and a handful of third-party 
> rpmforge packages installed, and kdm seems to work properly on the 
> console (allowing selection of other desktops, etc), it's only with 
> the ~/.vnc/xstartup that we are having issues.
>
> Thanks!
> Miranda
>
>

For anyone in the future trying to figure this out, thought I'd post. 
Turned out that the "default" xstartup that I thought was explicitly 
calling gnome was not doing so, and was calling the system default 
desktop instead. Once I explicitly called gnome via a gnome-session 
script call in xstartup, the problem was resolved.

Although a great many of the online instructions for setting gnome as 
your vnc desktop tell you to unset some variables and then call startx, 
all that does is call the system default desktop, which is fine and 
dandy if you're running gdm as your manager, but completely worthless if 
you are running kdm. You need to explicitly call gnome-session instead 
of startx, and you can also dump everything else in the "default" file 
as it is not necessary. A functional xstartup can be as barren as:

(gnome)
#!/bin/sh
gnome-session &

(kde)
#!/bin/sh
startkde &

Hope this helps someone in the future :D

Thanks!
Miranda