Subject: Bug#1200: Environment variables not set

From: Bruno CAPELETO <[email-masked]>
Date: Thu, 10 Aug 2017 12:24:20 +0200

Package: <x2goserver>
Version: <4.0.1.20-0x2go1+git20170412.1125+9.main.1>

# uname -a
Linux mtcie1 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1 (2017-06-18)
x86_64 GNU/Linux

The below bugs are most probably related to each other, that's why I open
one case for all of them.

The issues are the following : I want to use the French software Laurux,
which is based on Gambas interpreter, via a x2go session running on a
Debian 9 server running LXDE (same issues seen on an Ubuntu server,
x2goserver version = 4.0.1.20-0~1125~ubuntu14.04.1)..

As a prerequisite, the software is installed on the server and runs well on
a local session.

1. Whatever the client (Windows or Linux 4.0.3.1-4), the local environment
variables are not set properly and the software - which needs French
localization - crashes. That could be "solved" the following way :
/etc/x2go/Xsession :

...
LANG=fr
LC_ALL=fr_FR.UTF-8
export LANG
export LC_ALL
...

That seems to be a revival of older bugs, but it is definitely still here.

2. At the start of a new session, one gets a windows with an error message
"No session for pid ..." ; that bug has already been reported several times
in x2go bug tracking and marked as solved. Actually it is not on my brand
new system.

3. The single application mode does not work with some of the applications,
including that Laurux / Gambas. For example it works with /usr/bin/leafpad,
but /usr/bin/libreoffice makes the x2go session crash.

4. The mouse double clic does not work in a x2go session, but only
- within the Gambas software (works well for example when launching an
application) and only
- when the x2go client is running in a Windows environment (no problem when
client in a Linux environment)

Many thanks in advance for any support,
Bruno

---

From: Ulrich Sibiller <[email-masked]>
Date: Thu, 10 Aug 2017 14:00:35 +0200

Hallo Bruno,

AFAIK the current version of x2go is 4.1.something. Please try that one.

Besides, your list contains an unusual number of problems at once. Are
you sure your system is setup properly?

Uli

On Thu, Aug 10, 2017 at 12:24 PM, Bruno CAPELETO
<[email-masked]> wrote:
> Linux mtcie1 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1 (2017-06-18) x86_64
> GNU/Linux
>
>
>
> which is based on Gambas interpreter, via a x2go session running on a Debian
> 9 server running LXDE (same issues seen on an Ubuntu server, x2goserver
> version = 4.0.1.20-0~1125~ubuntu14.04.1)..
>
> _______________________________________________
> x2go-dev mailing list
> [email-masked]
> https://lists.x2go.org/listinfo/x2go-dev

---

From: Bruno CAPELETO <[email-masked]>
Date: Thu, 10 Aug 2017 14:37:42 +0200

Yes I am sure my system is set up properly. By the way, keeping x2go apart,
everything is running well, including the software I would like to use via
x2go.

Now I updated with the x2go heuler section as you suggested :
4.1.0.0-0x2go1.2~git20170806.1410+9.heuler.1

The bugs 1,2,3 are all still there (I can not test the bug 4 as I have no
Windows environment next to me at the moment).

2017-08-10 14:00 GMT+02:00 Ulrich Sibiller <[email-masked]>:

> x86_64
> Debian

---

From: Ulrich Sibiller <[email-masked]>
Date: Thu, 10 Aug 2017 14:56:32 +0200

> localization - crashes. That could be "solved" the following way :

Hmm, the environment is usually set by the system. Is a local session
working properly?

An application that crashes because of missing locale vars is 100% buggy.

> in x2go bug tracking and marked as solved. Actually it is not on my brand

I have no idea about this, except: Maybe there are some relicts of a
previous version of x2go. It could help to manually remove all nx and
x2go related packages completely, clean the filesystem for remains and
retry,

> but /usr/bin/libreoffice makes the x2go session crash.

There are applications that fork themselves and return immediately,
which in turn causes the session to close down because there's no
client left. Please check if running xterm in single application mode
and starting those applications from there is working.

Uli

---

From: Bruno CAPELETO <[email-masked]>
Date: Thu, 10 Aug 2017 18:03:53 +0200

> Yes, local sessions are working properly.

> An application that crashes because of missing locale vars is 100% buggy.

Let's say 80% buggy :-)

> x2go related packages completely, clean the filesystem for remains and

I mixed it out : it was reported in LXDE mailing list. In my case it
happens only in combination with x2go (fresh install, without any nx mixup).

> and starting those applications from there is working.

x2go full session : xterm then /usr/bin/libreoffice -> works
x2go single application mode /usr/bin/xterm -> got the xterm, but typing
/usr/bin/libreoffice closes the session

---

From: Ulrich Sibiller <[email-masked]>
Date: Thu, 10 Aug 2017 21:28:27 +0200

>> An application that crashes because of missing locale vars is 100% buggy.

No, that's for sure a bug. No application may crash because of missign
env variables. Never!

> I mixed it out : it was reported in LXDE mailing list. In my case it happens
> only in combination with x2go (fresh install, without any nx mixup).

So this happens only when starting an LXDE session?

> /usr/bin/libreoffice closes the session

Really during typing, before pressing enter? That's very weird.

Uli

---

From: Bruno CAPELETO <[email-masked]>
Date: Thu, 10 Aug 2017 21:52:04 +0200

> No, that's for sure a bug. No application may crash because of missign

The issue is coma : "." in English and "," in French. So the MySQL requests
fail and crash the software. But that is not the issue we should focus on
in this mailing list.
The issue is that the environment variables are not set correctly : in a
local session it starts in French (as it should), but in the x2go session
in starts in English.

> happens

Yes, this is related to LXDE. But once more, only in combination with x2go
: on the local station I do not have this error when I start a LXDE session.
Because LXDE is so light, it is very well adapted for remote desktop ; so
it is definitely a first choice for a combination with x2go.

> Really during typing, before pressing enter? That's very weird.

Sorry I should have said "after typing" : when I press enter, libreoffice
starts loading, and suddenly I am ejected from the x2go session.

Bruno

---

From: Bruno CAPELETO <[email-masked]>
Date: Fri, 11 Aug 2017 00:25:04 +0200

Ok bug no 2 (no session for pid) is identified :
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864402

Concerning bug 3. and single app mode : when launching xterm and doing
"echo $LANG" there is nothing.
So the variable is not set, even with my workaround for bug no 1.
What is the difference between the full LXDE session et single app mode :
is there an explanation somewhere ?

2017-08-10 21:52 GMT+02:00 Bruno CAPELETO <[email-masked]>:

> The issue is coma : "." in English and "," in French. So the MySQL
> requests fail and crash the software. But that is not the issue we should
> focus on in this mailing list.

---

From: Ulrich Sibiller <[email-masked]>
Date: Fri, 11 Aug 2017 00:41:21 +0200

On Fri, Aug 11, 2017 at 12:25 AM, Bruno CAPELETO
<[email-masked]> wrote:
> Concerning bug 3. and single app mode : when launching xterm and doing "echo
> $LANG" there is nothing.

That means, libreoffice crashes without LANG being set? I have tried
unsetting LANG (and LANGUAGE). libreoffice is still working, though
complaining:
$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
$ libreoffice
I18N: Operating system doesn't support locale "en_US"

> What is the difference between the full LXDE session et single app mode : is
> there an explanation somewhere ?

I am not aware of any, I fear you have to read the source...

What shell are you using?

Uli

---

From: Mihai Moldovan <[email-masked]>
Date: Fri, 11 Aug 2017 05:29:13 +0200

Control: reassign -1 x2goserver 4.0.1.20

First of all, x2goserver 4.0.1.20 actually is the correct stable release.
4.1.0.0 are the current nightly releases.

I personally don't care much about what version is tested, but knowing whether
there's a difference in behavior between the stable and nightly versions is
certainly helpful.

On 08/10/2017 12:24 PM, Bruno CAPELETO wrote:
> Package: <x2goserver> Version: <4.0.1.20-0x2go1+git20170412.1125+9.main.1>
> 
> # uname -a Linux mtcie1 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1
> (2017-06-18) x86_64 GNU/Linux
> 
> 
> 
> ... LANG=fr LC_ALL=fr_FR.UTF-8 export LANG export LC_ALL ...
> 

How exactly did you set the locale?

The "Debian way" would be to run dpkg-reconfigure locales as root and select the
desired locale(s) to generate and then select the default one.

/etc/environment should not contain any locale settings.

LANGUAGES and especially LC_ALL should normally not be set. LANGUAGES is a
GNU-only list of fallback locales. LANG is the preferred way to set the locale,
since it's being used if all of the LC_* env variables are empty.
"dpkg-reconfigure locales" will do the right thing™.

> in x2go bug tracking and marked as solved. Actually it is not on my brand new
> system.

What session are you starting exactly? I cannot find the string "No session for
pid" in x2goserver's source code. Not sure what to do with this.

> but /usr/bin/libreoffice makes the x2go session crash.

That's certainly possible. The most likely cause, as Uli explained, is that the
command daemonizes itself right after launching it. This leads to the X2Go
scripts assuming that the program exited and subsequently also terminating the
session. We've seen such behavior every now and then and worked around it.

However, it looks like x2goagent is crashing when you start libreoffice in your
case. That shouldn't happen. My gut feeling is that this might be another GTK3
incompatibility.

I could try to reproduce this in a clean stretch VM.

> 4. The mouse double clic does not work in a x2go session, but only - within
> the Gambas software (works well for example when launching an application)
> and only - when the x2go client is running in a Windows environment (no
> problem when client in a Linux environment)

That sounds like Gambas is doing something funny, though. As far as I was able
to gather, Gambas seems to be using Qt5 as its drawing toolkit.

The package qtbase5-examples should contain a binary at
/usr/lib/x86_64-linux-gnu/qt5/examples/widgets/widgets/mousebuttons/mousebuttons
which spits out received mouse events.

Can you try that - especially with double clicking - and see what it outputs?

Mihai

---

From: Bruno CAPELETO <[email-masked]>
Date: Wed, 16 Aug 2017 11:17:42 +0200

> there's a difference in behavior between the stable and nightly versions is

Same issues with both versions.

> desired locale(s) to generate and then select the default one.

That is exactly the way  I set the locales.

> /etc/environment should not contain any locale settings.

/etc/environmnent is empty

> "dpkg-reconfigure locales" will do the right thing™.

I confirm $LANGUAGES and $LC_ALL are not set on a local session.

> pid" in x2goserver's source code. Not sure what to do with this.

I found out it is a reported bug related to LXDE : cf
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864402

> I could try to reproduce this in a clean stretch VM.

Perfectly reproducible in my case on 2 installations.

> Can you try that - especially with double clicking - and see what it

$
/usr/lib/x86_64-linux-gnu/qt5/examples/widgets/widgets/mousebuttons/mousebuttons
failed to get the current screen resources
QXcbConnection: XCB error: 172 (Unknown), sequence: 169, resource id: 175,
major code: 149 (Unknown), minor code: 20
"Mouse Press: raw button=1  Qt=LeftButton\n heldbuttons LeftButton "
"Mouse Release: raw button=1  Qt=LeftButton\n heldbuttons NoButton"
"Mouse DoubleClick: raw button=1  Qt=LeftButton\n heldbuttonsLeftButton "
"Mouse Release: raw button=1  Qt=LeftButton\n heldbuttons NoButton"

Reminder : the double click works when for example I launch an application
from the desktop shortcut.
It is only in this gambas software that it does not work, and only when
using x2go Windows client (works perfectly well with x2go linux client).

---

From: Bruno CAPELETO <[email-masked]>
Date: Mon, 4 Sep 2017 17:44:48 +0200

People in Laurux's forum have reported this software works in single app
mode but on an Ubuntu server.

So it looks like this crash issue is related to the non-proper setting of
the locale on Debian server...

2017-08-16 11:17 GMT+02:00 Bruno CAPELETO <[email-masked]>:

> $ /usr/lib/x86_64-linux-gnu/qt5/examples/widgets/widgets/
> mousebuttons/mousebuttons

---

From: Mihai Moldovan <[email-masked]>
Date: Tue, 5 Sep 2017 05:34:17 +0200

On 09/04/2017 05:44 PM, Bruno CAPELETO wrote:
> People in Laurux's forum have reported this software works in single app mode
> but on an Ubuntu server.

Okay, I have just tried to reproduce your issues in a new, fresh Debian Stretch
VM. Only installed the core system, x2goserver, x2goserver-xsession, lxde and
gambas3.

Then (since I installed the system using the en_US.utf8 locale), ran
dpkg-reconfigure locales, selected fr_FR.* to be generated and set the default
locale to fr_FR.utf8.

Started up a new X2Go session (desktop session, LXDE) and was greeted by a
French-speaking LXDE instance (with some English text from the clipboard
manager, that does not seem to have a French localization. No problem.)

Afterwards, started gambas3 in the LXDE desktop session. Worked fine. And showed
up in French.

Next up: started gambas3 in single application mode. Came up fine and in French.

And just for fun, I then went on, downloaded Laurux3.tar.gz from the website
(since this software doesn't seem to be packaged within Debian directly...),
installed gambas3-gb-qt4 and gambas3-gb-qt4-ext (since it looked like these
modules were missing) and started Laurux3.gambas in the LXDE instance. It
greeted me in French with a dialog to setup MySQL. I skipped this and
Gambas3-Laurux started up. Again, everything was in French.

Last thing: started /home/ionic/applications/Laurux3/Laurux3.gambas (obviously
the path I extracted it to) in a single application session. Again, I was
greeted by the dialog to create a MySQL database. Skipped this, and
Laurux-Gambas came up. All in French. It looked weird, but that's because in
single application mode, we don't yet have an XSETTINGS daemon running that
would enable Qt4 to look up its theme settings, so a ugly fallback theme is
being used by default.

So far, I'm unable to reproduce any issue (and curiously, the Laurux version
from their homepage seems to be using Qt4 instead of Qt5 as well, so I wonder
how you came up with Qt4 before.)

I wasn't able to test the double-clicking issue, since all tests were carried
out using X2Go Client on Linux.

I'd like to understand why your env variables are not being set correctly, but
it doesn't seem to be systematic X2Go bug. With a cleanly installed system, this
does not seem to happen.

Mihai

---

From: Bruno CAPELETO <[email-masked]>
Date: Tue, 5 Sep 2017 08:07:00 +0200

Dear Mihai,

What good piece of news to start the day with !!!

So you do not see that "bug" on a fresh install. Unfortunately I see it,
and also on a fresh install. It is even worse : I see it on 3 fresh server
installs :
- Ubuntu 14.04.4 LTS (old installation)
- Debian GNU/Linux 8
- Debian GNU/Linux 9

So it seems that I do not install the same way as the others. Let me give
the details :
- installation in text mode (as these are remote servers)
- installation of LXDE *only* (tasksel : LXDE and ssh)
- installation of X2Go

On the 2 systems I could test locally (Debian 8 and Debian 9), the French
locales are set properly when the user starts a local X session (the menu
is in French).
However, on a remote X2Go session, the menu always appears in English (no
need to start the software).

Thanks for your help,
Bruno

---

From: Ulrich Sibiller <[email-masked]>
Date: Tue, 5 Sep 2017 08:35:01 +0200

Maybe you could provide a VM with the non-working Installation so we can have a look at it.

Uli

----- Ursprüngliche Nachricht -----
Von: "Bruno CAPELETO" <[email-masked]>
Gesendet: ‎05.‎09.‎2017 08:10
An: "Mihai Moldovan" <[email-masked]>
Cc: "[email-masked]" <[email-masked]>
Betreff: [X2Go-Dev] Bug#1200: Environment variables not set

Dear Mihai,

So you do not see that "bug" on a fresh install. Unfortunately I see it, and also on a fresh install. It is even worse : I see it on 3 fresh server installs :
- Ubuntu 14.04.4 LTS (old installation)
- Debian GNU/Linux 8
- Debian GNU/Linux 9

So it seems that I do not install the same way as the others. Let me give the details :
- installation in text mode (as these are remote servers)
- installation of LXDE only (tasksel : LXDE and ssh)
- installation of X2Go

On the 2 systems I could test locally (Debian 8 and Debian 9), the French locales are set properly when the user starts a local X session (the menu is in French).
However, on a remote X2Go session, the menu always appears in English (no need to start the software).

Thanks for your help,
Bruno

Mihai

---

From: Bruno CAPELETO <[email-masked]>
Date: Tue, 5 Sep 2017 09:07:39 +0200

I did dpkg-reconfigure locales as root.

Then I get :

~# locale
LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

But when I ssh with my user login (my x2go user), I get :

~#locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"

Obviously the dpkg-reconfigure locales did not set the locales system-wide.
I am working in this direction, still any help is appreciated (even if it
now looks like a ssh/locales-related issue...)

2017-09-05 8:35 GMT+02:00 Ulrich Sibiller <[email-masked]>:

> ------------------------------
> Von: Bruno CAPELETO <[email-masked]>
> An: Mihai Moldovan <[email-masked]>
> Cc: [email-masked]

---

From: Bruno CAPELETO <[email-masked]>
Date: Tue, 5 Sep 2017 09:28:30 +0200

The issue came from my home-made sshd_config file.

I still work it up and will give here the solution in a few minutes.

---

From: Mihai Moldovan <[email-masked]>
Date: Tue, 5 Sep 2017 10:00:42 +0200

> I still work it up and will give here the solution in a few minutes.

sshd_config? Sounds more like something in your shell startup scripts, but there
are few options that might influence this. One is AcceptEnv, which by default
accepts LC_* LANG on most distros. Still, it's unlikely that this would cause
trouble, since libssh (the library we use for communication over SSH - and most
importantly a different implementation than OpenSSH) doesn't support this feature.

The only other option I stumbled across is PermitUserEnvironment which is
disabled by default and makes sshd read and execute ~/.ssh/environment for logins.

Naturally, if you find the culprit, please update us and the report so that
other users that may hit the issue have a pointer.

Mihai

---

From: Bruno CAPELETO <[email-masked]>
Date: Tue, 5 Sep 2017 10:42:44 +0200

Found : in sshd_config, one must use the "UsePAM yes" directive

I do not really see the link with the locales, and on top of that that open
some security holes I guess.
For example, adding this instruction I had to add additional instructions
to forbid the password authentication.

Conclusions for the reported bugs :
1. locales are set properly
2. I do not have the LXDE error "no session for pid..." anylonger
3. single app mode seems to work for my software (no crash so far)
4. I could not test right now ; I guess that one is related to something
else...

2017-09-05 9:28 GMT+02:00 Bruno CAPELETO <[email-masked]>:

>>> On the 2 systems I could test locally (Debian 8 and Debian 9), the
>>> French locales are set properly when the user starts a local X session (the
>>> menu is in French).

---

From: Mihai Moldovan <[email-masked]>
Date: Tue, 5 Sep 2017 11:12:55 +0200

Control: retitle -1 Double clicks not recognized in Qt(4?/5?) applications
Control: reassign -1 x2goclient 4.1.0.0
Control: tag -1 build-win32

On 09/05/2017 10:42 AM, Bruno CAPELETO wrote:
> I do not really see the link with the locales, and on top of that that open some
> security holes I guess.
> For example, adding this instruction I had to add additional instructions to
> forbid the password authentication.

PAM authentication is generally good - it also provides stuff like sessions and
other access control (for instance with login limits and the like), which pure
shadow access does not.

Okay, so what happens is that without PAM support, your shell startup scripts
that would normally fetch the system locale are probably not executed. Which one
exactly beats me, but that's probably not too important. You really shouldn't
disable PAM authentication on Linux.

Instead, you can edit /etc/pam.d/sshd. Disable the common-auth include line.
That should make it impossible to login with passwords - but still allow setups
with OTP's for instance, if ChallengeResponseAuthentication is enabled in
sshd_config.

> 1. locales are set properly

Great!

> 2. I do not have the LXDE error "no session for pid..." anylonger

Also good, but that's been LXDE's problem really.

> 3. single app mode seems to work for my software (no crash so far)

Even better. It might look bad in single application mode, as explained before.

> 4. I could not test right now ; I guess that one is related to something else...

Let's assume that still to be the case, though. I'm retitling the bug report as
such and will leave it open for the time being.

Mihai