'startxfce4' loads a XFCE session instead of a Xubuntu session

Asked by adisharoon

I've installed Xubuntu 11.04 64 bit on a desktop that will be accessed remotely using NX Client. In the NX Client settings I have it configured to run 'startxfce4', as there is no preset for XFCE like there is with KDE and GNOME.

This works, and I can connect to the remote machine. However, the background, panel layout, applications menu, and other "look & feel" features are dramatically different from the standard default Xubuntu appearance that I see when I log in while physically at the desktop. This is identical to if I had selected "XFCE Session" instead of "Xubuntu Session" at the login screen while physically at the desktop.

What 1 line command should I have NX Client use to properly run a Xubuntu session? Every article and post I've seen before just says to run 'startxfce4'.

Thanks

Question information

Language:
English Edit question
Status:
Expired
For:
Ubuntu xubuntu-meta Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Ben Shadwick (benshadwick) said :
#2

I'm using x2go, which is derived from NX. This has been bugging me for months as well.

I recently got x2go working via XDMCP and was able to see a proper Xubuntu desktop remotely. I wanted to use pure NX/x2go protocols, however, so I did some digging:

GDM's XDMCP login screen eventually launches /usr/share/xubuntu/session.sh, which is a wrapper for startxfce4 that sets $XDG_DATA_DIRS (if not already set). I had already been using this from x2go, so I figured there must be some other environmental difference that I was missing. I modified session.sh to dump the output of 'set' to a text file, and noticed that a totally different set of environment variables was set when connecting via XDMCP versus NX/x2go.

I then created a wrapper script of my own that set some of those variables and then called session.sh. It worked! Finally, I narrowed it down until I found the single variable that was making it work. Here is my script that I point x2go at to get a proper login:

     export XDG_CONFIG_DIRS='/etc/xdg/xdg-xubuntu:/etc/xdg'
     exec /usr/share/xubuntu/session.sh

Note that you'll probably need to clear out anything in your home directory with "xfce" or "xfwm" in the name in order to reset t Xubuntu desktop defaults.

Also, it looks like $XDG_CONFIG_DIRS is supposed to sort of be set by /etc/X11/Xsession.d/60xdg_path-on-session which is supposedly sourced by Xsession, which in turn is run by startx or gdm or something. I'm not sure where things are breaking down.

Revision history for this message
adisharoon (alecdisharoon) said :
#3

I actually did figure this out, basically the same way as Ben above, with the addition of one environment variable. Here's the script I call instead of startxfce4:

#!/bin/bash
nxnode=$(ps -o ppid= -p $PPID)
nxagent=$(pgrep -P $nxnode -u $USER -x nxagent)
export XDG_DATA_DIRS="/usr/share/xubuntu:/usr/share/xubuntu:/usr/local/share/:/usr/share/:/usr/share"
export XDG_CONFIG_DIRS="/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg"
export XDG_MENU_PREFIX="xfce-"
${1+"$@"}
exec kill $nxagent

Revision history for this message
Ben Shadwick (benshadwick) said :
#4

adisharoon: Thanks for the follow-up. I see that one of the additional variables you're defining is XDG_DATA_DIRS, which is set for me by calling /usr/share/xubuntu/session.sh instead of startxfce. Can you explain what the first and last couple lines of your script do?

Revision history for this message
adisharoon (alecdisharoon) said :
#5

Sure,

Sure - though they might not be needed for NX variants like x2go, and I don't understand all the details (I stole those lines from some other site when searching for answers originially). Also, I misspoke above - I don't actually run that script ("nxwrapper") _instead_ of startxfce4; I run it like this:

/usr/NX/bin/nxwrapper /usr/bin/startxfce4

When using Nomachine NX with Xubuntu, the NX server / node does not properly tell the remote client to close when you log out of or shut down Xubuntu. Instead, the client is left showing a black screen. Those lines get it to tell the client to close when the server closes the NX session.

One drawback of my method is that it might not make use of Xubuntu's native session feature. I don't actually use it personally, so I don't know from experience - I just set it up for some of our developers.

Alec

Revision history for this message
Ben Shadwick (benshadwick) said :
#6

Cool, thanks. I haven't had any trouble logging out of Xubuntu when logged in via the x2go client, so I guess my solution is okay for x2go.

Revision history for this message
yaztromo (tromo) said :
#7

I just want to add that the solution proposed adisharoon is not working for me in 12.10

The error in syslog on the server is
May 13 09:08:23 zarniwoop NXSERVER-3.5.0-11[3433]: ERROR: nxssh process exited with '255' 'NXNodeExec::exec'
May 13 09:08:26 zarniwoop NXSERVER-3.5.0-11[3433]: Session '9D67520882D7552274802C687620A3EF' started by user 'john'. 'NXShell::handler_session_start'
May 13 09:08:26 zarniwoop NXSERVER-3.5.0-11[3433]: ERROR: run command: no child process with pid 3569 Logger::log nxserver 3131

I just dumped the script in a file and and gave it execute permissions. Then I call it from the remote client with /usr/local/bin/startxfcenx.

Also my /usr/NX/bin directory does not have an "nxwrapper":
john@zarniwoop:~$ /usr/NX/bin/nx
nxagent nxclient nxesd nxkill nxnode nxprint nxsensor nxserver nxservice nxspool nxssh nxstat nxuexec

Currently I am getting nx to work by calling /usr/bin/xfce4-session. Then terminating the session (because of the black screen bug) after I log out.