Installing X Server on Ubuntu Server 10.04 L512
Somehow my program uses sun.awt graphics library in Java. It requires X server installed and running.
I did the following:
1) I tried
export DISPLAY=:0.0
and launched my program. It didnt work. It says :
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
I also tried
xhost +
command. It also says````
xhost: unable to open display ":0.0"
2) I installed xorg
apt-get install xorg
````(which already has xserver-xorg xserver-xorg-core etc.)
3) Then I tried
startx
command to start X.org Server. It basically says
fatal server error: no screens found
X.Org X Server 1.7.6
Release Date: 2010-03-17
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-29-server i686 Ubuntu
Current Operating System: Linux li195-5 3.0.4-linode38 #1 SMP Thu Sep 22 14:59:08 EDT 2011 i686
Kernel command line: root=/dev/xvda xencons=tty console=tty1 console=hvc0 nosep nodevfs ramdisk_size=32768 ip_conntrack.hashsize=8192 nf_conntrack.hashsize=8192 ro devtmpfs.mount=1
Build Date: 20 October 2011 03:05:54PM
xorg-server 2:1.7.6-2ubuntu7.10 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.16.4
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
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: Sat Dec 3 11:00:15 2011
(==) Using config directory: "/usr/lib/X11/xorg.conf.d"
(EE) No devices detected.
Fatal server error:
no screens found
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
ddxSigGiveUp: Closing log
giving up.
xinit: No such file or directory (errno 2): unable to connect to X server
xinit: No such process (errno 3): Server error.
4) I came across a post in this forums
a user tries
# grep X /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
and founds out that DISPLAY should be :10, therefore I also have tried
export DISPLAY=:10
and still does not work.
Does anyone have an idea why can't we install X.org Server on Linode?
2 Replies
There's two ways to do what you're trying to do here. The first is the quick-and-easy mostly-automatic way, which tunnels connections from a remote machine to your local workstation's X server over ssh. This is nice because you already have everything to make it go (assuming your workstation isn't running Windows or some other non-X11 platform). Downside is that it has some performance constraints and requires that you be logged in and connected for clients to get their X fix. Nevertheless, if you just need it to get something installed or to run an occasional command, or are working over a LAN, it's awesome.
In this scenario, the DISPLAY variable will be set automatically if ssh tunneling is working, so you shouldn't have to set that. There are a few things that have to be present for it to work properly; xauth on the "client" side (your Linode) is probably the one I forget most often. You shouldn't have to mess around with xhost on the "server" side (your workstation), generally speaking.
Also, try the -v option when you connect to make sure the ssh client is requesting forwarding:
rtucker@witte:~$ echo $DISPLAY # on my local machine
:0.0
rtucker@witte:~$ ssh -v framboise
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/rtucker/.ssh/config
...
debug1: Requesting X11 forwarding with authentication spoofing.
...
rtucker@framboise:~$ echo $DISPLAY # on my Linode
localhost:10.0
If your local workstation's DISPLAY variable isn't set, ssh won't even try to negotiate X11 forwarding, for perhaps obvious reasons.
rtucker@witte:~$ unset DISPLAY
rtucker@witte:~$ echo $DISPLAY
rtucker@witte:~$ ssh -v framboise
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/rtucker/.ssh/config
...
(no mention of X11 at all)
...
rtucker@framboise:~$ echo $DISPLAY
rtucker@framboise:~$
The second approach is to install an X server on your Linode and have clients connect to that, then have some way for you to interact with it. The traditional tell-your-monitor-to-emit-a-blue-pixel-there configuration won't work, since your Linode doesn't have a video card. So, you'll need to install something like vnc4server to make it go. Per this page
$ sudo apt-get install xorg vnc4server
$ vncserver :1
then connect a VNC client to port 5091 on your Linode and enjoy. Security and automation are left as an exercise for the reader.
I haven't tested this in awhile, 'tho I probably will if my wife keeps complaining about her PC being slower than some of my embedded systems. Nothing like ~50 ms of round-trip network latency to make you appreciate localhost.
java -Djava.awt.headless=true