#890517 killer's CRON logs out users once per hour

Package:
x2goserver
Source:
x2goserver
Description:
X2Go Server
Submitter:
Mike Gabriel
Date:
2021-10-28 00:15:03 UTC
Severity:
important
#890517#5
Date:
2018-02-15 14:02:48 UTC
From:
To:
Package: killer
Severity: serious

Hi,

since Debian jessie, we disable killer in Debian Edu installations as
killer causes hourly logouts from user sessions.

We never came to the point to investigate this closer, but personally,
I think that killer on a Debian Edu system with MATE desktop env has
not been usable at least since jessie.

Mike

#890517#10
Date:
2018-02-15 14:23:46 UTC
From:
To:
[Mike Gabriel]

The only way I can think of that this can happen, is if the display
manager is broken and fail to register logged in users in the utmp/wtmp
files.  You can verify this by running 'w' or 'who' after login to see
if the user is registered as logged in.  If this is the case, the fatal
bug is in the login service you are using, not killer.

#890517#15
Date:
2018-02-15 14:23:46 UTC
From:
To:
[Mike Gabriel]

The only way I can think of that this can happen, is if the display
manager is broken and fail to register logged in users in the utmp/wtmp
files.  You can verify this by running 'w' or 'who' after login to see
if the user is registered as logged in.  If this is the case, the fatal
bug is in the login service you are using, not killer.

#890517#20
Date:
2018-02-15 15:21:41 UTC
From:
To:
Output of "who" looks good, if MATE gets launched locally (vt7).
Display Manager is LightDM with Arctica Greeter on top.

However, I noticed that X2Go does not register the logged in user in
utmp/wtmp.

Mike

#890517#25
Date:
2018-02-19 13:51:32 UTC
From:
To:
I'm unable to reproduce the reported issue (Debian Edu Jessie, Stretch,
Buster; tested LightDM, GDM, SDDM).

Mike, could you provide some details?

IIRC, for connections to a system that runs Nomachine technology (not
part of Debian) the utmp/wtmp files are not used by design (on the
system running NX server). Instead, NX keeps track of the
forwarded sessions itself.

IMO killer shouldn't be installed on a system running NX technology
because the reported failure will show up for sure.

Wolfgang

#890517#30
Date:
2018-02-20 05:32:22 UTC
From:
To:
[Wolfgang Schweer]

Updating utmp/wtmp is not only for 'keeping track of sessions', it is
also used by shutdown and other systems to know who to notify when
taking down a host or notify logged in users in other cases.  If NX do
not update utmp/wtmp for logged in users, I would claim that NX is
broken, and if it is by design, then NX is broken by design.

#890517#35
Date:
2018-02-20 09:30:57 UTC
From:
To:
Yes, I know. This has been an issue years ago when I used freeNX (the
first open source NX server implementation) at school; it was always
needed to care for it manually using some tool to list running sessions.
It doesn't seem to have been improved with recent implementations.

Right. This bug should be reassiged to the x2go-server package, but then
the package isn't part of Debian...

Wolfgang

#890517#40
Date:
2018-02-20 11:54:26 UTC
From:
To:
See: https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1171

Wolfgang

#890517#45
Date:
2018-02-22 19:02:31 UTC
From:
To:
After testing x2goserver on a Stretch system I noticed that X2Go
sessions can be detected reliably due to some command using a param
string containing 'X2GO'.

This change would work around the x2go bug running the killer cron job
only in case an X2Go session isn't detected:
--- a/cron.hourly 2014-06-11 11:15:55.000000000 +0200 +++ b/cron.hourly 2018-02-22 19:42:36.419963949 +0100 @@ -1,3 +1,3 @@ #!/bin/sh
#890517#48
Date:
2018-02-22 19:02:31 UTC
From:
To:
After testing x2goserver on a Stretch system I noticed that X2Go
sessions can be detected reliably due to some command using a param
string containing 'X2GO'.

This change would work around the x2go bug running the killer cron job
only in case an X2Go session isn't detected:
--- a/cron.hourly 2014-06-11 11:15:55.000000000 +0200 +++ b/cron.hourly 2018-02-22 19:42:36.419963949 +0100 @@ -1,3 +1,3 @@ #!/bin/sh
#890517#53
Date:
2018-02-25 13:59:27 UTC
From:
To:
Hi Wolfgang,

This is at most a dirty work around. The killer command wipes
x2goagent hourly and this must be prevented in killer itself somehow.

With the above patch you disable killer system-wide once at least one
X2Go Session is running on the host. Not the right approach.

Mike

#890517#58
Date:
2018-02-25 14:09:00 UTC
From:
To:
control: severity -1 important
# x2go-server is not in Debian, this lowering the severity…
thanks

we could still make the killer package conflict with it… or add a
Breaks.

(But that too would be a workaround…)

#890517#65
Date:
2018-02-25 14:14:03 UTC
From:
To:
[Mike Gabriel]

It do not sound like a too bad approach either, given that X2Go fail to
register its sessions in the standard unix way.  It seem like the safe
option to just disable killer if X2Go is detected.

#890517#70
Date:
2018-02-28 15:13:46 UTC
From:
To:
sessions (similar like the 'condor' ones) for the time being.

Users with active X2Go sessions can be identified running:
'ps aux | grep '[x]2goruncommand' | cut -d ' ' -f1'

Mike, could you test this change to killer (might be smarter, some one
w/ Perl skills should check it:
--- a/killer	2018-02-27 18:14:50.085187798 +0100
+++ b/killer	2018-02-27 18:15:59.624571678 +0100
@@ -1328,6 +1328,23 @@

 =item *

+Exclude all jobs belonging to users running an X2Go session from being
+terminated. X2Go fails to register users in utemp/wtemp files; for more
+information, see: https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1171
+
+=cut
+
+    my @x2gousers = ();
+    foreach my $pid ( keys %pid2comm ) {
+        next unless ( $pid2comm{$pid} eq 'x2goruncommand' );
+        push(@x2gousers, $pid2user{$pid});
+    }
+    foreach $user ( @x2gousers ) {
+        $ptable->removeProcesses('ruser', $user);
+    }
+
+=item *
+
 Finally, the process table and terminal objects are returned.

 =back


Wolfgang

#890517#73
Date:
2018-02-28 15:13:46 UTC
From:
To:
sessions (similar like the 'condor' ones) for the time being.

Users with active X2Go sessions can be identified running:
'ps aux | grep '[x]2goruncommand' | cut -d ' ' -f1'

Mike, could you test this change to killer (might be smarter, some one
w/ Perl skills should check it:
--- a/killer	2018-02-27 18:14:50.085187798 +0100
+++ b/killer	2018-02-27 18:15:59.624571678 +0100
@@ -1328,6 +1328,23 @@

 =item *

+Exclude all jobs belonging to users running an X2Go session from being
+terminated. X2Go fails to register users in utemp/wtemp files; for more
+information, see: https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1171
+
+=cut
+
+    my @x2gousers = ();
+    foreach my $pid ( keys %pid2comm ) {
+        next unless ( $pid2comm{$pid} eq 'x2goruncommand' );
+        push(@x2gousers, $pid2user{$pid});
+    }
+    foreach $user ( @x2gousers ) {
+        $ptable->removeProcesses('ruser', $user);
+    }
+
+=item *
+
 Finally, the process table and terminal objects are returned.

 =back


Wolfgang

#890517#78
Date:
2018-11-18 23:00:20 UTC
From:
To:
[Wolfgang Schweer]

I had a look at the patch, and it is not obviously wrong, at least.  I do
not know the code well any more, but did test and read it, and it might
work.  I do not have x2go myself, so I can not test that part, though.

#890517#83
Date:
2018-11-20 14:33:53 UTC
From:
To:
Hi Wolfgang,

I am not sure, if the patch is not a functional overkill. My
observation was, that the x2goagent processes got killed by killer.

So maybe, we should protect those only. For the session applications,
I am currently working on a sessreg based utmp/wtmp patch against X2Go
Server.

I'll provide more info later today.

Mike

#890517#88
Date:
2018-11-20 14:27:25 UTC
From:
To:
Thanks for the feedback. I've now tested the patched killer script once
again in a virtual machine environment: X2Go server running on a Debian
Edu Buster combined server, X2Go Client on a Debian Edu Buster
workstation with profile 'Standalone'. The complete set of X2Go
component packages is available in testing since March 2018.

The killer script works like expected.

A git format-patch is attatted, generated against killer.git as of
today.

Wolfgang

#890517#93
Date:
2018-11-20 21:08:44 UTC
From:
To:
Hi Mike,

I don't think that this is the case:

Yes, but if the user's x2goagent process gets killed, all other
processes belonging to this user will be killed as well because the user
session isn't registered. OTOH stale x2goagent processes may still exist
from sessions that have been messed up by the user. At least this
has been the case when I used NX technology at school to let people
connect from home. (Years ago, though, things might be different
nowadays.)

IMO stale x2goagent processes should be killed.
That's why the patch searches for users with a x2goruncommand process.
If this one exists, user applications are actually running and nothing
belonging to these users should be killed.

That sounds very good. Patching the killer script would be obsolete in
that case.

Wolfgang

#890517#98
Date:
2018-11-21 20:06:22 UTC
From:
To:
Hi Wolfgang,

No. The other processes get killed because most of them are X clients
to x2goagent (which is a nested Xserver). Once x2goagent is gone, the
attached X clients evaporate.

Yeah, I know. This should be cleanly handled by the x2gocleansessions
script running in the background on all X2Go Servers (launched by
x2goserver.service).

It should not be on us (i.e. killer) to clean up that X2Go specific
mess. So, stale x2goagent instances can be ignored here.

  -> /usr/sbin/x2gocleansessions, not for us.

This is true. If we (speaking with my X2Go upstream hat and Debian Edu
hat on) want time-limited X2Go sessions, than this bit of code should
really go into X2Go Server. I agree on the above.

I have chewed on different approaches yesterday (and was not too
happy). This morning I came up with a solution that I need to propose
to the X2Go upstream team (once the patch works 100%).

I am quite positive and assume that we will get this into buster.

Mike

#890517#103
Date:
2019-02-05 14:22:06 UTC
From:
To:
control: severity -1 serious
# x2go-server is now in buster
thanks

cu
Adrian

#890517#110
Date:
2019-02-05 14:59:48 UTC
From:
To:
control: reassign -1 x2goserver
thanks

right, thanks for raising the severity.

I agree with this.

I don't really agree with this (which I wrote) anymore. x2goserver should be
fixed to update utmp/wtmp.
------------------------------------------------------------------------------- holger@(debian|reproducible-builds|layer-acht).org PGP fingerprint: B8BF 5413 7B09 D35C F026 FE9D 091A B856 069A AA1C
#890517#117
Date:
2019-02-06 11:25:54 UTC
From:
To:
Hi Adrian,

neither x2goserver nor killer are unusable due to the missing
utmp/wtmp registration. Thus, reducing severity to imporant.

I will look into this issue for buster is out while we are still in
soft-freeze (in fact I have some local prototype already, but need to
revisit).

Mike

#890517#124
Date:
2020-06-18 23:12:16 UTC
From:
To:
Moin Mike,

Any news on this one? Debian Edu Bullseye intends to use x2goserver on
LTSP servers for Thin Client support...

Wolfgang

#890517#129
Date:
2020-06-19 05:19:39 UTC
From:
To:
[Wolfgang Schweer]

The upstream issue is still open, at least.

(Just a quick reply to set the forwared url. :)

#890517#136
Date:
2021-10-28 00:12:52 UTC
From:
To:
-- 
Hello,
is my pleasure meeting with you, please something came up and i really
want to discuses with you urgent and important