Description of problem:
It seems the default shell is not activated when starting a terminal session within xfce when working remotely using x2go. Something seems wrong in the startup procedure, at least for my specific usecase.
* I am using a remote xfce4 desktop using x2go
* my default shell is tcsh
* I have no $HOME/.xfcerc file
* the problem persists even if I go to text mode and remove the $HOME/.config/xfce folder
The problem is that my terminals do not use the default tcsh when I open them. It is not just the xfce4-terminal, but it happens in other terminal types
as well (tested with konsole and mate-terminal as well).
The reason is displayed in $HOME/.xsession-x2go-$MACHINENAME-errors
This command: head -2 $HOME/.xsession-x2go-$MACHINENAME-errors
XSession-x2go: X session started for $USER at do 23 jan 2020 10:28:20 MET
/usr/share/Modules/init/tcsh: eval: line 3: syntax error near unexpected token `alias'
/usr/share/Modules/init/tcsh: eval: line 3: `if ( $?histchars && $?prompt ) alias module 'set _histchars = $histchars; unset histchars; set _prompt=$prompt:q; s
et prompt=""; eval "`/usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl tcsh \!*:q`"; set _exit="$status"; set histchars = $_histchars; unset _histchars; s
et prompt=$_prompt:q; unset _prompt; test 0 = $_exit' ;'
/usr/share/Modules/init/tcsh: line 15: syntax error near unexpected token `alias'
so to me it seams this
"/usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl tcsh"
call generates a piece of tcsh script, but then the system tries
to use bash to execute it.
Version-Release number of selected component (if applicable):
This combination gives me the problem:
Steps to Reproduce:
1. connect to the remove system using x2go
2. start a fresh xfce desktop session
3. open any terminal window
the terminal uses /bin/bash as shell
the default shell for the users, in my case /bin/tcsh, should be used.
the problem does not occur if I start a local xfce session. Tested this both on my local and on the remote system. Details:
a local test with fedora 31 on my laptop did not reproduce the problem.
a local test with fedora 30 at my remote system did not reproduce the problem.
so clearly the problem is in xfce or the interaction between x2go, xfce and the startup scripts in environment-modules.
There are a number of things interacting here, namely:
- x2go launches everything with bash to have a consistent scripting language
- Fedora sets SHELL=/bin/bash via (sometimes ~/.bash_profile ->) ~/.bashrc -> /etc/bashrc
- /etc/x2go/Xsession launches the session with a login shell using $SHELL
- With SHELL set, xfce4-teminal uses that for new terminals
One workaround is to remove (or move) your ~/.bash_profile and ~/.bashrc files - but this will hobble bash if you ever do use it for a terminal shell. But the session is still launched with bash which still leads to the module errors you reported (though these I think are more symptom than cause).
This is the patch I've proposed to upstream (this gets installed as /etc/x2go/Xsession):
diff --git a/x2goserver-xsession/etc/Xsession b/x2goserver-xsession/etc/Xsession
index 270a0b3..522f37e 100755
@@ -117,6 +117,10 @@ if ! echo "*" >>"$WRITE_TEST"; then
rm -f "$WRITE_TEST"
+# Determine the users login shell and use that to launch the session
+SHELL=$(getent passwd $LOGNAME | cut -d: -f7)
+[ -z "$SHELL" ] && SHELL=/bin/bash
if [ -f /etc/debian_version ] || [ -f /etc/devuan_version ]; then
and reported here: https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1434