Bug 1794660 - problem with default shell in xfce when using x2goclient
Summary: problem with default shell in xfce when using x2goclient
Keywords:
Status: MODIFIED
Alias: None
Product: Fedora
Classification: Fedora
Component: x2goclient
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-24 09:24 UTC by Jos de Kloe
Modified: 2020-01-25 04:28 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Jos de Kloe 2020-01-24 09:24:42 UTC
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.

Details:

* 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
gives me:

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:

remote versions:
xfce4-session-4.14.0-1.fc30.x86_64
x2goserver-4.1.0.3-3.fc30.x86_64
environment-modules-4.2.4-1.fc30.x86_64

local versions:
x2goclient-4.1.2.1-5.fc31.x86_64

How reproducible:

always

Steps to Reproduce:
1. connect to the remove system using x2go
2. start a fresh xfce desktop session
3. open any terminal window

Actual results:

the terminal uses /bin/bash as shell

Expected results:

the default shell for the users, in my case /bin/tcsh, should be used.

Additional info:

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.
Versions:
xfce4-session-4.14.0-1.fc31.x86_64
environment-modules-4.3.0-1.fc31.x86_64

a local test with fedora 30 at my remote system did not reproduce the problem.
xfce4-session-4.14.0-1.fc30.x86_64
environment-modules-4.2.4-1.fc30.x86_64

so clearly the problem is in xfce or the interaction between x2go, xfce and the startup scripts in environment-modules.

Comment 1 Orion Poplawski 2020-01-25 04:28:01 UTC
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
--- a/x2goserver-xsession/etc/Xsession
+++ b/x2goserver-xsession/etc/Xsession
@@ -117,6 +117,10 @@ if ! echo "*" >>"$WRITE_TEST"; then
 fi
 rm -f "$WRITE_TEST"

+# Determine the users login shell and use that to launch the session
+SHELL=$(getent passwd $LOGNAME | cut -d: -f7)
+# Fallback
+[ -z "$SHELL" ] && SHELL=/bin/bash

 if [ -f /etc/debian_version ] || [ -f /etc/devuan_version ]; then

--
1.8.3.1

and reported here: https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1434


Note You need to log in before you can comment on or make changes to this bug.