Jenkins cannot connect to X server on Ubuntu

1,882 views
Skip to first unread message

suter_...@hotmail.com

unread,
Dec 28, 2012, 9:31:24 AM12/28/12
to jenkins...@googlegroups.com
My tests on jenkins are failing because jenkins can't connect to the x server on my ubuntu machine. The machine disposes of a display, so it's not headless.

I tried to set the connection settings on the etc/init.d/jenkins configuration as follows:

#Display connection
export DISPLAY=:0.0

In my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<systemPropertyVariables>
<java.awt.headless>false</java.awt.headless>
</systemPropertyVariables>
</configuration>
</plugin>

The error message is the following:
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

I tried to launch a x server from the console using startx but it says it's already running. So this does not seem to be the problem.

Pawel Jasinski

unread,
Dec 28, 2012, 11:11:00 AM12/28/12
to jenkins...@googlegroups.com
hi,

can it be that you need to enable tcp connection to your xserver?
http://askubuntu.com/questions/72812/how-to-disable-nolisten

cheers,
pawel

suter_...@hotmail.com

unread,
Dec 28, 2012, 12:15:40 PM12/28/12
to jenkins...@googlegroups.com
Hi Pawel,

Thanks for your suggestion but I still got the same problem (after I enabled tcp connections). I don't know how to debug this problem.

cheers

Pawel Jasinski

unread,
Dec 28, 2012, 1:50:12 PM12/28/12
to jenkins...@googlegroups.com
there is one thing I forgot. You have to issue the following in the terminal connected to XServer

xhost localhost

this will allow the connections to XServer from localhost only.
For troubleshooting (not to be permanent) you can do:

xhost +

this turns off any restrictions.
If you still have a problem, check if port 6000 is open:

netstat -nal | grep 6000

if not, very likely you have to go double check the original instructions.


--pawel

Mark Waite

unread,
Dec 28, 2012, 4:31:10 PM12/28/12
to jenkins...@googlegroups.com
Wouldn't it be easier to install a VNC server on your Ubuntu and use the Jenkins VNC plugin to manage an X server for use by your build?  I use that regularly and it works very well for me on Debian and Red Hat and CentOS machines.

Then you don't need to remember to keep the X server running and you don't need to remember to unlock its permissions.

Mark Waite



From: Pawel Jasinski <pawel.j...@gmail.com>
To: jenkins...@googlegroups.com
Sent: Friday, December 28, 2012 11:50 AM
Subject: Re: Jenkins cannot connect to X server on Ubuntu

suter_...@hotmail.com

unread,
Dec 29, 2012, 5:19:34 AM12/29/12
to jenkins...@googlegroups.com, Mark Waite
Thanks for your suggestion. This simply works. I thought at first I don't need that solution, since it's meant for headless servers.
Reply all
Reply to author
Forward
0 new messages