Rolling a Linux-VServer Kernel

Linux-VServer is a virtualization platform that allows you to run VPSs without running complete OS environments.  It can be argued that Linux-VServer is actually more of a container platform than virtualization, however, you can’t think of it like Docker or LXC containers.  From a structural design, I would actually say that they are more similar to Solaris Zones, which are still technically containers, but the functionality is different.

The implementation of vserver VPSs saves massive overhead and allows for you to achieve the best performance possible from your system. Additionally, because the systems are paravirtualized, each system gives you the efficiency of talking directly to the kernel, but you avoid the insecurity of solutions like Docker containers. To be able to run a vserver system, you must use a custom kernel. This is not as difficult as you would expect.  

DISCLAIMER: This is a simple walkthrough that does not take into consideration CPU, memory, or disk limitations.  However, these are all possible through Linux-Vserver and I will be doing a separate article on implementing these limitations within VServer.

First, start out with a base Devuan/Debian system. If you do not have that, you can find specs for that here. Once you have that, you’ll need to install some prerequisite packages. Obviously, this will have to be done from a root shell or through the use of sudo.

apt-get -y install vim libncurses5-dev gcc make git exuberant-ctags libssl-dev xz-utils kernel-package

Now, go to the directory where we want to store the source code and grab the kernel source. Obviously, you need to grab the source of the respective kernel you want to roll.  Here, we’re rolling the 3.18 kernel with the vserver patch.  However, you can go to the project page and get whatever kernel/patch combination they have available.  If you need more extensive help or custom kernels, you can alway try the linux-vserver IRC channel on OFTC: irc:// You will find a user named Bertl in the channel that does consulting and support.  For the right price, he can provide whatever you may need, but we digress. 

Hop into the respective directory: 

cd /usr/src

Now unpack that kernel file.

tar xvf ./linux-source-3.18.91.tar.xz

Once it’s unpacked, you can jump into the directory and apply the patch.

cd linux-source-3.18.91
patch -p1 < ./patch-3.18.91-vs2.3.7.5.diff

Now it’s time to start compiling.

make clean && make mrproper
cp /boot/config-`uname -r` ./.config
make menuconfig

When the menuconfig loads, you’ll need to load the config file, which will be the default entry. Save then exit.

make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers

Now, go take a lunch break because it’s going to take forever for this to compile.

#Install new kernel
cd /usr/src
#Check file names before running dpkg
ls -l
dpkg -i linux-image-<VERSION>-custom_<VERSION>-custom-10.00.Custom_i386.deb
dpkg -i linux-headers-<VERSION>-custom_<VERSION>-custom-10.00.Custom_i386.deb

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s