LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-07-2005, 02:14 PM   #1
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Rep: Reputation: 0
keep running x programs remotely


Hello guys,
What I have reached so far and have no idea how to continue from here is the following.

I have a linux server running 24/7 with no screen attached. I have compiled amule (for example) which I would like to be running all the time so users can download stuff from the server. When I start amule it connects to a local display on the network which is a laptop that is only rarely on. So, anyone might know a way of keeping the program running on the linux server after the remote X server has gone down? And then when it comes back on to be able to reattach to that screen.

Any help will be appreciated.

Regards,
-Nikolay Kichukov
 
Old 10-07-2005, 02:49 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Not having a screen doesn't mean it doesn't have a display; if the server is starting X, you can route application windows to it. What you want is for the application to display on the server, and run in the background (or detached using the screen command) when you start it remotely. For example:

someapplication -display localhost:0.0 &

An alternative is finding a command-line version of the application, so you don;t need to worry about the display at all.
 
Old 10-07-2005, 03:33 PM   #3
Tino27
Member
 
Registered: Aug 2003
Location: Akron, OH
Distribution: Slackware 14.2-stable, Ubuntu 16.04 LTS
Posts: 401

Rep: Reputation: 30
You might also want to check out the "screen" command. I use this command all the time when I am remotely adminstering boxes that are taking a long time. I can start a "session", issue the commands, then detach from that session, leaving the application running. At a later point I can reattach to the session and continue where I left off.
 
Old 10-07-2005, 11:22 PM   #4
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
Hello Guys, thanks for your suggestions, but I think noone understood what I meant.

So, I have the server which only has the xlibs-dev libraries so that I can compile stuff for X. It is not actually running an X server. So in order for me to display the application on my laptop screen which is part of the local network, I log in to the server via ssh and then do :
export DISPLAY="192.168.8.8:0.0"
./application &
whereas beforehand I have allowed connections from the server IP address to the X server on the 192.168.8.8 laptop box with xhost +myserverIP. The problem is not there. This works just great and I would suggest everyone tries this if you are running on a slow machine ;-) It save a lot of computation on your local host.

Now, my question is, is there a way, that I can trick the "application" that is connecting to the remote x server, so when the remote x server exits, the program will not die as it happens now, but rather stay active and perform it's operations.

If you are having any more questions, let them go. I'd be happy to explain in more details what I am trying to do here...


regards,
-Nikolay Kichukov
 
Old 10-08-2005, 12:15 AM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Re-read post number 2. If you are not running X on the server, then you need a dummy X server. You can create one with xVNC or Xvfb on the server. Set your DISPLAY variable to the dummy X server. It has to go somewhere, and it can't be to the remote laptop if you want to disconnect it. This presumes that you must run a GUI application.

A better solution for amule in particular is to run a command-line version, like amuled. That way you don't need a display at all.

If you want/must run an X application and disconnect, then here's one way:

1. Login to the remote server.
2. Start Xvfb to create a dummy X server:

Xvfb :1 -screen 0 640x480x16 -fbdir ~/ &

3. Start amule on the dummy X server, as a background task:

DISPLAY=localhost:1 amule &

4. You can now logoff. If you want to check on the amule display, reconnect to the server and issue the command:

xwud -in ~/Xvfb_screen0

You will see an image of the dummy display until you click in the window or hit 'q'.

Last edited by macemoneta; 10-08-2005 at 12:41 AM.
 
Old 10-13-2005, 03:50 PM   #6
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
Hello macemoneta,
Thanks for your detailed answers. I have installed xvfb and it is awsome! ;-)
Now when I try to reconnect to the display where my program has successfully connected to I get dead air. Nothing is happening.

Xvfb :2 -screen 0 640x480x16 -fbdir /home/services/
DISPLAY="127.0.0.1:2.0"
xwud -in Xvfb_screen0 invoked from /home/services/


services@nevir:~$ xwud -in Xvfb_screen0


what am I doing wrong there?

regards,
-Nikolay Kichukov
 
Old 10-13-2005, 04:06 PM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Can you define "dead air" and "nothing is happening"?

xwud shows you a snapshot, not a live connection to the application. If you want to see updates, you need to quit and run xwud successively. The idea is that you don't normally have a connection, you just want the application to keep running as if it has a display.

Your example doesn't show you actually running an application, just setting the display variable. Take a close look at step 3 in my step-by-step.

If you are saying that the application did not open a window as you expect, then that's an issue with that application. Perhaps it needs a larger size display as a minimum, or a different pixel depth. Try with 1024x768x24.

Last edited by macemoneta; 10-13-2005 at 04:08 PM.
 
Old 10-14-2005, 01:37 AM   #8
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
Hello Macemoneta,
Thanks for your patience, I can assure you that the program is running and is properly connected to the dummy display of the xvfb server. I believe the problem was, I tried to access this snapshot from:
Internal IP (192.168.0. network) -> NAT Router -> ssh to remote sshd daemon on the internet -> ssh to my server's extetrnal IP and from the console there run xwud. I believe that is why I got nothing on screen as if there was nothing happening. There are no logs whatsoever that I can provide you with.
Is it possible that I got no image on screen because of being behind a NAT router?

Best regards,
-Nikolay Kichukov
 
Old 10-14-2005, 03:58 AM   #9
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
Sorry for the previous message. It seems to work when I
export DISPLAY="myLaptopDisplayOnTheLocalLan:0.0" and then invoke xwud -in dispalyName.

Something else. Is there a way that I can swith to the already running application without having to kill it and then starting it on the laptop display?

Regards,
-Nikolay Kichukov
 
Old 10-14-2005, 11:00 AM   #10
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Unfortunately, X applications can't, in general, be moved from one X display to another. Some applications (like amule, which you had previous mentioned) allow you to control them from the command line while they are running.

If you want to be able to manipulate the applications on the dummy X server, I suggest you investigate Xvnc (which I had mentioned earlier) instead of Xvfb. You can reconnect to the Xvnc display using vncviewer, and control the application(s).
 
Old 10-15-2005, 07:36 AM   #11
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
Cheers mate,
I shall also try this out ;-0

Regards,
-Nikolay Kichukov
 
Old 10-23-2005, 07:42 AM   #12
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
Hello macemoneta,
Now that I shall use my server as a workstation over the network I have installed x-desktop-* and gdm and iceWM.
I have configured gdm to allow network connections.
I have created a passwd file to pass to x11vnc with -rfbpasswd parameter.
I start x11vnc server as root on the local display where gdm is awaiting a user to log in.

On my laptop I have installed xtightvncviewer to make the connection.


When I connect to the xvnc server I am presented the gnome login screen. I key in my username and password and then all of the sudden x11vnc server exits. However iceWM loads successfully on display :0. So I have to restart the x11vnc server, and then restart xtightvncviewer to login this time to the already connected iceWM session. Have you got an idea why this disconnect is happening?

Here are the logs and the commands in order:


on server side:
/etc/init.d/gdm start
root@nevir:~# x11vnc -display :0 -auth /var/lib/gdm/:0.Xauth -rfbauth passa
...
23/10/2005 15:33:07 X display :0.0 is 16bpp depth=16 true color

FrameBuffer Info:
width: 1024
height: 768
scaled_width: 1024
scaled_height: 768
indexed_color: 0
bits_per_pixel: 16
depth: 16
...
23/10/2005 15:33:07 setting up 32 cursors...
23/10/2005 15:33:07 done.
23/10/2005 15:33:07 Autoprobing TCP port
23/10/2005 15:33:07 Autoprobing selected port 5900
23/10/2005 15:33:07 created 32 tile_row shm polling images.
23/10/2005 15:33:07 fb read rate: 4 MB/sec
23/10/2005 15:33:07 screen setup finished.
23/10/2005 15:33:07
23/10/2005 15:33:07 The VNC desktop is nevir:0
PORT=5900


on the client side:
hijacker@ccja:~$ xtightvncviewer nevir:0
VNC server supports protocol version 3.3 (viewer 3.3)
Password:
VNC authentication succeeded
Desktop name "nevir:0"
Connected to VNC server, using protocol version 3.3
VNC server default format:
16 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 31 green 63 blue 31, shift red 11 green 5 blue 0
Using default colormap which is TrueColor. Pixel format:
16 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 31 green 63 blue 31, shift red 11 green 5 blue 0
Using shared memory PutImage




on the server side before I authenticate with gdm:
root@nevir:~# 23/10/2005 15:34:57 Got connection from client 192.168.0.2
23/10/2005 15:34:57 other clients:
23/10/2005 15:34:57 Disabled X server key autorepeat.
23/10/2005 15:34:57 to force back on run: 'xset r on' (3 times)
23/10/2005 15:34:57 created xdamage object: 0x800024
23/10/2005 15:34:57 Protocol version 3.3
23/10/2005 15:35:03 Pixel format for client 192.168.0.2:
23/10/2005 15:35:03 16 bpp, depth 16, little endian
23/10/2005 15:35:03 true colour: max r 31 g 63 b 31, shift r 11 g 5 b 0
23/10/2005 15:35:03 no translation needed
23/10/2005 15:35:03 Using tight encoding for client 192.168.0.2
23/10/2005 15:35:03 Using compression level 1 for client 192.168.0.2
23/10/2005 15:35:03 Using image quality level 6 for client 192.168.0.2
23/10/2005 15:35:03 Enabling X-style cursor updates for client 192.168.0.2
23/10/2005 15:35:04 Enabling full-color cursor updates for client 192.168.0.2
23/10/2005 15:35:04 Enabling cursor position updates for client 192.168.0.2
23/10/2005 15:35:04 Enabling LastRect protocol extension for client 192.168.0.2
23/10/2005 15:35:04 client 1 network rate 117.5 KB/sec (9262.4 eff KB/sec)
23/10/2005 15:35:04 client 1 latency: 1.1 ms
23/10/2005 15:35:04 dt1: 0.1095, dt2: 0.0477 dt3: 0.0011 bytes: 18406
23/10/2005 15:35:04 link_rate: LR_BROADBAND - 1 ms, 117 KB/s


on the server side after I have entered my authentication information to gdm:
caught XIO error:
23/10/2005 15:36:27 deleted 32 tile_row polling images.

[1]+ Exit 3 x11vnc -display :0 -auth /var/lib/gdm/:0.Xauth -rfbauth passa


on the client side log:
xtightvncviewer: VNC server closed connection
ShmCleanup called



so now on the server side I have:

22021 ? Ss 0:00 /usr/bin/gdm
22022 ? S 0:00 /usr/bin/gdm
22025 ? S 0:05 /usr/X11R6/bin/X :0 -audit 0 -auth /var/lib/gdm/:0.Xau22050 ? Ss 0:00 /usr/bin/icewm-session
22099 ? Ss 0:00 /usr/bin/ssh-agent /usr/bin/icewm-session
22100 ? SNs 0:00 icewmbg
22101 ? Ss 0:01 icewm
22102 ? Ss 0:00 icewmtray


and if I start again x11vnc server and then connect to it with tightvncviewer everythings works perfectly.

Is this due to the fact that now X is running with auth file: -auth /var/lib/gdm/:0.Xau22050 and xvnc server is looking for :0.Xauth ? If so, what can be done to solve this?

regards,
-Nikolay Kichukov
 
Old 10-23-2005, 09:15 AM   #13
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
There's a howto here; you can check your configuration against it.
 
Old 10-23-2005, 10:18 AM   #14
kichukov
LQ Newbie
 
Registered: Jan 2005
Location: Varna, Bulgaria
Distribution: GNU/Debian Linux sarge
Posts: 12

Original Poster
Rep: Reputation: 0
hey,
have checked with the config with no luck.
I am getting the same behaviour after I log in. The session gets disconnected and the x11vnc exits.

anything else I might try?
regards
 
Old 10-23-2005, 10:29 AM   #15
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Nothing that immediately comes to mind. Post your configuration files (gdm.conf, services, /etc/xinetd.d files created). If I don't spot the problem, then it will be the information someone else will need to help you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't run X programs remotely mcshen Linux - General 2 07-28-2005 07:47 PM
How to run the hacking programs thro remotely... yuva_mca Linux - Security 1 09-25-2004 12:49 PM
remotely using x-windows programs behind a router allocate Linux - Networking 1 08-10-2004 12:40 PM
Accessing MySQL remotely: good programs? seppuku Red Hat 1 11-11-2003 08:34 AM
Executing X-Programs remotely frankieboy Linux - General 3 10-08-2003 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration