# X server & jails



## dbi (Jul 17, 2010)

I was thinking about a dependency conflict [1] that prevents me from installing KDE4 and Gnome2 at same time and I came up with a fancy idea.

Is it possible to install KDE4 in a jail, Gnome2 in another one and use them to draw on the X server running on the host system?

Has anyone tried something like that?

[1] http://forums.freebsd.org/showthread.php?t=14981


----------



## Nukama (Jul 17, 2010)

I'm searching for a method to test programs in a jailed environment. 

There is another option, to use a Xserver inside a jail. But that needs some patching, and I'm not sure, if that particular method described in [1] works on your FreeBSD.

Maybe with a Xnest() server that connects to your outside Xorg(7) server. But not sure if Xnest can be run inside a jail (seems to be good shot, look at [2]). 

[1] http://docs.freebsd.org/cgi/getmsg.cgi?fetch=3431+0+archive/2008/freebsd-jail/20080316.freebsd-jail -> http://lists.freebsd.org/pipermail/freebsd-jail/2008-March/000217.html

[2] http://www.the-labs.com/FreeBSD/JailTools/cookbook.html#x11_for_each_jail


----------



## dbi (Jul 17, 2010)

Thanks, Nukama.

The links you gave are quite interesting, but on a slightly different subject. Running an entire X server and desktop environment in a jail and connecting/seeing that X server via vnc should be very appealing for the hosting companies.

However I want it the other way round - to run X on the host system as usual and start KDE or Gnome from a jail. I'm quite sleepy now, but tomorrow I guess I'll try to implement that setup on my desktop.


----------



## dbi (Jul 19, 2010)

I had the time to test the idea. It works. 


```
ezjail-admin create gnome.machine.example.com 192.168.0.111
Xnest :1 -ac
ezjail-admin console gnome
pkg_add -r xorg
pkg_add -r gnome2
sh
export DISPLAY=host.machine.example.com:1
gnome-session
```

VoilÃ ! Jailed Gnome shines on the host's Xnest server! 
FreeBSD wins again!


----------



## rockworldmi (Jan 5, 2012)

dbi can you produce same results in PC-BSD warden jail? Or can you suggest what to do? I want the same thing with warden jail system.


----------



## dbi (Jan 5, 2012)

rockworldmi said:
			
		

> dbi can you produce same results in PC-BSD warden jail ?? or can you suggest what to do ? i want the same thing with warden jail system..




Sorry. My PC-BSD usage is limited to several hours in total just to take a look at it. I'm not familiar with the "warden jail" concept.


----------



## rockworldmi (Jan 5, 2012)

Well warden is also available in Freebsd FreeBSD ports http://portsmon.freebsd.org/portoverview.py?category=sysutils&portname=warden

and installation method is in 
http://wiki.pcbsd.org/index.php/Warden™

Please let me know if you can help.

Thanks in advance..


----------



## Martillo1 (Feb 9, 2012)

Just tried with Xnest and Xorg in Portjail (to not mess with the PC-BSD system), and Xorg and pekwm in a Warden jail and it worked.

Yes, I jumped onto the bandwagon of lazy PC-BSD users :e


----------



## ucc (Aug 24, 2017)

I hat a try at this and would like to add that I had to force  `Xnest :1 -listen tcp` in order to get it working (I din't need the `-ac`, all local clients were allowed).

So here are my steps with FreeBSD 11.0 – ezjails was installed and I have a cloned loopback device for the jails and the hostname is _host_ and obviosly can be found in the /etc/hosts:


```
pkg install xorg-nestserver
ezjail-admin create gnomejail 'lo1|192.168.0.20'
Xnest :1 -listen tcp
ezjail-admin console gnomejail
pkg install xorg
pkg install gnome3-lite
setenv DISPLAY host:1
gnome-session
```

It worked, sure the gnome session failed, but hey, the error message showed up on the :1 display.


----------

