Set up a LXC Linux Container as Xserver howto

Last edited

LXC Linux Container

LXC Linux Containers provide a fast and lightweight virtualisation solution on top of Linux.

LXC Linux Container works on a standard stock Linux kernel, and can run on many platforms. It requires a few small userspace programs. The most popular mainline distributions come with LXC Linux Containers.

Xserver and Xterminals

In the nineties it was quite common to run a central server with several X-Terminal workstations. The X protocol is build with such a client-server configuration in mind.

The functionalities are still inside X, the protocals are still used today. This gives us the opportunity to add some serverbased computing to our environment. Just setup your LXC Linux Container as an xserver. There is no need for "real" full virtualisation.

Debian VPS

The text below is how to get X and xdm running on a Debian LXC Container.

This is done on a container with Debian 5.0 inside it.

Install X, xdm and windowmanager

We start with a clean minimal Debian container. On this we install X, xdm, xterm and a window-manager. In this example we choose blackbox as our windowmanager:

apt-get install xserver-xorg xdm xterm blackbox

Configure xdm


Comment out the line with "DisplayManager.requestPort" with an exclamation mark (!):

! DisplayManager.requestPort: 0


Remove the comment on the line with #any host can get a login window:

* #any host can get a login window

(remove the # sign before the * )

Restart xdm

/etc/init.d/xdm restart

Test the Xserver

To test the Xserver, you can run X -query from your workstation.

However, it is also possible to test it from within Xnest. That way you don't have to stop your current X-session.

Install Xnest if you haven't done that already and issue the command:

 Xnest :1 -query <ip-number> 
where <ip-number> is the ip-number of your LXC Linux container xserver.

If there are any problems, check /var/log/xdm.log on the Xserver.

Tune configfiles

After everything works fine, one could consider tuning the xdm-config and Xacces files. The current setup doesn't restrict access to the system. By changing these files the access can be resitrcted to an ip-range or even to an ip-number.

Install additional applications

Now the configuration of xdm is done, we can concentrate on making the Xserver do what we want it to do and install the applications that are needed. Like a webbrowser, email client, etc.

Screenshot of LXC Linux container as an Xserver

Below are some screenshots. They are made on a Acer Aspirce One as workstation, running the ratpoison window manager. On this workstation Xnest is started with -query to the ip-address of the LXC Linux container running xdm and X.

login screen
Log in screen of XDM in the Xnest window.

This screenshot shows a browserwindow in the background and an Xnest window in the foreground. The windowmanager in this screenshot is ratpoison, that is why there are no window-borders around the Xnest window and the browser window in the background.

The black areas in the login-window are a result of the way ratpoisons displays the window.

windowmanager screen
After logging in

This screenshot shows the Xnest after completing the login process. We see the windowmanager on the LXC Linux console, this is blackbox.


See the following local pages:

External resources: