Hi there,
this did cost us some pains, because a sshd was using port 6050, so even reinstalling x2goserver didn't solve any issues. This is a pretty hackish solution and maybe someone with a little more bash experience could take a look.
Cheers Morty
-- Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter) Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme) Friedrich-Alexander-Universität Erlangen-Nürnberg Martensstr. 1 91058 Erlangen
Tel : +49 9131 85-25419 Fax : +49 9131 85-28732 eMail : struebe@informatik.uni-erlangen.de WWW : http://www4.informatik.uni-erlangen.de/~morty
Sorry for that, too many patches flying around. :)
Morty
On 2011-12-09 18:57, Moritz Struebe wrote:
Hi there,
this did cost us some pains, because a sshd was using port 6050, so even reinstalling x2goserver didn't solve any issues. This is a pretty hackish solution and maybe someone with a little more bash experience could take a look.
Cheers Morty
-- Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter) Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme) Friedrich-Alexander-Universität Erlangen-Nürnberg Martensstr. 1 91058 Erlangen
Tel : +49 9131 85-25419 Fax : +49 9131 85-28732 eMail : struebe@informatik.uni-erlangen.de WWW : http://www4.informatik.uni-erlangen.de/~morty
On Fri, 2011-12-09 at 18:58 +0100, Moritz Struebe wrote:
Sorry for that, too many patches flying around. :)
Morty
On 2011-12-09 18:57, Moritz Struebe wrote:
Hi there,
this did cost us some pains, because a sshd was using port 6050, so even reinstalling x2goserver didn't solve any issues. This is a pretty hackish solution and maybe someone with a little more bash experience could take a look. <snip> Only two silly thoughts. Are we sure that all distributions use a space and not a \t after the port number? If not, perhaps something like netstat -ntl | grep ":${X2GO_PORT}[^0-9][^0-9]*" would work (the port followed by at least one non-numeric character.
What about the bizarre corner case where someone may have specified a source port for the connection and that port happens to be ${X2GO_PORT}. Does that mean it will show up in the Foreign Address column? Would it be better to use awk to pull out the fourth column (I forget off hand how to do that) and then grep only the fourth column? Then we might even be able to use netstat -ntl | grep ":${X2GO_PORT}\$" (not 100% sure of that syntax either). Thanks - John
On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
--- a/x2goserver/bin/x2gostartagent +++ b/x2goserver/bin/x2gostartagent @@ -120,8 +120,8 @@ USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME` while [ "$OUTPUT" != "inserted" ]; do X2GO_PORT=$(($X2GO_PORT + 1)) X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){ if(\"$USED_DISPLAYS\" =~ m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
- #Test if the session is already in use. nxagent uses 6000+DISPLAY to open a port. Therefore this must be tested, too.
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] || `netstat -ntl | grep ":${X2GO_PORT} "` ; then OUTPUT="XXX" else SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
That looks overly convoluted to me. What about this (untested, but shell syntax works): if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] || netstat -ntl 2>/dev/null | grep -q ":${X2GO_PORT}"; then OUTPUT="XXX" else SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"` fi Cheers, Reinhard -- Gruesse/greetings, Reinhard Tartler, KeyID 945348A4
On Fri, 2011-12-09 at 21:53 +0100, Reinhard Tartler wrote:
On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
--- a/x2goserver/bin/x2gostartagent +++ b/x2goserver/bin/x2gostartagent @@ -120,8 +120,8 @@ USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME` while [ "$OUTPUT" != "inserted" ]; do X2GO_PORT=$(($X2GO_PORT + 1)) X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){ if(\"$USED_DISPLAYS\" =~ m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
- #Test if the session is already in use. nxagent uses 6000+DISPLAY to open a port. Therefore this must be tested, too.
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] || `netstat -ntl | grep ":${X2GO_PORT} "` ; then OUTPUT="XXX" else SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
That looks overly convoluted to me. What about this (untested, but shell syntax works):
if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] || netstat -ntl 2>/dev/null | grep -q ":${X2GO_PORT}"; then OUTPUT="XXX" else SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"` fi
Cheers, Reinhard
What if X2GO_PORT is 6051 and for some reason there is a service listening on port 60513? Won't it erroneously match? - John
Hi there.
Am 09.12.2011 22:05, John A. Sullivan III schrieb:
On Fri, 2011-12-09 at 21:53 +0100, Reinhard Tartler wrote:
On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
- #Test if the session is already in use. nxagent uses 6000+DISPLAY to open a port. Therefore this must be tested, too.
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] ||
netstat -ntl | grep ":${X2GO_PORT} "
; then OUTPUT="XXX"
I tested this patch and it worked (opened a listen-port manually), but I have no idea why, because I forgot to add 6000 to the port number - I did document it, though. :/ I'll make a new version on Monday.
What if X2GO_PORT is 6051 and for some reason there is a service listening on port 60513? Won't it erroneously match? - John
Nope: ":${X2GO_PORT} " <- There is a space behind the "}".
Cheers Morty
Hi there.
Am 09.12.2011 22:05, John A. Sullivan III schrieb:
On Fri, 2011-12-09 at 21:53 +0100, Reinhard Tartler wrote:
On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
- #Test if the session is already in use. nxagent uses 6000+DISPLAY to open a port. Therefore this must be tested, too.
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] ||
netstat -ntl | grep ":${X2GO_PORT} "
; then OUTPUT="XXX"I tested this patch and it worked (opened a listen-port manually), but I have no idea why, because I forgot to add 6000 to the port number - I did document it, though. :/ I'll make a new version on Monday.
What if X2GO_PORT is 6051 and for some reason there is a service listening on port 60513? Won't it erroneously match? - John
Nope: ":${X2GO_PORT} " <- There is a space behind the "}". <snip> Yes, I noticed that in yours -that's why I wondered if we needed to
On Sat, 2011-12-10 at 16:50 +0100, Moritz Strübe wrote: protect against it being a space in one distro and a \t in another. But I believe the space was missing in Reinhard's suggestion. Thanks - John
Hi Reinhard, hi Morty On Fr 09 Dez 2011 21:53:05 CET Reinhard Tartler wrote:
On Fr, Dez 09, 2011 at 18:58:35 (CET), Moritz Struebe wrote:
--- a/x2goserver/bin/x2gostartagent +++ b/x2goserver/bin/x2gostartagent @@ -120,8 +120,8 @@ USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME` while [ "$OUTPUT" != "inserted" ]; do X2GO_PORT=$(($X2GO_PORT + 1)) X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){ if(\"$USED_DISPLAYS\" =~ m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ]; then
- #Test if the session is already in use. nxagent uses 6000+DISPLAY to open a port. Therefore this must be tested, too.
- if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] || `netstat -ntl | grep ":${X2GO_PORT} "` ; then OUTPUT="XXX" else SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"`
That looks overly convoluted to me. What about this (untested, but shell syntax works):
if [ -e "/tmp/.X${X2GO_PORT}-lock" ] || [ -e "/tmp/.X11-unix/X${X2GO_PORT}" ] || netstat -ntl 2>/dev/null | grep -q ":${X2GO_PORT}"; then OUTPUT="XXX" else SESSION_NAME=${USER}-${X2GO_PORT}-`date +"%s"` fi
I picked this mail from a port detection discussion. Has a fix for the discussed problem been committed to x2goserver.git? Can any of you send the latest patch proposal to the list? Or, if tested well enough simply commit? Greets, Mike -- DAS-NETZWERKTEAM mike gabriel, dorfstr. 27, 24245 barmissen fon: +49 (4302) 281418, fax: +49 (4302) 281419 GnuPG Key ID 0xB588399B mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...
Hey.
On 2012-01-27 13:26, Mike Gabriel wrote:
I picked this mail from a port detection discussion. Has a fix for the discussed problem been committed to x2goserver.git?
Thanks for monitoring this.
Can any of you send the latest patch proposal to the list? Or, if tested well enough simply commit?
Yes, I think it's well tested. I just pushed it.
Cheers Morty
-- Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter) Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme) Friedrich-Alexander-Universität Erlangen-Nürnberg Martensstr. 1 91058 Erlangen
Tel : +49 9131 85-25419 Fax : +49 9131 85-28732 eMail : struebe@informatik.uni-erlangen.de WWW : http://www4.informatik.uni-erlangen.de/~morty
Hi there,
here is the updated version checking for the right port (DISPLAY+6000) and adding Reinhard's suggestions.
Looking forward to another round of comments. ;)
Cheers Morty
On 2011-12-09 18:57, Moritz Struebe wrote:
Hi there,
this did cost us some pains, because a sshd was using port 6050, so even reinstalling x2goserver didn't solve any issues. This is a pretty hackish solution and maybe someone with a little more bash experience could take a look.
Cheers Morty
X2go-Dev mailing list X2go-Dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/x2go-dev
-- Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter) Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme) Friedrich-Alexander-Universität Erlangen-Nürnberg Martensstr. 1 91058 Erlangen
Tel : +49 9131 85-25419 Fax : +49 9131 85-28732 eMail : struebe@informatik.uni-erlangen.de WWW : http://www4.informatik.uni-erlangen.de/~morty
Hi Morty,
On Mo 12 Dez 2011 11:30:36 CET Moritz Struebe wrote:
Hi there,
here is the updated version checking for the right port (DISPLAY+6000) and adding Reinhard's suggestions.
Looking forward to another round of comments. ;)
Cheers Morty
Looks good to me. Does x2goserver then have to depend on
,,net-tools''? I am not sure if that is part of a minimal (debian)
system or if we have to pull it in during installation by dependending
on it.
Greets, Mike
--
DAS-NETZWERKTEAM mike gabriel, dorfstr. 27, 24245 barmissen fon: +49 (4302) 281418, fax: +49 (4302) 281419
GnuPG Key ID 0xB588399B mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de
freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...
On 2011-12-12 19:22, Mike Gabriel wrote:
Hi Morty,
On Mo 12 Dez 2011 11:30:36 CET Moritz Struebe wrote:
Hi there,
here is the updated version checking for the right port (DISPLAY+6000) and adding Reinhard's suggestions.
Looking forward to another round of comments. ;)
Cheers Morty
Looks good to me. Does x2goserver then have to depend on ,,net-tools''? I am not sure if that is part of a minimal (debian) system or if we have to pull it in during installation by dependending on it.
Greets, Mike
Well ifconfig is part of net-tools. Can't live without that. ;)
Cheers Morty
-- Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter) Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme) Friedrich-Alexander-Universität Erlangen-Nürnberg Martensstr. 1 91058 Erlangen
Tel : +49 9131 85-25419 Fax : +49 9131 85-28732 eMail : struebe@informatik.uni-erlangen.de WWW : http://www4.informatik.uni-erlangen.de/~morty
Hi Morty,
On Mo 12 Dez 2011 19:51:36 CET Moritz Struebe wrote:
Well ifconfig is part of net-tools. Can't live without that. ;)
Brilliant, was not aware of that and neither did I look any closer
before writing my last mail.
Great, Mike
--
DAS-NETZWERKTEAM mike gabriel, dorfstr. 27, 24245 barmissen fon: +49 (4302) 281418, fax: +49 (4302) 281419
GnuPG Key ID 0xB588399B mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de
freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...