Hi, I need a GUI application (RetroShare) to start on boot on my headless server (Debian Wheezy up to date with x2go repos) and be available remotely. I got it working with the scripts below but it's cumbersome. Is it how it is supposed to be done ?
I only encounter two issues apart from the complexity : -- x2goclient (v4.0.1.0 on my PC) resolution is ignored and Xvfb startup resolution (900x550) is used even after it has been killed. -- Caps Lock cannot be used, because once it has been, it stays on.
Regards, Yohan
scripts :
$ cat /etc/rc.local
su -l -c /home/yohan/launch_x2go.sh yohan
$ cat /home/yohan/launch_x2go.sh
#!/bin/bash export DISPLAY=:1
# Xvfb is a framebuffer Xserver. Xvfb :1 -screen 0 900x550x16 & sleep 15 pyhoca-cli --server localhost -N -c LXDE --user yohan --add-to-known-hosts --password mypasswd --kbd-layout fr --kbd-type pc105/fr & export DISPLAY=:51 sleep 20 lxterminal & lxterminal & /home/yohan/reboot_RS.sh & sleep 240 pyhoca-cli --server localhost -S ALL --user yohan --password mypasswd & sleep 10 killall Xvfb
Before killing Xvfb : $ ps auxf
yohan 10994 0.0 0.0 11264 1400 pts/0 S+ 16:39 0:00 | | \_ /bin/bash ./launch_x2go.sh yohan 10996 0.1 0.0 117604 15912 pts/0 Sl+ 16:39 0:00 | | \_ Xvfb :1 -screen 0 900x550x16 yohan 11066 0.6 0.1 81892 17824 pts/0 S+ 16:39 0:01 | | \_ pyhoca-cli --server localhost -N -c LXDE --user yohan --add-to-known-hosts --password XXXXXXXX --kbd-layout fr --kbd-type pc105/fr yohan 11348 0.5 0.0 29900 10044 pts/0 S+ 16:39 0:00 | | | \_ /usr/lib/nx/bin/nxproxy -S nx/nx,retry=5,composite=1,connect=127.0.0.1,clipboard=1,cookie=4bf3236294b3550c44 yohan 11624 0.0 0.0 6080 584 pts/0 S+ 16:39 0:00 | | \_ sleep 240 root 2697 0.0 0.0 32256 4420 ? S août17 0:44 /usr/bin/perl /usr/sbin/x2gocleansessions yohan 11303 0.8 0.2 119620 36568 ? S 16:39 0:01 /usr/lib/nx/../x2go/bin/x2goagent -extension XFIXES -extension GLX -nolisten tcp -D -auth /home/yohan/.Xauthority -geometry 800x600 -name X2GO-yohan yohan 11360 0.0 0.0 11280 1512 ? Ss 16:39 0:00 /bin/bash /usr/bin/x2goruncommand 51 11303 yohan-51-1376836770_stDLXDE_dp16 30005 startlxde pulse D yohan 11469 0.0 0.0 33576 1732 ? Sl 16:39 0:00 \_ /usr/bin/lxsession -s LXDE -e LXDE yohan 11480 0.3 0.0 109524 7728 ? S 16:39 0:00 \_ openbox --config-file /home/yohan/.config/openbox/lxde-rc.xml yohan 11482 0.0 0.0 153444 10420 ? S 16:39 0:00 \_ lxpanel --profile LXDE yohan 11483 0.1 0.0 241880 11236 ? S 16:39 0:00 \_ pcmanfm --desktop --profile LXDE yohan 11733 74.5 1.1 593584 180308 pts/0 Sl+ 16:39 1:42 /home/yohan/retroshare/retroshare-gui/src/RetroShare
With session running on my PC : $ ps auxf
root 2697 0.0 0.0 32256 4420 ? S août17 0:44 /usr/bin/perl /usr/sbin/x2gocleansessions yohan 11303 0.3 0.2 120252 40332 ? S 16:39 0:04 /usr/lib/nx/../x2go/bin/x2goagent -extension XFIXES -extension GLX -nolisten tcp -D -auth /home/yohan/.Xauthority -geometry 800x600 -name X2GO-yohan-51-1376836770_stDLXDE_dp16 :51 yohan 11360 0.0 0.0 11280 1512 ? Ss 16:39 0:00 /bin/bash /usr/bin/x2goruncommand 51 11303 yohan-51-1376836770_stDLXDE_dp16 30005 startlxde pulse D yohan 11469 0.0 0.0 33576 1732 ? Sl 16:39 0:00 \_ /usr/bin/lxsession -s LXDE -e LXDE yohan 11480 0.0 0.0 109524 7728 ? S 16:39 0:00 \_ openbox --config-file /home/yohan/.config/openbox/lxde-rc.xml yohan 11482 0.0 0.0 153560 10852 ? S 16:39 0:00 \_ lxpanel --profile LXDE yohan 11483 0.0 0.0 241880 11236 ? S 16:39 0:00 \_ pcmanfm --desktop --profile LXDE yohan 11733 16.7 1.2 590244 198428 pts/0 Sl 16:39 3:13 /home/yohan/retroshare/retroshare-gui/src/RetroShare yohan 19453 1.5 0.2 119328 36896 ? S 16:57 0:01 /usr/lib/nx/../x2go/bin/x2goagent -extension XFIXES -extension GLX -nolisten tcp -S -auth /home/yohan/.Xauthority -shadow :51 -shadowmode 1 -geometry 900x550+0+0 -name X2GO-yohan-52-1376837840_stS1XSHADyohanXSHADPP51_dp24 :52
With x2goclient exited on my PC : $ ps auxf
root 2697 0.0 0.0 32256 4420 ? S août17 0:44 /usr/bin/perl /usr/sbin/x2gocleansessions yohan 11303 0.5 0.2 118708 38988 ? S 16:39 0:03 /usr/lib/nx/../x2go/bin/x2goagent -extension XFIXES -extension GLX -nolisten tcp -D -auth /home/yohan/.Xauthority -geometry 800x600 -name X2GO-yohan-51-1376836770_stDLXDE_dp16 :51 yohan 11360 0.0 0.0 11280 1512 ? Ss 16:39 0:00 /bin/bash /usr/bin/x2goruncommand 51 11303 yohan-51-1376836770_stDLXDE_dp16 30005 startlxde pulse D yohan 11469 0.0 0.0 33576 1732 ? Sl 16:39 0:00 \_ /usr/bin/lxsession -s LXDE -e LXDE yohan 11480 0.0 0.0 109524 7728 ? S 16:39 0:00 \_ openbox --config-file /home/yohan/.config/openbox/lxde-rc.xml yohan 11482 0.0 0.0 153444 10480 ? S 16:39 0:00 \_ lxpanel --profile LXDE yohan 11483 0.0 0.0 241880 11236 ? S 16:39 0:00 \_ pcmanfm --desktop --profile LXDE yohan 11733 27.3 1.2 593608 197600 pts/0 Sl 16:39 2:48 /home/yohan/retroshare/retroshare-gui/src/RetroShare
Hi Yohan,
On So 18 Aug 2013 18:48:21 CEST Yohan Bataille wrote:
I need a GUI application (RetroShare) to start on boot on my
headless server (Debian Wheezy up to date with x2go repos) and be available remotely. I got it working with the scripts below
but it's cumbersome. Is it how it is supposed to be done ?
$ cat /etc/rc.local
su -l -c /home/yohan/launch_x2go.sh yohan
$ cat /home/yohan/launch_x2go.sh
#!/bin/bash export DISPLAY=:1
# Xvfb is a framebuffer Xserver. Xvfb :1 -screen 0 900x550x16 & sleep 15 pyhoca-cli --server localhost -N -c LXDE --user yohan
--add-to-known-hosts --password mypasswd --kbd-layout fr --kbd-type
pc105/fr & export DISPLAY=:51 sleep 20 lxterminal & lxterminal & /home/yohan/reboot_RS.sh & sleep 240 pyhoca-cli --server localhost -S ALL --user yohan --password mypasswd & sleep 10 killall XvfbBefore killing Xvfb : $ ps auxf
There should be no need for using Xvfb. X2Go has its own X-Server
(x2goagent/nxagent), so when using Xvfb, you actually use X-Servers.
Why not go this approach...
pyhoca-cli --server localhost -N -c LXDE --user yohan
--add-to-known-hosts --password mypasswd
--kbd-layout fr --kbd-type pc105/fr &
sleep 5 X2GO_SESSION=$(<detect-session-id-of-just-started-session>) <launch whatever application you want to launch in session $X2GO_SESSION>
# Whenever you need that application on screen... pyhoca-cli --resume $X2GO_SESSION --server localhost
This can also be done rootless, just by not using a desktop shell
command as --command:
pyhoca-cli --server localhost -N -c <YOUR-COMMAND-IN-$PATH> --user yohan
--add-to-known-hosts --password mypasswd
--kbd-layout fr --kbd-type pc105/fr &
Greets, Mike
--
DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148
GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de
freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...
Hi Mike,
There should be no need for using Xvfb. X2Go has its own X-Server (x2goagent/nxagent), so when using Xvfb, you actually use X-Servers.
Why not go this approach...
pyhoca-cli --server localhost -N -c LXDE --user yohan
--add-to-known-hosts --password mypasswd
--kbd-layout fr --kbd-type pc105/fr &sleep 5 X2GO_SESSION=$(<detect-session-id-of-just-started-session>) <launch whatever application you want to launch in session $X2GO_SESSION>
# Whenever you need that application on screen... pyhoca-cli --resume $X2GO_SESSION --server localhost
I just tried but it failed for some reason... LXDE was never started and the session terminated. I also tried as root just to be sure : # pyhoca-cli --server localhost -N -c LXDE --user yohan --add-to-known-hosts --password mypasswd --kbd-layout fr --kbd-type pc105/fr & [1] 5440 # xwininfo: error: unable to open display "" pyhoca-cli[5440] NOTICE: preparing requested X2Go session pyhoca-cli[5440] (PyHocaCLI) NOTICE: preparing requested X2Go session pyhoca-cli[5440] (x2gosessregistry-pylib) NOTICE: registering X2Go session Pyhoca-Client_Session... pyhoca-cli[5440] (x2goclient-pylib) NOTICE: initializing X2Go session... pyhoca-cli[5440] (x2gocontrolsession-pylib) NOTICE: connecting to [localhost]:22 pyhoca-cli[5440] (x2goproxy-pylib) ERROR: Bringing up NX3 proxy failed. pyhoca-cli[5440] (x2goproxy-pylib) WARN: X2Go proxy shutdown gave a message that we may ignore: [Errno 3] No such process pyhoca-cli[5440] (x2goclient-pylib) WARN: HOOK_session_startup_failed: session startup for session profile ,,Pyhoca-Client_Session failed. pyhoca-cli[5440] (PyHocaCLI) NOTICE: give the X2Go session some time to come up...
# pyhoca-cli -l xwininfo: error: unable to open display ""
configuration files: ['/root/.x2goclient/sessions'] user configuration file: /root/.x2goclient/sessions
This can also be done rootless, just by not using a desktop shell command as --command:
pyhoca-cli --server localhost -N -c <YOUR-COMMAND-IN-$PATH> --user yohan
--add-to-known-hosts --password mypasswd
--kbd-layout fr --kbd-type pc105/fr & I tried this without any luck either :
[1]+ Fini pyhoca-cli --server localhost -N -c LXDE --user yohan --add-to-known-hosts --password mypasswd --kbd-layout fr --kbd-type pc105/fr pyhoca-cli --server localhost -N -c /usr/bin/xlogo --user yohan --add-to-known-hosts --password mypasswd --kbd-layout fr --kbd-type pc105/fr
It seems pyhoca-cli requires an active xserver to start. No ? Both commands work if I launch them from my PC, but as I said I am trying to start the application on my headless server when it boots with /etc/rc.local. Hence the ugly hack I did with Xvfb. If there is no way to do that (other than using Xvfb), I'll probably start the application from my PC with the command you suggested. My server does not reboot that often anyway.
Thanks for helping me out. Regards, Yohan