LinuxQuestions.org
Visit Jeremy's Blog.
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 09-20-2010, 09:59 AM   #1
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Rep: Reputation: 31
x-windows for dummies?


I have a bunch of users that log on remotely via command line normally. Some of them want to do some graphics programming... what programs should I install on the server and what kind of client should they use to access the graphics functionality (like for Java programming with basic graphics). I know x-windows is involved, but I've always been a bit hazy on how to make this work.

I figure I normal ssh client won't work... but maybe I'm wrong.

I'm using Debian (Lenny).

EDIT

Btw, I'm looking for the most basic possible x functionality. I don't need users to have a whole desktop environment. I'm reading up on X now to see if I can figure out the best way to do this myself.

EDIT

Also, I'm looking to install a client on Windows.

Last edited by davidstvz; 09-20-2010 at 10:40 AM.
 
Old 09-20-2010, 11:20 AM   #2
rcbrgs
Member
 
Registered: Aug 2010
Posts: 30

Rep: Reputation: 14
Hi David!

If you ssh with the -Y option on the command line, you can "forward" the X session being run on the computer you are ssh'ing in to the computer you are ssh'ing from.

This must be enabled in the destiny computer; in the /etc/ssh/sshd_config file, the following line must exist:

X11Forwarding=Yes

(If you have to add/change this line, you must restart your sshd daemon).

Then you just ssh in with the -Y option, and run the graphical program of your choice.

Cheers!
 
1 members found this post helpful.
Old 09-20-2010, 11:55 AM   #3
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Hmm, it seems to be more complicated than that. On these servers, I have no desktop environment installed at all, so I have to somehow install x. I'm not sure which packages I need. On a test server I've just done:

apt-get install xterm
apt-get install xinit
apt-get install xorg

For a regular user I get "X: user not authorized to run the X server, aborting." if I try to run xinit.

It's probably not a good idea to run it as root, but even so it hangs on:

Code:
web:/home/davidst# xinit

X: warning; process set to priority -1 instead of requested priority 0

X.Org X Server 1.4.2
Release Date: 11 June 2008
X Protocol Version 11, Revision 0
Build Operating System: Linux Debian (xorg-server 2:1.4.2-10.lenny2)
Current Operating System: Linux web 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010 x86_64
Build Date: 11 June 2009  09:45:25AM

        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Mon Sep 20 11:57:37 2010
(==) Using config file: "/etc/X11/xorg.conf"
(II) Module "ddc" already built-in
(II) Module "i2c" already built-in
finished output detect: 0
finished output detect: 1
finished all detect
before xf86InitialConfiguration
in RADEONProbeOutputModes
in RADEONProbeOutputModes
after xf86InitialConfiguration
(II) Module "ramdac" already built-in
Entering TV Save
Save TV timing tables
saveTimingTables: reading timing tables
TV Save done
init memmap
init common
init crtc1
init pll1
freq: 65000000
best_freq: 65000000
best_feedback_div: 130
best_ref_div: 9
best_post_div: 6
restore memmap
restore common
restore crtc1
restore pll1
finished PLL1
restore dac
restore dac
[config/hal] couldn't initialise context: (null) ((null))
 
Old 09-20-2010, 12:05 PM   #4
rcbrgs
Member
 
Registered: Aug 2010
Posts: 30

Rep: Reputation: 14
That's a whole new problem - and a bigger one I'm afraid.

To be honest, I love compiling stuff from source, or installing packages manually, but I have 100% failure rates on three things I have attempted several times: installing X from sources/packages, glibc from source, and installing LFS (Linux From Scratch). Hopefully someone else will step in to help you.

However, let's assume that the apt-get for xinit has installed all minimum software for you. You must now config your X server.

You should try the instructions on this page (or ay other google hits for "configure Xorg"):

http://www.brunolinux.com/06-Fine_Tu...nfigure_X.html

I noticed your X is outputing some lines about radeon. If you have discreet gpus on these servers, you might want to install their proprietary drivers from the board manufacturer's site.

I know that the ATI linux drivers I use automatically configure X, so this could be handy for you too.
 
1 members found this post helpful.
Old 09-20-2010, 02:09 PM   #5
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Thanks, I will try that.
 
Old 09-20-2010, 02:18 PM   #6
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 129Reputation: 129
The server does not need most of Xorg, the client does.

X11 is a Network protocol. It use TCP/IP to transport the graphic elements. Those element are produced by an X client, your Java apps, in this case. The X server, on the client, then translate the protocol into graphic, then send back that input event (keyboard, mouse, touchscreen). As long as the client (on the server) have the necessarty libraries to send the data, it will work.

So install Xorg or Xming on the computer your users are working on and ssh with -X or -Y (-X is less secure, but faster).
 
2 members found this post helpful.
Old 09-20-2010, 02:42 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The X server does not need to be running on the application server. The server runs on the remote terminal. You can have the application server running in the multiuser terminal mode (init 3 on other distros) yet use "ssh -X" to log in and run remote apps.

You will probably need xorg installed as a dependency of the graphical apps however. I just went into init level 3 on my openSuSE desktop, and started up kpat remotely from my desktop.

Recently KDE and Gnome applications use dbus. E.G. KDE uses it instead of dcop now. I found I needed to add these lines to my .bashrc script (on the ssh-server machine). It tests for a remote ssh connection and starts the dbus server:
Code:
if [[ -n "$DISPLAY" ]] && [[ -n "$SSH_CLIENT" ]] && [[ -z "$DBUS_SESSION_BUS_ADDRESS" ]] ; then
        ## if not found, launch a new one
        eval $(dbus-launch --exit-with-session)
        export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
fi
Without it, many apps would refuse to start. Still logging in remotely, konsole misses every other keypress. I have to start a new konsole session to fix this. It seems to me that the original konsole program (started remotely) has a dbus foot on both sides of the fence. The original program started locally and shell instance running on the server. Running konsole again it is OK. If I start a remote session like "ssh -X <server> konsole", there isn't this problem. either.

You can create desktop shortcuts or menu items that start with ssh -X in them to run remote applications.
For example, I just added InkScape to my desktop folder in KDE. I edited the properties so the command is: ssh -X elite 'inkscape %F'
Clicking on the icon on my laptop starts the program remotely on my desktop. The desktop is running in init level 3.

Last edited by jschiwal; 09-20-2010 at 02:43 PM.
 
2 members found this post helpful.
Old 09-20-2010, 03:42 PM   #8
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Is there a recommended program to function as the x-server in a windows environment (clients are windows machines; the server is debian linux; so I install the client on the server and then I need some kind of server functioning on each of the windows desktops in a lab (or else on the users laptops or home PCs))).

Xorg in Cygwin perhaps?

Last edited by davidstvz; 09-20-2010 at 04:03 PM.
 
Old 09-20-2010, 07:16 PM   #9
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 129Reputation: 129
Xorg in Cygwin or xming
 
1 members found this post helpful.
Old 09-30-2010, 10:35 AM   #10
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Original Poster
Rep: Reputation: 31
Ok, I'm finally getting the hang of this. I install an x-server (like the X11 packages in Cygwin for Windows) on the client machine, and various x capable software on the server such as the x11-apps package.

I logged in and ran xemacs and that works. I'm trying to do some basic java graphics programming and running into trouble. Example programs for java graphics have no "main" function and my environment tells me "exception" when it can't find main. What am I missing here?

Code:
import java.awt.*;
import java.awt.geom.*;
 
public class PaintingAndStroking
    extends ApplicationFrame {
  public static void main(String[] args) {
    PaintingAndStroking f = new PaintingAndStroking();
    f.setTitle("PaintingAndStroking v1.0");
    f.setSize(300, 150);
    f.center();
    f.setVisible(true);
  }
  
  public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D)g;
    double x = 15, y = 50, w = 70, h = 70;
    Ellipse2D e = new Ellipse2D.Double(x, y, w, h);
    GradientPaint gp = new GradientPaint(75, 75, Color.white,
        95, 95, Color.gray, true);
    // Fill with a gradient.
    g2.setPaint(gp);
    g2.fill(e);
    // Stroke with a solid color.
    e.setFrame(x + 100, y, w, h);
    g2.setPaint(Color.black);
    g2.setStroke(new BasicStroke(8));
    g2.draw(e);
    // Stroke with a gradient.
    e.setFrame(x + 200, y, w, h);
    g2.setPaint(gp);
    g2.draw(e);
  }
}

EDIT


Maybe I should mention I run from Cygwin:

startxwin

And this creates a single terminal like window with a white background. Then from there I'm running:

ssh -X user@server

Then if I run xemacs file.java I can use xemacs in a separately opened window. But so far all my java programs fail to open any kind of windows for graphics.

EDIT

Looks like this is a problem with my java programming rather than the server. The user needing the x-windows has gotten some FLTK stuff running.

Also, if anyone needs to run x-windows in a lab environment with multiple non-privileged users, you may have a problem with permissions. The first user creates log and lock files and then if they are not removed properly, no other users can create the files on top. I fixed it by scheduling a windows task to run a batch file (as admin) whenever anyone logs in. The batch file removes the conflicting log file in c:/cygwin/var/log and renames the folder in c:/cygwin/tmp (using %RANDOM%) where the socket file descriptor is stored (since windows can't manage to delete it). And for good measure it shuts down any rogue XWin.exe that is hanging on in the background.

Last edited by davidstvz; 10-07-2010 at 09:32 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Do we have a "Windows for Dummies" yet? LXer Syndicated Linux News 0 07-11-2008 10:10 PM
Email for dummies SteveT Linux - Software 8 06-16-2007 06:53 AM
SUSE Linux 9.3 for Dummies (For Dummies S.) samuelmp SUSE / openSUSE 11 08-01-2005 01:42 PM
Slackware for Dummies Ryuji Yamazaki Linux - Newbie 5 10-28-2004 02:52 PM
C++ For Dummies AFI_Flame Programming 6 10-15-2004 02:00 PM

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

All times are GMT -5. The time now is 11:19 AM.

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