<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kirshil</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kirshil"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Kirshil"/>
	<updated>2026-06-13T17:52:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6126</id>
		<title>Creating OpenVZ LiveCD based on Centos 4.4</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6126"/>
		<updated>2008-07-07T07:17:56Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* Technical details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is a step by step guide explaining how to add OpenVZ functionality to Centos 4.4 LiveCD.&lt;br /&gt;
As a result, you will have a LiveCD, that can boot in various OpenVZ kernels (rhel4-2.6.9, 2.6.18,&lt;br /&gt;
rhel5-2.6.18, 2.6.20) and in original CentOS kernel also. After booting from the CD, you will be able &lt;br /&gt;
to create [[VE]]s, start them, enter them - i.e. perform [[Getting started with OpenVZ live CD | common OpenVZ activity]].&lt;br /&gt;
&lt;br /&gt;
CentOS 5 LiveCD is already announced and as soon as it will be available we'll update the article.&lt;br /&gt;
&lt;br /&gt;
== General actions ==&lt;br /&gt;
It is quite easy to add OpenVZ functionality to existent LiveCD. The most difficult work is already done&lt;br /&gt;
by the original LiveCD creators. But it requires pretty much hand job. Probably some day some good guy will&lt;br /&gt;
automatize this process. ;)&lt;br /&gt;
&lt;br /&gt;
Actually you need to accomplish the following general actions - everything else is only technical details:&lt;br /&gt;
* Get a copy of CentOS 4.4 LiveCD image &lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool to extract the contents of *.mo files, located on the image&lt;br /&gt;
* Construct '''booted''' LiveCD root filesystem from extracted files&lt;br /&gt;
* Create OpenVZ kernel RPM-packages  with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support&lt;br /&gt;
* Compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel modules against OpenVZ kernels&lt;br /&gt;
* Get OpenVZ tools RPM-packages: vzctl, vzquota, vzpkg, etc. Get template metadatas and precreated templates&lt;br /&gt;
* Remove some RPM-packages from '''booted''' LiveCD root filesystem (conflicting with OpenVZ kernel packages and redundant packages - to free some disk space)&lt;br /&gt;
* Install OpenVZ kernels, tools and templates in '''booted''' LiveCD root filesystem&lt;br /&gt;
* Using &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool compress '''booted''' CD root filesystem&lt;br /&gt;
* Modify initrd image: add there kernel modules for OpenVZ kernels&lt;br /&gt;
* Introduce small modifications to isolinux configuration file&lt;br /&gt;
* Create new iso image&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
This part contains detailed description of LiveCD creation. I've removed the output of some&lt;br /&gt;
commands in order to simplify the reading.&lt;br /&gt;
&lt;br /&gt;
Note: before proceed with commands below, one needs to disable SE Linux on the host, otherwise rpm operations &lt;br /&gt;
in cdroot-ed environment described later on will fail due to inability to restore security file context. So, please,&lt;br /&gt;
do:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# setenforce 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will put SE linux in so-called 'permissive' mode, where all the blockers will be substituted by warnings.&lt;br /&gt;
If you wanna get rid of the warnings (rather annoying), the only way to do is to edit &amp;lt;tt&amp;gt;/etc/sysconfig/selinux&amp;lt;/tt&amp;gt;&lt;br /&gt;
to read &amp;lt;tt&amp;gt;SELINUX=disabled&amp;lt;/tt&amp;gt; and then reboot the host.&lt;br /&gt;
&lt;br /&gt;
=== Creating booted LiveCD root filesystem ===&lt;br /&gt;
Create a directory, that will be our &amp;quot;workbench&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~&lt;br /&gt;
# mkdir workbench&lt;br /&gt;
# cd workbench&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all we need some raw material - CentOS 4.4 LiveCD image:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/CentOS-4.4-i386-LiveCD.iso&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/md5sum.livecd&lt;br /&gt;
# md5sum --check md5sum.livecd &lt;br /&gt;
CentOS-4.4-i386-LiveCD.iso: OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the contents of CD to the directory, where we will form the OpenVZ LiveCD filesystem.&lt;br /&gt;
I named this directory &amp;quot;ovz-livecd&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir ovz-livecd&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop -t iso9660 CentOS-4.4-i386-LiveCD.iso mount/&lt;br /&gt;
# cp -a mount/* ovz-livecd/&lt;br /&gt;
# umount mount&lt;br /&gt;
# rm -rf mount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see, that &amp;lt;tt&amp;gt;ovz-livecd/base/&amp;lt;/tt&amp;gt; directory owns several *.mo files - images of squashfs filesystem,&lt;br /&gt;
and each image holds one directory of '''booted''' LiveCD root filesystem: &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;usr&amp;lt;/tt&amp;gt; and so on:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -1 ovz-livecd/base&lt;br /&gt;
bin.mo etc.mo lib.mo root.mo sbin.mo usr.mo var.mo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decompress these images we need &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool. &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; source archive contains&lt;br /&gt;
patches for various kernel versions (to be able to mount &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;) and user-space tools for compressing usual filesytem into &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; filesystem and for decompressing it back. Well, we don't need kernel patches right now (but we will need them later), we only want to install &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; user-space tools.&lt;br /&gt;
Here is '''an important''' note. We want, our LiveCD to be able to boot original Centos 4.4 kernel. This original kernel doesn't support&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; of version &amp;lt;tt&amp;gt;3&amp;lt;/tt&amp;gt;. Consequently we use &amp;lt;tt&amp;gt;sqashfs2.2-r2&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;mksquasfs&amp;lt;/tt&amp;gt; tool, but for &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool and later for compiling fresh OpenVZ kernels with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support we use &amp;lt;tt&amp;gt;sqashfs3.2-r2&amp;lt;/tt&amp;gt; sources/patches, because they are back compatible with &amp;lt;tt&amp;gt;sqashfs v2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs2.2-r2.tar.gz&lt;br /&gt;
# cd squashfs2.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -o mksquashfs&lt;br /&gt;
# cp mksquashfs /usr/bin/&lt;br /&gt;
&lt;br /&gt;
# cd -&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs3.2-r2.tar.gz&lt;br /&gt;
# cd squashfs3.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -o mksquashfs&lt;br /&gt;
cc unsquashfs.o -lz -o unsquashfs&lt;br /&gt;
# cp unsquashfs /usr/bin/&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Well, having the intruments in hand, why not extract the images? Create a directory, called &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt;,&lt;br /&gt;
that will store the root filesystem of '''booted''' LiveCD. I.e. it will contain &amp;lt;tt&amp;gt;/bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sbin&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; and other directories, which you will see after booting the LiveCD. Unfortunately &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
tool is not very convenient, and I found only this way to use it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir livecd-root&lt;br /&gt;
&lt;br /&gt;
# for f in bin etc lib root sbin usr var; do \&lt;br /&gt;
    unsquashfs ovz-livecd/base/$f.mo; \&lt;br /&gt;
    mv squashfs-root/$f/ livecd-root; \&lt;br /&gt;
    rm -rf squashfs-root; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be patient, this will take a few minutes.&lt;br /&gt;
&lt;br /&gt;
Yet we have nearly complete root filesystem of '''booted''' LiveCD in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory. However some things&lt;br /&gt;
are missing, and I guess you know what are they: &amp;lt;tt&amp;gt;/dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; directories. We need them, because some tools (&amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, ...) will not work without them in chrooted environment later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd livecd-root&lt;br /&gt;
# mkdir dev&lt;br /&gt;
# cp -a /dev/* dev/&lt;br /&gt;
# mkdir proc&lt;br /&gt;
# mount -t proc proc proc/&lt;br /&gt;
# mkdir sys&lt;br /&gt;
# mount -t sysfs sysfs sys/&lt;br /&gt;
# mkdir tmp&lt;br /&gt;
# mkdir boot&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it. We have '''bootstrapped''' LiveCD root filesystem in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
Now we can &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; in this directory and install all needed packages. But what&lt;br /&gt;
packages do we need?&lt;br /&gt;
* OpenVZ kernels&lt;br /&gt;
* OpenVZ tools: vzctl, vzquota, vzpkg, vzrpm43, vzrpm44, vzyum&lt;br /&gt;
* OpenVZ template metadatas: centos-4, fc-3, fc4 and fc-5&lt;br /&gt;
* Some OpenVZ precreated templates&lt;br /&gt;
* Some CentOS tool updates: sqlite package&lt;br /&gt;
Tools and templates related packages can be simply downloaded and installed.&lt;br /&gt;
But it is not so easy with kernel. Usual OpenVZ kernel won't work: it doesn't&lt;br /&gt;
support &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;. The next chapter explains how to create RPM-package with&lt;br /&gt;
OpenVZ kernel, that supports &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building OpenVZ kernels ===&lt;br /&gt;
Let's consider, how to build &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt; OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support.&lt;br /&gt;
First  download and install OpenVZ source RPM:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://download.openvz.org/kernel/branches/2.6.18/028stab035.1/kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
# rpm -ivh kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; sources contain the patch against &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt;. Let's copy this patch to RPM build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp squashfs3.2-r2/kernel-patches/linux-2.6.18/squashfs3.2-patch /usr/src/redhat/SOURCES/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we need to modify the spec-file (&amp;lt;tt&amp;gt;/usr/src/redhat/SPECS/kernel-ovz.spec&amp;lt;/tt&amp;gt;) in order to add &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch to build process. Below are the changes you should introduce in diff format.&lt;br /&gt;
The meaning of changes is transparent: firstly, do not build UP, enterprise and debug kernels (our LiveCD will be&lt;br /&gt;
based on SMP kernel) and secondly, apply &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch before compilation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- kernel-ovz.spec.orig        2007-06-09 11:40:15.000000000 +0400&lt;br /&gt;
+++ kernel-ovz.spec     2007-06-28 17:42:41.000000000 +0400&lt;br /&gt;
@@ -5,13 +5,13 @@ Summary: The Linux kernel (the core of t&lt;br /&gt;
&lt;br /&gt;
 # normal/debug/debuginfo&lt;br /&gt;
 %define buildnormal 1&lt;br /&gt;
-%define builddebug 1&lt;br /&gt;
+%define builddebug 0&lt;br /&gt;
 %define builddebuginfo 0&lt;br /&gt;
&lt;br /&gt;
 # kernels we want to build&lt;br /&gt;
-%define buildup 1&lt;br /&gt;
+%define buildup 0&lt;br /&gt;
 %define buildsmp 1&lt;br /&gt;
-%define buildenterprise 1&lt;br /&gt;
+%define buildenterprise 0&lt;br /&gt;
 %define buildentnosplit 0&lt;br /&gt;
&lt;br /&gt;
 # versions&lt;br /&gt;
@@ -161,6 +161,9 @@ Patch2104: linux-2.6.18-drbd-0.7.22-0.8.&lt;br /&gt;
 Patch2105: linux-2.6.18-drbd-8.0.0-8.0.2.patch&lt;br /&gt;
 Patch2106: linux-2.6.18-drbd-8.0.2-8.0.3.patch&lt;br /&gt;
&lt;br /&gt;
+# squashfs3.2-patch&lt;br /&gt;
+Patch2107: squashfs3.2-patch&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root&lt;br /&gt;
@@ -318,6 +321,8 @@ cd linux-%{kversion}&lt;br /&gt;
 %patch2105 -p1&lt;br /&gt;
 %patch2106 -p1&lt;br /&gt;
&lt;br /&gt;
+%patch2107 -p1&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 mkdir configs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We need one more tiny hack in order RPM-build process to walk smoothly.&lt;br /&gt;
There are config files for various OpenVZ kernel flavours &lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls /usr/src/redhat/SOURCES/*.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686.config.ovz             /usr/src/redhat/SOURCES/kernel-2.6.18-ppc64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-enterprise.config.ovz  /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-smp.config.ovz         /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64-smp.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-ia64.config.ovz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''All''' these files should contain information about &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
In fact, only two additional lines are necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I did it with the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SOURCES/&lt;br /&gt;
# echo &amp;quot;CONFIG_SQUASHFS=m&lt;br /&gt;
&amp;gt; CONFIG_SQUASHFS_EMBEDDED=n&amp;quot; | tee -a *.config.ovz&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After all efforts, building the RPM-package is very easy:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SPECS/&lt;br /&gt;
# rpmbuild --target=i686 -ba kernel-ovz.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything goes smoothly, in several tens of minutes depending on the power of your node you willl have OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support. Let's copy it to our local directory &amp;lt;tt&amp;gt;to_booted_livecd/kernels/&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
# ls /usr/src/redhat/RPMS/i686/&lt;br /&gt;
kernel-smp-2.6.18-ovz028stab035.1.i686.rpm&lt;br /&gt;
# mkdir -p to_booted_livecd/kernels&lt;br /&gt;
# cp /usr/src/redhat/RPMS/i686/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm to_booted_livecd/kernels/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OpenVZ LiveCD supports several kernels. So, the actions mentioned above should be accomplished to all kernels,&lt;br /&gt;
that you need on LiveCD. In this article I skip the description of building RPMS for all kernels. All description&lt;br /&gt;
below are based on &amp;lt;tt&amp;gt;028stab035&amp;lt;/tt&amp;gt; kernel, that has been just build above. But some important differences in building&lt;br /&gt;
kernel of version other then 2.6.18 one is summarized below.&lt;br /&gt;
==== Peculiarities of building 2.6.9-rhel4 ====&lt;br /&gt;
* You should also include this patch (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da)&lt;br /&gt;
in building process. Hopefully will be fixed in &amp;lt;tt&amp;gt;2.6.9-044stab044.8&amp;lt;/tt&amp;gt; kernel.&lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unionfs 1.0.14&amp;lt;/tt&amp;gt;, but not &amp;lt;tt&amp;gt;unionfs 1.1.5&amp;lt;/tt&amp;gt;, as offered at its official site!&lt;br /&gt;
* Small problems while building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;: arguments of &amp;lt;tt&amp;gt;vfs_permissions()&amp;lt;/tt&amp;gt;. Just add &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt;&lt;br /&gt;
to appropriate places.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.18-rhel5 ====&lt;br /&gt;
* Note, &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch is already there, but you should use &amp;lt;tt&amp;gt;3.2&amp;lt;/tt&amp;gt;! :)&lt;br /&gt;
* While building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; some small fixes: &amp;lt;tt&amp;gt;i_blksize&amp;lt;/tt&amp;gt; field is missing in &amp;lt;tt&amp;gt;inode&amp;lt;/tt&amp;gt; structure, &amp;lt;tt&amp;gt;ino_t&amp;lt;/tt&amp;gt; should be changed to &amp;lt;tt&amp;gt;u64&amp;lt;/tt&amp;gt; in some functions.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.20 ====&lt;br /&gt;
* Only &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; is available for 2.6.20 kernel and it is distributed as a patch. Consequently modify &amp;lt;tt&amp;gt;spec&amp;lt;/tt&amp;gt;-file and configs while building the kernel&lt;br /&gt;
* &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; doesn't support unionctl. Consequently you have to modify &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file on &amp;lt;tt&amp;gt;initrd&amp;lt;/tt&amp;gt; image to mount all branches at once, but don't add them by ioctls.&lt;br /&gt;
&lt;br /&gt;
=== Unionfs kernel module ===&lt;br /&gt;
In most present-day LiveCDs &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem is used. This filesystem &amp;quot;can appear to merge the contents of several directories, while keeping their physical content separate&amp;quot;. For example, after the command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mount -t unionfs -o dirs=/tmp/changes=rw:/cdrom=ro unionfs /union&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
you will see merged contents of &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt; directories in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory. &lt;br /&gt;
At that, &amp;lt;tt&amp;gt;cdrom&amp;lt;/tt&amp;gt; will be read-only. I.e. if you will write to some file in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory, &lt;br /&gt;
that resides in &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; in fact, this modified file will be automatically moved to &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Such useful property is logically used in LiveCDs: &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; merges cdrom contents (that is read-only)&lt;br /&gt;
and temporary in-memory filesystem.&lt;br /&gt;
In order to add support of &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem to OpenVZ kernel we need to compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel&lt;br /&gt;
module against used kernel. Download the sources of unionfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget ftp://ftp.filesystems.org/pub/unionfs/unionfs-1.x/unionfs-1.4.tar.gz&lt;br /&gt;
# tar xzf unionfs-1.4.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In previous chapter we have created an RPM-package with OpenVZ kernel. We should install it: because&lt;br /&gt;
this packages contents kernel headers, required for building kernel modules.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ivh to_booted_livecd/kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
Preparing...                ########################################### [100%]&lt;br /&gt;
   1:kernel-smp             ########################################### [100%]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd unionfs-1.4&lt;br /&gt;
# echo 'LINUXSRC=/lib/modules/2.6.18-ovz028stab035.1-smp/build/&lt;br /&gt;
&amp;gt; TOPINC=-I$(LINUXSRC)/include&lt;br /&gt;
&amp;gt; MODDIR=/lib/modules/2.6.18-ovz028stab035.1-smp/' &amp;gt; fistdev.mk&lt;br /&gt;
# make&lt;br /&gt;
# ls unionfs.ko &lt;br /&gt;
unionfs.ko&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Later we will place &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to appropriate place in '''booted''' LiveCD filesystem.&lt;br /&gt;
At the moment copy it to local &amp;lt;tt&amp;gt;to_booted_livecd/unionfs-modules/2.6.18/&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir -p to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
# cp unionfs-1.4/unionfs.ko to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I repeat once again: if you want to use several kernels on LiveCD - the operation above should&lt;br /&gt;
be repeated for each wishful kernel.&lt;br /&gt;
&lt;br /&gt;
=== OpenVZ tools and templates. CentOS updates ===&lt;br /&gt;
We have now the kernel RPM-package. But we also need OpenVZ tools RPM-packages.&lt;br /&gt;
It is much easier with them: just download these packages from http://openvz.org:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/tools&lt;br /&gt;
# cd to_booted_livecd/tools/&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-lib-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzquota/3.0.9/vzquota-3.0.9-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-python-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzyum/current/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../template-metadatas&lt;br /&gt;
# cd ../template-metadatas&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/centos-4/vztmpl-centos-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-3/vztmpl-fedora-core-3-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-4/vztmpl-fedora-core-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-5/vztmpl-fedora-core-5-2.0-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../precreated&lt;br /&gt;
# cd ../precreated&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/centos-4-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/debian-3.1-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you understand, you can add other precreated templates to LiveCD. The main thing here is that usual CD is &lt;br /&gt;
not rubber and precreated templates are rather big! ;)&lt;br /&gt;
&lt;br /&gt;
Centos 4.4 LiveCD has a serios problem: &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package is broken and consequently&lt;br /&gt;
&amp;lt;tt&amp;gt;yum&amp;lt;/tt&amp;gt; doesn't work. In order to fix this problem we need updated &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/updates&lt;br /&gt;
# cd to_booted_livecd/updates&lt;br /&gt;
# wget http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install all these finally ===&lt;br /&gt;
We have all components that will be on '''booted''' LiveCD ready. Let's install them&lt;br /&gt;
in &amp;lt;tt&amp;gt;chrooted&amp;lt;/tt&amp;gt; environment. But before uninstall &amp;lt;tt&amp;gt;lsctp-tools&amp;lt;/tt&amp;gt; package,&lt;br /&gt;
because these tools need kernel version prior to 2.6.10. Then update &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&lt;br /&gt;
package. Also we need to remove some other packages in order to free some disk space:&lt;br /&gt;
I've removed &amp;lt;tt&amp;gt;openoffice.org&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;dia&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gnome-games&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;tetex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;latex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;k3b&amp;lt;/tt&amp;gt; and printing related packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r to_booted_livecd/ livecd-root/tmp/&lt;br /&gt;
# chroot livecd-root/&lt;br /&gt;
&lt;br /&gt;
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386&lt;br /&gt;
&lt;br /&gt;
# rpm -e openoffice.org-libs openoffice.org&lt;br /&gt;
# rpm -e gimp-data-extras xsane-gimp gimp-print-plugin gimp-print-utils&lt;br /&gt;
# rpm -e gimp gimp-print gimp-help gimp-gap&lt;br /&gt;
# rpm -e dia&lt;br /&gt;
# rpm -e planner&lt;br /&gt;
# rpm -e gnome-games&lt;br /&gt;
# rpm -e tetex-latex jadetex xmltex passivetex tetex tetex-afm \&lt;br /&gt;
tetex-dvips tetex-fonts tetex-xdvi&lt;br /&gt;
# rpm -e k3b&lt;br /&gt;
# rpm -e foomatic Omni Omni-foomatic system-config-printer \&lt;br /&gt;
system-config-printer-gui hal-cups-utils desktop-printing&lt;br /&gt;
&lt;br /&gt;
# cd /tmp/to_booted_livecd/&lt;br /&gt;
&lt;br /&gt;
# rpm -Uvh updates/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# rpm -ivh kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
# rpm -ivh tools/*.rpm&lt;br /&gt;
# rpm -ivh template-metadatas/*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy precreated templates to appropriate place:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp  precreated/* /vz/template/cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to other kernel modules and run &amp;lt;tt&amp;gt;depmod&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs&lt;br /&gt;
# cp unionfs-modules/2.6.18/unionfs.ko /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs/&lt;br /&gt;
# depmod 2.6.18-ovz028stab035.1-smp&lt;br /&gt;
# exit&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
While being in chrooted environment bash history was written to &amp;lt;tt&amp;gt;~/.bash_history&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
Clean it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm livecd-root/root/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment&lt;br /&gt;
chekpointing isn't supported on &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem ([http://bugzilla.openvz.org/show_bug.cgi?id=606  Bug #606]).&lt;br /&gt;
But we want of course checkpoiting to work on LiveCD. If we mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;/vz/private/&amp;lt;/tt&amp;gt; on '''booted''' LiveCD,&lt;br /&gt;
then all newly created VEs reside on &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; and checkpointing works. Moreover we do not introduce any additional memory usage,&lt;br /&gt;
because even without &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; all VEs reside in RAM (they contain new/updated files for &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; directory, later, while modifying initrd image we will add the line that will mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
on this directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir livecd-root/vz/private/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At the moment vzquota doesn't support &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; ([http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #558]).&lt;br /&gt;
We're working on this problem, but for now '''switching the disk quota off''' in &amp;lt;tt&amp;gt;/etc/vz/vz.conf&amp;lt;/tt&amp;gt;: &amp;lt;tt&amp;gt;DISK_QUOTA=no&amp;lt;/tt&amp;gt;.&lt;br /&gt;
But when disk quota is off &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt; fails! ;) This is the [http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #512].&lt;br /&gt;
So, don't forget to apply the patch attached to this bug report to &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Booted''' LiveCD filesystem is ready, congratulations!&lt;br /&gt;
&lt;br /&gt;
=== Compressing '''booted''' LiveCD filesystem ===&lt;br /&gt;
Since &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool is already installed we can simply use it to create&lt;br /&gt;
&amp;lt;tt&amp;gt;*.mo&amp;lt;/tt&amp;gt; files: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm -f ovz-livecd/base/*.mo&lt;br /&gt;
# for f in bin etc lib root sbin usr var vz; do \&lt;br /&gt;
    mksquashfs livecd-root/$f ovz-livecd/base/$f.mo -keep-as-directory; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vmlinux, initrd and isolinux.cfg ===&lt;br /&gt;
The next step is to force &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; (cdrom boot loader) to boot OpenVZ kernel.&lt;br /&gt;
First, copy kernel image to OpenVZ CD. It is important to give '''short name''' (not greater&lt;br /&gt;
than 8 characters) to kernel image, otherwise &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; will not see it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp livecd-root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there&lt;br /&gt;
and apply small patches to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file. Initrd image that goes with Centos 4.4 is&lt;br /&gt;
of size 40Mb. OpenVZ LiveCD will contain several kernels, so initrd should have several sets of&lt;br /&gt;
kernel modules (for each kernel) and 40Mb isn't enough in this case. I created an initrd of size 100Mb.&lt;br /&gt;
Don't forget to update &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;isolinux.cfg&amp;lt;/tt&amp;gt; file later!&lt;br /&gt;
&lt;br /&gt;
Creating &amp;quot;big&amp;quot; initrd with original content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir initrd.d&lt;br /&gt;
# cp ovz-livecd/boot/initrd.gz initrd.d/initrd-old.gz&lt;br /&gt;
# cd initrd.d/&lt;br /&gt;
# mkdir mount-old&lt;br /&gt;
# gunzip initrd-old.gz &lt;br /&gt;
# mount -o loop initrd-old mount-old/&lt;br /&gt;
# dd if=/dev/zero of=initrd bs=1048576 count=100&lt;br /&gt;
# mke2fs initrd&lt;br /&gt;
initrd is not a block special device.&lt;br /&gt;
Proceed anyway? (y,n) y&lt;br /&gt;
...&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop initrd mount/&lt;br /&gt;
# cp -a mount-old/* mount/&lt;br /&gt;
# umount mount-old/&lt;br /&gt;
# rm -rf mount-old initrd-old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy modules to initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r ../livecd-root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/&lt;br /&gt;
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build                 # we don't neet it on initrd image&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I also delete some not necessary kernel modules from initrd to free space.&lt;br /&gt;
They are stil on CD, so init sctipts will be able to load them later.&lt;br /&gt;
&lt;br /&gt;
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules.&lt;br /&gt;
It works well for CentOS kernel, because cdrom support is built-in there.&lt;br /&gt;
But OpenVZ kernel supports cdrom (usual ide cdrom) via kernel module.&lt;br /&gt;
Consequetnly we need to apply the following patch to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig   2006-08-19 08:53:11.000000000 +0400&lt;br /&gt;
+++ liblinuxlive        2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
@@ -337,6 +337,9 @@ modprobe_essential_modules()&lt;br /&gt;
 {&lt;br /&gt;
    echolog &amp;quot;starting loop device support&amp;quot;&lt;br /&gt;
    modprobe_module loop max_loop=32&lt;br /&gt;
+   echolog &amp;quot;starting cdrom support&amp;quot;&lt;br /&gt;
+   modprobe_module cdrom&lt;br /&gt;
+   modprobe_module ide-cd&lt;br /&gt;
    echolog &amp;quot;starting cdrom filesystem support&amp;quot;&lt;br /&gt;
    modprobe_module isofs&lt;br /&gt;
    echolog &amp;quot;starting squashfs support&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As mentioned earlier we want to mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on /vz/private automatically. Just apply this patch to&lt;br /&gt;
&amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig-fstab     2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
+++ mount/liblinuxlive  2007-07-03 12:33:30.000000000 +0400&lt;br /&gt;
@@ -414,6 +414,7 @@ activate_fstab()&lt;br /&gt;
    echo &amp;quot;tmpfs            /                tmpfs       defaults         0   0&amp;quot; &amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;devpts           /dev/pts         devpts      gid=5,mode=620   0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;proc             /proc            proc        defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
+   echo &amp;quot;tmpfs            /vz/private      tmpfs       defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
&lt;br /&gt;
    # now done by fstab-sync&lt;br /&gt;
    # list_cdrom_devices | while read DEVICE; do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finishing actions with initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sync&lt;br /&gt;
# umount mount/&lt;br /&gt;
# gzip initrd&lt;br /&gt;
# cp initrd.gz ../ovz-livecd/boot/initrd.gz&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we should modify &amp;lt;tt&amp;gt;ovz-livecd/isolinux.cfg&amp;lt;/tt&amp;gt; file, that controls &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; boot loader.&lt;br /&gt;
We inform boot loader, that new kernel was added by introducing the following changes (in diff format):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- ovz-livecd/isolinux.cfg.orig   2006-08-19 08:53:09.000000000 +0400&lt;br /&gt;
+++ ovz-livecd/isolinux.cfg     2007-07-02 19:10:51.000000000 +0400&lt;br /&gt;
@@ -1,5 +1,5 @@&lt;br /&gt;
 display boot/splash.cfg&lt;br /&gt;
-default linux&lt;br /&gt;
+default ovz18&lt;br /&gt;
 prompt 1&lt;br /&gt;
 timeout 300&lt;br /&gt;
 F1 boot/help1.txt&lt;br /&gt;
@@ -11,5 +11,9 @@ label linux&lt;br /&gt;
 kernel boot/vmlinuz&lt;br /&gt;
 append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=40000 root=/dev/ram0 rw rhgb quiet&lt;br /&gt;
&lt;br /&gt;
+label ovz18 &lt;br /&gt;
+kernel boot/ovz18&lt;br /&gt;
+append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 root=/dev/ram0 rw rhgb&lt;br /&gt;
+&lt;br /&gt;
 label memtest&lt;br /&gt;
 kernel boot/memtest&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also '''don't forget''' to change &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; to 102400 for all kernels including Centos 4.4 default! &lt;br /&gt;
&lt;br /&gt;
And I suggest to remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; parameter, to see what happens: it will help greatly if some problem will happen.&lt;br /&gt;
&lt;br /&gt;
=== Embellishment ===&lt;br /&gt;
If you want to release LiveCD to other people some &amp;quot;embelishments&amp;quot; should be added.&lt;br /&gt;
&lt;br /&gt;
First, edit &amp;lt;tt&amp;gt;splash.cfg&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help1.txt&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help2.txt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;help3.txt&amp;lt;/tt&amp;gt;&lt;br /&gt;
files (that are in &amp;lt;tt&amp;gt;~/workbench/ovz-livecd/boot/help&amp;lt;/tt&amp;gt; directory) to contain appropriate information.&lt;br /&gt;
These messages appear on the LiveCD initial boot: they help to choose kernel and kernel options.&lt;br /&gt;
&lt;br /&gt;
Also, you can note, that CentOS logo appears at this moment. This logo resides in &amp;lt;tt&amp;gt;ovz-livecd/boot/splash.lss&amp;lt;/tt&amp;gt;&lt;br /&gt;
file. I added OpenVZ logo there. The following tools will help you: &amp;lt;tt&amp;gt;lss16toppm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ppmtolss16&amp;lt;/tt&amp;gt; and&lt;br /&gt;
of course &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt; :)&lt;br /&gt;
&lt;br /&gt;
One more thing we change is default desktop background. It resides in &amp;lt;tt&amp;gt;usr/share/backgrounds/images/default.png&amp;lt;/tt&amp;gt;.&lt;br /&gt;
I added OpenVZ logo there.&lt;br /&gt;
&lt;br /&gt;
=== Creating ISO ===&lt;br /&gt;
Centos 4.4 LiveCD creators were very gentle and have placed &amp;lt;tt&amp;gt;make_iso.sh&amp;lt;/tt&amp;gt; script on CD.&lt;br /&gt;
Using this script, it is very easy to create iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ovz-livecd&lt;br /&gt;
# ./make_iso.sh ../CentOS-4.4-i386-OpenVZ-LiveCD.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debugging LiveCD ==&lt;br /&gt;
If you have trouble with created OpenVZ LiveCD, boot the kernel with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vga=0 debug&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command line options. It will help you to diagnose the problem more precisely.&lt;br /&gt;
Also it can be useful to redirect kernel output to serial console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more at [[remote console setup]].&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://centos.org Official CentOS community website]&lt;br /&gt;
* [http://kernel.org Linux kernel website]&lt;br /&gt;
* [http://redhat.com RedHat Inc. website]&lt;br /&gt;
* [http://squashfs.sourceforge.net/ squashfs website]&lt;br /&gt;
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Live CD]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6125</id>
		<title>Creating OpenVZ LiveCD based on Centos 4.4</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6125"/>
		<updated>2008-07-07T07:06:57Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* Vmlinux, initrd and isolinux.cfg */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is a step by step guide explaining how to add OpenVZ functionality to Centos 4.4 LiveCD.&lt;br /&gt;
As a result, you will have a LiveCD, that can boot in various OpenVZ kernels (rhel4-2.6.9, 2.6.18,&lt;br /&gt;
rhel5-2.6.18, 2.6.20) and in original CentOS kernel also. After booting from the CD, you will be able &lt;br /&gt;
to create [[VE]]s, start them, enter them - i.e. perform [[Getting started with OpenVZ live CD | common OpenVZ activity]].&lt;br /&gt;
&lt;br /&gt;
CentOS 5 LiveCD is already announced and as soon as it will be available we'll update the article.&lt;br /&gt;
&lt;br /&gt;
== General actions ==&lt;br /&gt;
It is quite easy to add OpenVZ functionality to existent LiveCD. The most difficult work is already done&lt;br /&gt;
by the original LiveCD creators. But it requires pretty much hand job. Probably some day some good guy will&lt;br /&gt;
automatize this process. ;)&lt;br /&gt;
&lt;br /&gt;
Actually you need to accomplish the following general actions - everything else is only technical details:&lt;br /&gt;
* Get a copy of CentOS 4.4 LiveCD image &lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool to extract the contents of *.mo files, located on the image&lt;br /&gt;
* Construct '''booted''' LiveCD root filesystem from extracted files&lt;br /&gt;
* Create OpenVZ kernel RPM-packages  with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support&lt;br /&gt;
* Compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel modules against OpenVZ kernels&lt;br /&gt;
* Get OpenVZ tools RPM-packages: vzctl, vzquota, vzpkg, etc. Get template metadatas and precreated templates&lt;br /&gt;
* Remove some RPM-packages from '''booted''' LiveCD root filesystem (conflicting with OpenVZ kernel packages and redundant packages - to free some disk space)&lt;br /&gt;
* Install OpenVZ kernels, tools and templates in '''booted''' LiveCD root filesystem&lt;br /&gt;
* Using &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool compress '''booted''' CD root filesystem&lt;br /&gt;
* Modify initrd image: add there kernel modules for OpenVZ kernels&lt;br /&gt;
* Introduce small modifications to isolinux configuration file&lt;br /&gt;
* Create new iso image&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
This part contains detailed description of LiveCD creation. I've removed the output of some&lt;br /&gt;
commands in order to simplify the reading.&lt;br /&gt;
&lt;br /&gt;
=== Creating booted LiveCD root filesystem ===&lt;br /&gt;
Create a directory, that will be our &amp;quot;workbench&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~&lt;br /&gt;
# mkdir workbench&lt;br /&gt;
# cd workbench&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all we need some raw material - CentOS 4.4 LiveCD image:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/CentOS-4.4-i386-LiveCD.iso&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/md5sum.livecd&lt;br /&gt;
# md5sum --check md5sum.livecd &lt;br /&gt;
CentOS-4.4-i386-LiveCD.iso: OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the contents of CD to the directory, where we will form the OpenVZ LiveCD filesystem.&lt;br /&gt;
I named this directory &amp;quot;ovz-livecd&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir ovz-livecd&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop -t iso9660 CentOS-4.4-i386-LiveCD.iso mount/&lt;br /&gt;
# cp -a mount/* ovz-livecd/&lt;br /&gt;
# umount mount&lt;br /&gt;
# rm -rf mount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see, that &amp;lt;tt&amp;gt;ovz-livecd/base/&amp;lt;/tt&amp;gt; directory owns several *.mo files - images of squashfs filesystem,&lt;br /&gt;
and each image holds one directory of '''booted''' LiveCD root filesystem: &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;usr&amp;lt;/tt&amp;gt; and so on:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -1 ovz-livecd/base&lt;br /&gt;
bin.mo etc.mo lib.mo root.mo sbin.mo usr.mo var.mo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decompress these images we need &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool. &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; source archive contains&lt;br /&gt;
patches for various kernel versions (to be able to mount &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;) and user-space tools for compressing usual filesytem into &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; filesystem and for decompressing it back. Well, we don't need kernel patches right now (but we will need them later), we only want to install &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; user-space tools.&lt;br /&gt;
Here is '''an important''' note. We want, our LiveCD to be able to boot original Centos 4.4 kernel. This original kernel doesn't support&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; of version &amp;lt;tt&amp;gt;3&amp;lt;/tt&amp;gt;. Consequently we use &amp;lt;tt&amp;gt;sqashfs2.2-r2&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;mksquasfs&amp;lt;/tt&amp;gt; tool, but for &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool and later for compiling fresh OpenVZ kernels with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support we use &amp;lt;tt&amp;gt;sqashfs3.2-r2&amp;lt;/tt&amp;gt; sources/patches, because they are back compatible with &amp;lt;tt&amp;gt;sqashfs v2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs2.2-r2.tar.gz&lt;br /&gt;
# cd squashfs2.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -o mksquashfs&lt;br /&gt;
# cp mksquashfs /usr/bin/&lt;br /&gt;
&lt;br /&gt;
# cd -&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs3.2-r2.tar.gz&lt;br /&gt;
# cd squashfs3.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -o mksquashfs&lt;br /&gt;
cc unsquashfs.o -lz -o unsquashfs&lt;br /&gt;
# cp unsquashfs /usr/bin/&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Well, having the intruments in hand, why not extract the images? Create a directory, called &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt;,&lt;br /&gt;
that will store the root filesystem of '''booted''' LiveCD. I.e. it will contain &amp;lt;tt&amp;gt;/bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sbin&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; and other directories, which you will see after booting the LiveCD. Unfortunately &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
tool is not very convenient, and I found only this way to use it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir livecd-root&lt;br /&gt;
&lt;br /&gt;
# for f in bin etc lib root sbin usr var; do \&lt;br /&gt;
    unsquashfs ovz-livecd/base/$f.mo; \&lt;br /&gt;
    mv squashfs-root/$f/ livecd-root; \&lt;br /&gt;
    rm -rf squashfs-root; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be patient, this will take a few minutes.&lt;br /&gt;
&lt;br /&gt;
Yet we have nearly complete root filesystem of '''booted''' LiveCD in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory. However some things&lt;br /&gt;
are missing, and I guess you know what are they: &amp;lt;tt&amp;gt;/dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; directories. We need them, because some tools (&amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, ...) will not work without them in chrooted environment later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd livecd-root&lt;br /&gt;
# mkdir dev&lt;br /&gt;
# cp -a /dev/* dev/&lt;br /&gt;
# mkdir proc&lt;br /&gt;
# mount -t proc proc proc/&lt;br /&gt;
# mkdir sys&lt;br /&gt;
# mount -t sysfs sysfs sys/&lt;br /&gt;
# mkdir tmp&lt;br /&gt;
# mkdir boot&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it. We have '''bootstrapped''' LiveCD root filesystem in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
Now we can &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; in this directory and install all needed packages. But what&lt;br /&gt;
packages do we need?&lt;br /&gt;
* OpenVZ kernels&lt;br /&gt;
* OpenVZ tools: vzctl, vzquota, vzpkg, vzrpm43, vzrpm44, vzyum&lt;br /&gt;
* OpenVZ template metadatas: centos-4, fc-3, fc4 and fc-5&lt;br /&gt;
* Some OpenVZ precreated templates&lt;br /&gt;
* Some CentOS tool updates: sqlite package&lt;br /&gt;
Tools and templates related packages can be simply downloaded and installed.&lt;br /&gt;
But it is not so easy with kernel. Usual OpenVZ kernel won't work: it doesn't&lt;br /&gt;
support &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;. The next chapter explains how to create RPM-package with&lt;br /&gt;
OpenVZ kernel, that supports &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building OpenVZ kernels ===&lt;br /&gt;
Let's consider, how to build &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt; OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support.&lt;br /&gt;
First  download and install OpenVZ source RPM:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://download.openvz.org/kernel/branches/2.6.18/028stab035.1/kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
# rpm -ivh kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; sources contain the patch against &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt;. Let's copy this patch to RPM build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp squashfs3.2-r2/kernel-patches/linux-2.6.18/squashfs3.2-patch /usr/src/redhat/SOURCES/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we need to modify the spec-file (&amp;lt;tt&amp;gt;/usr/src/redhat/SPECS/kernel-ovz.spec&amp;lt;/tt&amp;gt;) in order to add &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch to build process. Below are the changes you should introduce in diff format.&lt;br /&gt;
The meaning of changes is transparent: firstly, do not build UP, enterprise and debug kernels (our LiveCD will be&lt;br /&gt;
based on SMP kernel) and secondly, apply &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch before compilation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- kernel-ovz.spec.orig        2007-06-09 11:40:15.000000000 +0400&lt;br /&gt;
+++ kernel-ovz.spec     2007-06-28 17:42:41.000000000 +0400&lt;br /&gt;
@@ -5,13 +5,13 @@ Summary: The Linux kernel (the core of t&lt;br /&gt;
&lt;br /&gt;
 # normal/debug/debuginfo&lt;br /&gt;
 %define buildnormal 1&lt;br /&gt;
-%define builddebug 1&lt;br /&gt;
+%define builddebug 0&lt;br /&gt;
 %define builddebuginfo 0&lt;br /&gt;
&lt;br /&gt;
 # kernels we want to build&lt;br /&gt;
-%define buildup 1&lt;br /&gt;
+%define buildup 0&lt;br /&gt;
 %define buildsmp 1&lt;br /&gt;
-%define buildenterprise 1&lt;br /&gt;
+%define buildenterprise 0&lt;br /&gt;
 %define buildentnosplit 0&lt;br /&gt;
&lt;br /&gt;
 # versions&lt;br /&gt;
@@ -161,6 +161,9 @@ Patch2104: linux-2.6.18-drbd-0.7.22-0.8.&lt;br /&gt;
 Patch2105: linux-2.6.18-drbd-8.0.0-8.0.2.patch&lt;br /&gt;
 Patch2106: linux-2.6.18-drbd-8.0.2-8.0.3.patch&lt;br /&gt;
&lt;br /&gt;
+# squashfs3.2-patch&lt;br /&gt;
+Patch2107: squashfs3.2-patch&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root&lt;br /&gt;
@@ -318,6 +321,8 @@ cd linux-%{kversion}&lt;br /&gt;
 %patch2105 -p1&lt;br /&gt;
 %patch2106 -p1&lt;br /&gt;
&lt;br /&gt;
+%patch2107 -p1&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 mkdir configs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We need one more tiny hack in order RPM-build process to walk smoothly.&lt;br /&gt;
There are config files for various OpenVZ kernel flavours &lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls /usr/src/redhat/SOURCES/*.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686.config.ovz             /usr/src/redhat/SOURCES/kernel-2.6.18-ppc64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-enterprise.config.ovz  /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-smp.config.ovz         /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64-smp.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-ia64.config.ovz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''All''' these files should contain information about &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
In fact, only two additional lines are necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I did it with the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SOURCES/&lt;br /&gt;
# echo &amp;quot;CONFIG_SQUASHFS=m&lt;br /&gt;
&amp;gt; CONFIG_SQUASHFS_EMBEDDED=n&amp;quot; | tee -a *.config.ovz&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After all efforts, building the RPM-package is very easy:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SPECS/&lt;br /&gt;
# rpmbuild --target=i686 -ba kernel-ovz.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything goes smoothly, in several tens of minutes depending on the power of your node you willl have OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support. Let's copy it to our local directory &amp;lt;tt&amp;gt;to_booted_livecd/kernels/&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
# ls /usr/src/redhat/RPMS/i686/&lt;br /&gt;
kernel-smp-2.6.18-ovz028stab035.1.i686.rpm&lt;br /&gt;
# mkdir -p to_booted_livecd/kernels&lt;br /&gt;
# cp /usr/src/redhat/RPMS/i686/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm to_booted_livecd/kernels/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OpenVZ LiveCD supports several kernels. So, the actions mentioned above should be accomplished to all kernels,&lt;br /&gt;
that you need on LiveCD. In this article I skip the description of building RPMS for all kernels. All description&lt;br /&gt;
below are based on &amp;lt;tt&amp;gt;028stab035&amp;lt;/tt&amp;gt; kernel, that has been just build above. But some important differences in building&lt;br /&gt;
kernel of version other then 2.6.18 one is summarized below.&lt;br /&gt;
==== Peculiarities of building 2.6.9-rhel4 ====&lt;br /&gt;
* You should also include this patch (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da)&lt;br /&gt;
in building process. Hopefully will be fixed in &amp;lt;tt&amp;gt;2.6.9-044stab044.8&amp;lt;/tt&amp;gt; kernel.&lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unionfs 1.0.14&amp;lt;/tt&amp;gt;, but not &amp;lt;tt&amp;gt;unionfs 1.1.5&amp;lt;/tt&amp;gt;, as offered at its official site!&lt;br /&gt;
* Small problems while building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;: arguments of &amp;lt;tt&amp;gt;vfs_permissions()&amp;lt;/tt&amp;gt;. Just add &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt;&lt;br /&gt;
to appropriate places.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.18-rhel5 ====&lt;br /&gt;
* Note, &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch is already there, but you should use &amp;lt;tt&amp;gt;3.2&amp;lt;/tt&amp;gt;! :)&lt;br /&gt;
* While building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; some small fixes: &amp;lt;tt&amp;gt;i_blksize&amp;lt;/tt&amp;gt; field is missing in &amp;lt;tt&amp;gt;inode&amp;lt;/tt&amp;gt; structure, &amp;lt;tt&amp;gt;ino_t&amp;lt;/tt&amp;gt; should be changed to &amp;lt;tt&amp;gt;u64&amp;lt;/tt&amp;gt; in some functions.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.20 ====&lt;br /&gt;
* Only &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; is available for 2.6.20 kernel and it is distributed as a patch. Consequently modify &amp;lt;tt&amp;gt;spec&amp;lt;/tt&amp;gt;-file and configs while building the kernel&lt;br /&gt;
* &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; doesn't support unionctl. Consequently you have to modify &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file on &amp;lt;tt&amp;gt;initrd&amp;lt;/tt&amp;gt; image to mount all branches at once, but don't add them by ioctls.&lt;br /&gt;
&lt;br /&gt;
=== Unionfs kernel module ===&lt;br /&gt;
In most present-day LiveCDs &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem is used. This filesystem &amp;quot;can appear to merge the contents of several directories, while keeping their physical content separate&amp;quot;. For example, after the command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mount -t unionfs -o dirs=/tmp/changes=rw:/cdrom=ro unionfs /union&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
you will see merged contents of &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt; directories in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory. &lt;br /&gt;
At that, &amp;lt;tt&amp;gt;cdrom&amp;lt;/tt&amp;gt; will be read-only. I.e. if you will write to some file in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory, &lt;br /&gt;
that resides in &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; in fact, this modified file will be automatically moved to &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Such useful property is logically used in LiveCDs: &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; merges cdrom contents (that is read-only)&lt;br /&gt;
and temporary in-memory filesystem.&lt;br /&gt;
In order to add support of &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem to OpenVZ kernel we need to compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel&lt;br /&gt;
module against used kernel. Download the sources of unionfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget ftp://ftp.filesystems.org/pub/unionfs/unionfs-1.x/unionfs-1.4.tar.gz&lt;br /&gt;
# tar xzf unionfs-1.4.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In previous chapter we have created an RPM-package with OpenVZ kernel. We should install it: because&lt;br /&gt;
this packages contents kernel headers, required for building kernel modules.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ivh to_booted_livecd/kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
Preparing...                ########################################### [100%]&lt;br /&gt;
   1:kernel-smp             ########################################### [100%]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd unionfs-1.4&lt;br /&gt;
# echo 'LINUXSRC=/lib/modules/2.6.18-ovz028stab035.1-smp/build/&lt;br /&gt;
&amp;gt; TOPINC=-I$(LINUXSRC)/include&lt;br /&gt;
&amp;gt; MODDIR=/lib/modules/2.6.18-ovz028stab035.1-smp/' &amp;gt; fistdev.mk&lt;br /&gt;
# make&lt;br /&gt;
# ls unionfs.ko &lt;br /&gt;
unionfs.ko&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Later we will place &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to appropriate place in '''booted''' LiveCD filesystem.&lt;br /&gt;
At the moment copy it to local &amp;lt;tt&amp;gt;to_booted_livecd/unionfs-modules/2.6.18/&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir -p to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
# cp unionfs-1.4/unionfs.ko to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I repeat once again: if you want to use several kernels on LiveCD - the operation above should&lt;br /&gt;
be repeated for each wishful kernel.&lt;br /&gt;
&lt;br /&gt;
=== OpenVZ tools and templates. CentOS updates ===&lt;br /&gt;
We have now the kernel RPM-package. But we also need OpenVZ tools RPM-packages.&lt;br /&gt;
It is much easier with them: just download these packages from http://openvz.org:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/tools&lt;br /&gt;
# cd to_booted_livecd/tools/&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-lib-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzquota/3.0.9/vzquota-3.0.9-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-python-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzyum/current/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../template-metadatas&lt;br /&gt;
# cd ../template-metadatas&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/centos-4/vztmpl-centos-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-3/vztmpl-fedora-core-3-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-4/vztmpl-fedora-core-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-5/vztmpl-fedora-core-5-2.0-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../precreated&lt;br /&gt;
# cd ../precreated&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/centos-4-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/debian-3.1-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you understand, you can add other precreated templates to LiveCD. The main thing here is that usual CD is &lt;br /&gt;
not rubber and precreated templates are rather big! ;)&lt;br /&gt;
&lt;br /&gt;
Centos 4.4 LiveCD has a serios problem: &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package is broken and consequently&lt;br /&gt;
&amp;lt;tt&amp;gt;yum&amp;lt;/tt&amp;gt; doesn't work. In order to fix this problem we need updated &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/updates&lt;br /&gt;
# cd to_booted_livecd/updates&lt;br /&gt;
# wget http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install all these finally ===&lt;br /&gt;
We have all components that will be on '''booted''' LiveCD ready. Let's install them&lt;br /&gt;
in &amp;lt;tt&amp;gt;chrooted&amp;lt;/tt&amp;gt; environment. But before uninstall &amp;lt;tt&amp;gt;lsctp-tools&amp;lt;/tt&amp;gt; package,&lt;br /&gt;
because these tools need kernel version prior to 2.6.10. Then update &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&lt;br /&gt;
package. Also we need to remove some other packages in order to free some disk space:&lt;br /&gt;
I've removed &amp;lt;tt&amp;gt;openoffice.org&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;dia&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gnome-games&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;tetex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;latex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;k3b&amp;lt;/tt&amp;gt; and printing related packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r to_booted_livecd/ livecd-root/tmp/&lt;br /&gt;
# chroot livecd-root/&lt;br /&gt;
&lt;br /&gt;
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386&lt;br /&gt;
&lt;br /&gt;
# rpm -e openoffice.org-libs openoffice.org&lt;br /&gt;
# rpm -e gimp-data-extras xsane-gimp gimp-print-plugin gimp-print-utils&lt;br /&gt;
# rpm -e gimp gimp-print gimp-help gimp-gap&lt;br /&gt;
# rpm -e dia&lt;br /&gt;
# rpm -e planner&lt;br /&gt;
# rpm -e gnome-games&lt;br /&gt;
# rpm -e tetex-latex jadetex xmltex passivetex tetex tetex-afm \&lt;br /&gt;
tetex-dvips tetex-fonts tetex-xdvi&lt;br /&gt;
# rpm -e k3b&lt;br /&gt;
# rpm -e foomatic Omni Omni-foomatic system-config-printer \&lt;br /&gt;
system-config-printer-gui hal-cups-utils desktop-printing&lt;br /&gt;
&lt;br /&gt;
# cd /tmp/to_booted_livecd/&lt;br /&gt;
&lt;br /&gt;
# rpm -Uvh updates/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# rpm -ivh kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
# rpm -ivh tools/*.rpm&lt;br /&gt;
# rpm -ivh template-metadatas/*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy precreated templates to appropriate place:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp  precreated/* /vz/template/cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to other kernel modules and run &amp;lt;tt&amp;gt;depmod&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs&lt;br /&gt;
# cp unionfs-modules/2.6.18/unionfs.ko /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs/&lt;br /&gt;
# depmod 2.6.18-ovz028stab035.1-smp&lt;br /&gt;
# exit&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
While being in chrooted environment bash history was written to &amp;lt;tt&amp;gt;~/.bash_history&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
Clean it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm livecd-root/root/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment&lt;br /&gt;
chekpointing isn't supported on &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem ([http://bugzilla.openvz.org/show_bug.cgi?id=606  Bug #606]).&lt;br /&gt;
But we want of course checkpoiting to work on LiveCD. If we mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;/vz/private/&amp;lt;/tt&amp;gt; on '''booted''' LiveCD,&lt;br /&gt;
then all newly created VEs reside on &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; and checkpointing works. Moreover we do not introduce any additional memory usage,&lt;br /&gt;
because even without &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; all VEs reside in RAM (they contain new/updated files for &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; directory, later, while modifying initrd image we will add the line that will mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
on this directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir livecd-root/vz/private/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At the moment vzquota doesn't support &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; ([http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #558]).&lt;br /&gt;
We're working on this problem, but for now '''switching the disk quota off''' in &amp;lt;tt&amp;gt;/etc/vz/vz.conf&amp;lt;/tt&amp;gt;: &amp;lt;tt&amp;gt;DISK_QUOTA=no&amp;lt;/tt&amp;gt;.&lt;br /&gt;
But when disk quota is off &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt; fails! ;) This is the [http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #512].&lt;br /&gt;
So, don't forget to apply the patch attached to this bug report to &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Booted''' LiveCD filesystem is ready, congratulations!&lt;br /&gt;
&lt;br /&gt;
=== Compressing '''booted''' LiveCD filesystem ===&lt;br /&gt;
Since &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool is already installed we can simply use it to create&lt;br /&gt;
&amp;lt;tt&amp;gt;*.mo&amp;lt;/tt&amp;gt; files: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm -f ovz-livecd/base/*.mo&lt;br /&gt;
# for f in bin etc lib root sbin usr var vz; do \&lt;br /&gt;
    mksquashfs livecd-root/$f ovz-livecd/base/$f.mo -keep-as-directory; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vmlinux, initrd and isolinux.cfg ===&lt;br /&gt;
The next step is to force &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; (cdrom boot loader) to boot OpenVZ kernel.&lt;br /&gt;
First, copy kernel image to OpenVZ CD. It is important to give '''short name''' (not greater&lt;br /&gt;
than 8 characters) to kernel image, otherwise &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; will not see it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp livecd-root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there&lt;br /&gt;
and apply small patches to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file. Initrd image that goes with Centos 4.4 is&lt;br /&gt;
of size 40Mb. OpenVZ LiveCD will contain several kernels, so initrd should have several sets of&lt;br /&gt;
kernel modules (for each kernel) and 40Mb isn't enough in this case. I created an initrd of size 100Mb.&lt;br /&gt;
Don't forget to update &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;isolinux.cfg&amp;lt;/tt&amp;gt; file later!&lt;br /&gt;
&lt;br /&gt;
Creating &amp;quot;big&amp;quot; initrd with original content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir initrd.d&lt;br /&gt;
# cp ovz-livecd/boot/initrd.gz initrd.d/initrd-old.gz&lt;br /&gt;
# cd initrd.d/&lt;br /&gt;
# mkdir mount-old&lt;br /&gt;
# gunzip initrd-old.gz &lt;br /&gt;
# mount -o loop initrd-old mount-old/&lt;br /&gt;
# dd if=/dev/zero of=initrd bs=1048576 count=100&lt;br /&gt;
# mke2fs initrd&lt;br /&gt;
initrd is not a block special device.&lt;br /&gt;
Proceed anyway? (y,n) y&lt;br /&gt;
...&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop initrd mount/&lt;br /&gt;
# cp -a mount-old/* mount/&lt;br /&gt;
# umount mount-old/&lt;br /&gt;
# rm -rf mount-old initrd-old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy modules to initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r ../livecd-root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/&lt;br /&gt;
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build                 # we don't neet it on initrd image&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I also delete some not necessary kernel modules from initrd to free space.&lt;br /&gt;
They are stil on CD, so init sctipts will be able to load them later.&lt;br /&gt;
&lt;br /&gt;
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules.&lt;br /&gt;
It works well for CentOS kernel, because cdrom support is built-in there.&lt;br /&gt;
But OpenVZ kernel supports cdrom (usual ide cdrom) via kernel module.&lt;br /&gt;
Consequetnly we need to apply the following patch to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig   2006-08-19 08:53:11.000000000 +0400&lt;br /&gt;
+++ liblinuxlive        2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
@@ -337,6 +337,9 @@ modprobe_essential_modules()&lt;br /&gt;
 {&lt;br /&gt;
    echolog &amp;quot;starting loop device support&amp;quot;&lt;br /&gt;
    modprobe_module loop max_loop=32&lt;br /&gt;
+   echolog &amp;quot;starting cdrom support&amp;quot;&lt;br /&gt;
+   modprobe_module cdrom&lt;br /&gt;
+   modprobe_module ide-cd&lt;br /&gt;
    echolog &amp;quot;starting cdrom filesystem support&amp;quot;&lt;br /&gt;
    modprobe_module isofs&lt;br /&gt;
    echolog &amp;quot;starting squashfs support&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As mentioned earlier we want to mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on /vz/private automatically. Just apply this patch to&lt;br /&gt;
&amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig-fstab     2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
+++ mount/liblinuxlive  2007-07-03 12:33:30.000000000 +0400&lt;br /&gt;
@@ -414,6 +414,7 @@ activate_fstab()&lt;br /&gt;
    echo &amp;quot;tmpfs            /                tmpfs       defaults         0   0&amp;quot; &amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;devpts           /dev/pts         devpts      gid=5,mode=620   0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;proc             /proc            proc        defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
+   echo &amp;quot;tmpfs            /vz/private      tmpfs       defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
&lt;br /&gt;
    # now done by fstab-sync&lt;br /&gt;
    # list_cdrom_devices | while read DEVICE; do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finishing actions with initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sync&lt;br /&gt;
# umount mount/&lt;br /&gt;
# gzip initrd&lt;br /&gt;
# cp initrd.gz ../ovz-livecd/boot/initrd.gz&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we should modify &amp;lt;tt&amp;gt;ovz-livecd/isolinux.cfg&amp;lt;/tt&amp;gt; file, that controls &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; boot loader.&lt;br /&gt;
We inform boot loader, that new kernel was added by introducing the following changes (in diff format):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- ovz-livecd/isolinux.cfg.orig   2006-08-19 08:53:09.000000000 +0400&lt;br /&gt;
+++ ovz-livecd/isolinux.cfg     2007-07-02 19:10:51.000000000 +0400&lt;br /&gt;
@@ -1,5 +1,5 @@&lt;br /&gt;
 display boot/splash.cfg&lt;br /&gt;
-default linux&lt;br /&gt;
+default ovz18&lt;br /&gt;
 prompt 1&lt;br /&gt;
 timeout 300&lt;br /&gt;
 F1 boot/help1.txt&lt;br /&gt;
@@ -11,5 +11,9 @@ label linux&lt;br /&gt;
 kernel boot/vmlinuz&lt;br /&gt;
 append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=40000 root=/dev/ram0 rw rhgb quiet&lt;br /&gt;
&lt;br /&gt;
+label ovz18 &lt;br /&gt;
+kernel boot/ovz18&lt;br /&gt;
+append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 root=/dev/ram0 rw rhgb&lt;br /&gt;
+&lt;br /&gt;
 label memtest&lt;br /&gt;
 kernel boot/memtest&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also '''don't forget''' to change &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; to 102400 for all kernels including Centos 4.4 default! &lt;br /&gt;
&lt;br /&gt;
And I suggest to remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; parameter, to see what happens: it will help greatly if some problem will happen.&lt;br /&gt;
&lt;br /&gt;
=== Embellishment ===&lt;br /&gt;
If you want to release LiveCD to other people some &amp;quot;embelishments&amp;quot; should be added.&lt;br /&gt;
&lt;br /&gt;
First, edit &amp;lt;tt&amp;gt;splash.cfg&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help1.txt&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help2.txt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;help3.txt&amp;lt;/tt&amp;gt;&lt;br /&gt;
files (that are in &amp;lt;tt&amp;gt;~/workbench/ovz-livecd/boot/help&amp;lt;/tt&amp;gt; directory) to contain appropriate information.&lt;br /&gt;
These messages appear on the LiveCD initial boot: they help to choose kernel and kernel options.&lt;br /&gt;
&lt;br /&gt;
Also, you can note, that CentOS logo appears at this moment. This logo resides in &amp;lt;tt&amp;gt;ovz-livecd/boot/splash.lss&amp;lt;/tt&amp;gt;&lt;br /&gt;
file. I added OpenVZ logo there. The following tools will help you: &amp;lt;tt&amp;gt;lss16toppm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ppmtolss16&amp;lt;/tt&amp;gt; and&lt;br /&gt;
of course &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt; :)&lt;br /&gt;
&lt;br /&gt;
One more thing we change is default desktop background. It resides in &amp;lt;tt&amp;gt;usr/share/backgrounds/images/default.png&amp;lt;/tt&amp;gt;.&lt;br /&gt;
I added OpenVZ logo there.&lt;br /&gt;
&lt;br /&gt;
=== Creating ISO ===&lt;br /&gt;
Centos 4.4 LiveCD creators were very gentle and have placed &amp;lt;tt&amp;gt;make_iso.sh&amp;lt;/tt&amp;gt; script on CD.&lt;br /&gt;
Using this script, it is very easy to create iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ovz-livecd&lt;br /&gt;
# ./make_iso.sh ../CentOS-4.4-i386-OpenVZ-LiveCD.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debugging LiveCD ==&lt;br /&gt;
If you have trouble with created OpenVZ LiveCD, boot the kernel with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vga=0 debug&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command line options. It will help you to diagnose the problem more precisely.&lt;br /&gt;
Also it can be useful to redirect kernel output to serial console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more at [[remote console setup]].&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://centos.org Official CentOS community website]&lt;br /&gt;
* [http://kernel.org Linux kernel website]&lt;br /&gt;
* [http://redhat.com RedHat Inc. website]&lt;br /&gt;
* [http://squashfs.sourceforge.net/ squashfs website]&lt;br /&gt;
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Live CD]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6124</id>
		<title>Creating OpenVZ LiveCD based on Centos 4.4</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6124"/>
		<updated>2008-07-07T06:39:37Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* Compressing '''booted''' LiveCD filesystem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is a step by step guide explaining how to add OpenVZ functionality to Centos 4.4 LiveCD.&lt;br /&gt;
As a result, you will have a LiveCD, that can boot in various OpenVZ kernels (rhel4-2.6.9, 2.6.18,&lt;br /&gt;
rhel5-2.6.18, 2.6.20) and in original CentOS kernel also. After booting from the CD, you will be able &lt;br /&gt;
to create [[VE]]s, start them, enter them - i.e. perform [[Getting started with OpenVZ live CD | common OpenVZ activity]].&lt;br /&gt;
&lt;br /&gt;
CentOS 5 LiveCD is already announced and as soon as it will be available we'll update the article.&lt;br /&gt;
&lt;br /&gt;
== General actions ==&lt;br /&gt;
It is quite easy to add OpenVZ functionality to existent LiveCD. The most difficult work is already done&lt;br /&gt;
by the original LiveCD creators. But it requires pretty much hand job. Probably some day some good guy will&lt;br /&gt;
automatize this process. ;)&lt;br /&gt;
&lt;br /&gt;
Actually you need to accomplish the following general actions - everything else is only technical details:&lt;br /&gt;
* Get a copy of CentOS 4.4 LiveCD image &lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool to extract the contents of *.mo files, located on the image&lt;br /&gt;
* Construct '''booted''' LiveCD root filesystem from extracted files&lt;br /&gt;
* Create OpenVZ kernel RPM-packages  with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support&lt;br /&gt;
* Compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel modules against OpenVZ kernels&lt;br /&gt;
* Get OpenVZ tools RPM-packages: vzctl, vzquota, vzpkg, etc. Get template metadatas and precreated templates&lt;br /&gt;
* Remove some RPM-packages from '''booted''' LiveCD root filesystem (conflicting with OpenVZ kernel packages and redundant packages - to free some disk space)&lt;br /&gt;
* Install OpenVZ kernels, tools and templates in '''booted''' LiveCD root filesystem&lt;br /&gt;
* Using &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool compress '''booted''' CD root filesystem&lt;br /&gt;
* Modify initrd image: add there kernel modules for OpenVZ kernels&lt;br /&gt;
* Introduce small modifications to isolinux configuration file&lt;br /&gt;
* Create new iso image&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
This part contains detailed description of LiveCD creation. I've removed the output of some&lt;br /&gt;
commands in order to simplify the reading.&lt;br /&gt;
&lt;br /&gt;
=== Creating booted LiveCD root filesystem ===&lt;br /&gt;
Create a directory, that will be our &amp;quot;workbench&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~&lt;br /&gt;
# mkdir workbench&lt;br /&gt;
# cd workbench&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all we need some raw material - CentOS 4.4 LiveCD image:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/CentOS-4.4-i386-LiveCD.iso&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/md5sum.livecd&lt;br /&gt;
# md5sum --check md5sum.livecd &lt;br /&gt;
CentOS-4.4-i386-LiveCD.iso: OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the contents of CD to the directory, where we will form the OpenVZ LiveCD filesystem.&lt;br /&gt;
I named this directory &amp;quot;ovz-livecd&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir ovz-livecd&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop -t iso9660 CentOS-4.4-i386-LiveCD.iso mount/&lt;br /&gt;
# cp -a mount/* ovz-livecd/&lt;br /&gt;
# umount mount&lt;br /&gt;
# rm -rf mount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see, that &amp;lt;tt&amp;gt;ovz-livecd/base/&amp;lt;/tt&amp;gt; directory owns several *.mo files - images of squashfs filesystem,&lt;br /&gt;
and each image holds one directory of '''booted''' LiveCD root filesystem: &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;usr&amp;lt;/tt&amp;gt; and so on:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -1 ovz-livecd/base&lt;br /&gt;
bin.mo etc.mo lib.mo root.mo sbin.mo usr.mo var.mo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decompress these images we need &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool. &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; source archive contains&lt;br /&gt;
patches for various kernel versions (to be able to mount &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;) and user-space tools for compressing usual filesytem into &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; filesystem and for decompressing it back. Well, we don't need kernel patches right now (but we will need them later), we only want to install &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; user-space tools.&lt;br /&gt;
Here is '''an important''' note. We want, our LiveCD to be able to boot original Centos 4.4 kernel. This original kernel doesn't support&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; of version &amp;lt;tt&amp;gt;3&amp;lt;/tt&amp;gt;. Consequently we use &amp;lt;tt&amp;gt;sqashfs2.2-r2&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;mksquasfs&amp;lt;/tt&amp;gt; tool, but for &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool and later for compiling fresh OpenVZ kernels with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support we use &amp;lt;tt&amp;gt;sqashfs3.2-r2&amp;lt;/tt&amp;gt; sources/patches, because they are back compatible with &amp;lt;tt&amp;gt;sqashfs v2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs2.2-r2.tar.gz&lt;br /&gt;
# cd squashfs2.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -o mksquashfs&lt;br /&gt;
# cp mksquashfs /usr/bin/&lt;br /&gt;
&lt;br /&gt;
# cd -&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs3.2-r2.tar.gz&lt;br /&gt;
# cd squashfs3.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -o mksquashfs&lt;br /&gt;
cc unsquashfs.o -lz -o unsquashfs&lt;br /&gt;
# cp unsquashfs /usr/bin/&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Well, having the intruments in hand, why not extract the images? Create a directory, called &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt;,&lt;br /&gt;
that will store the root filesystem of '''booted''' LiveCD. I.e. it will contain &amp;lt;tt&amp;gt;/bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sbin&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; and other directories, which you will see after booting the LiveCD. Unfortunately &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
tool is not very convenient, and I found only this way to use it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir livecd-root&lt;br /&gt;
&lt;br /&gt;
# for f in bin etc lib root sbin usr var; do \&lt;br /&gt;
    unsquashfs ovz-livecd/base/$f.mo; \&lt;br /&gt;
    mv squashfs-root/$f/ livecd-root; \&lt;br /&gt;
    rm -rf squashfs-root; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be patient, this will take a few minutes.&lt;br /&gt;
&lt;br /&gt;
Yet we have nearly complete root filesystem of '''booted''' LiveCD in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory. However some things&lt;br /&gt;
are missing, and I guess you know what are they: &amp;lt;tt&amp;gt;/dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; directories. We need them, because some tools (&amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, ...) will not work without them in chrooted environment later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd livecd-root&lt;br /&gt;
# mkdir dev&lt;br /&gt;
# cp -a /dev/* dev/&lt;br /&gt;
# mkdir proc&lt;br /&gt;
# mount -t proc proc proc/&lt;br /&gt;
# mkdir sys&lt;br /&gt;
# mount -t sysfs sysfs sys/&lt;br /&gt;
# mkdir tmp&lt;br /&gt;
# mkdir boot&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it. We have '''bootstrapped''' LiveCD root filesystem in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
Now we can &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; in this directory and install all needed packages. But what&lt;br /&gt;
packages do we need?&lt;br /&gt;
* OpenVZ kernels&lt;br /&gt;
* OpenVZ tools: vzctl, vzquota, vzpkg, vzrpm43, vzrpm44, vzyum&lt;br /&gt;
* OpenVZ template metadatas: centos-4, fc-3, fc4 and fc-5&lt;br /&gt;
* Some OpenVZ precreated templates&lt;br /&gt;
* Some CentOS tool updates: sqlite package&lt;br /&gt;
Tools and templates related packages can be simply downloaded and installed.&lt;br /&gt;
But it is not so easy with kernel. Usual OpenVZ kernel won't work: it doesn't&lt;br /&gt;
support &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;. The next chapter explains how to create RPM-package with&lt;br /&gt;
OpenVZ kernel, that supports &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building OpenVZ kernels ===&lt;br /&gt;
Let's consider, how to build &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt; OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support.&lt;br /&gt;
First  download and install OpenVZ source RPM:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://download.openvz.org/kernel/branches/2.6.18/028stab035.1/kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
# rpm -ivh kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; sources contain the patch against &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt;. Let's copy this patch to RPM build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp squashfs3.2-r2/kernel-patches/linux-2.6.18/squashfs3.2-patch /usr/src/redhat/SOURCES/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we need to modify the spec-file (&amp;lt;tt&amp;gt;/usr/src/redhat/SPECS/kernel-ovz.spec&amp;lt;/tt&amp;gt;) in order to add &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch to build process. Below are the changes you should introduce in diff format.&lt;br /&gt;
The meaning of changes is transparent: firstly, do not build UP, enterprise and debug kernels (our LiveCD will be&lt;br /&gt;
based on SMP kernel) and secondly, apply &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch before compilation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- kernel-ovz.spec.orig        2007-06-09 11:40:15.000000000 +0400&lt;br /&gt;
+++ kernel-ovz.spec     2007-06-28 17:42:41.000000000 +0400&lt;br /&gt;
@@ -5,13 +5,13 @@ Summary: The Linux kernel (the core of t&lt;br /&gt;
&lt;br /&gt;
 # normal/debug/debuginfo&lt;br /&gt;
 %define buildnormal 1&lt;br /&gt;
-%define builddebug 1&lt;br /&gt;
+%define builddebug 0&lt;br /&gt;
 %define builddebuginfo 0&lt;br /&gt;
&lt;br /&gt;
 # kernels we want to build&lt;br /&gt;
-%define buildup 1&lt;br /&gt;
+%define buildup 0&lt;br /&gt;
 %define buildsmp 1&lt;br /&gt;
-%define buildenterprise 1&lt;br /&gt;
+%define buildenterprise 0&lt;br /&gt;
 %define buildentnosplit 0&lt;br /&gt;
&lt;br /&gt;
 # versions&lt;br /&gt;
@@ -161,6 +161,9 @@ Patch2104: linux-2.6.18-drbd-0.7.22-0.8.&lt;br /&gt;
 Patch2105: linux-2.6.18-drbd-8.0.0-8.0.2.patch&lt;br /&gt;
 Patch2106: linux-2.6.18-drbd-8.0.2-8.0.3.patch&lt;br /&gt;
&lt;br /&gt;
+# squashfs3.2-patch&lt;br /&gt;
+Patch2107: squashfs3.2-patch&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root&lt;br /&gt;
@@ -318,6 +321,8 @@ cd linux-%{kversion}&lt;br /&gt;
 %patch2105 -p1&lt;br /&gt;
 %patch2106 -p1&lt;br /&gt;
&lt;br /&gt;
+%patch2107 -p1&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 mkdir configs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We need one more tiny hack in order RPM-build process to walk smoothly.&lt;br /&gt;
There are config files for various OpenVZ kernel flavours &lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls /usr/src/redhat/SOURCES/*.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686.config.ovz             /usr/src/redhat/SOURCES/kernel-2.6.18-ppc64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-enterprise.config.ovz  /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-smp.config.ovz         /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64-smp.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-ia64.config.ovz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''All''' these files should contain information about &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
In fact, only two additional lines are necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I did it with the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SOURCES/&lt;br /&gt;
# echo &amp;quot;CONFIG_SQUASHFS=m&lt;br /&gt;
&amp;gt; CONFIG_SQUASHFS_EMBEDDED=n&amp;quot; | tee -a *.config.ovz&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After all efforts, building the RPM-package is very easy:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SPECS/&lt;br /&gt;
# rpmbuild --target=i686 -ba kernel-ovz.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything goes smoothly, in several tens of minutes depending on the power of your node you willl have OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support. Let's copy it to our local directory &amp;lt;tt&amp;gt;to_booted_livecd/kernels/&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
# ls /usr/src/redhat/RPMS/i686/&lt;br /&gt;
kernel-smp-2.6.18-ovz028stab035.1.i686.rpm&lt;br /&gt;
# mkdir -p to_booted_livecd/kernels&lt;br /&gt;
# cp /usr/src/redhat/RPMS/i686/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm to_booted_livecd/kernels/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OpenVZ LiveCD supports several kernels. So, the actions mentioned above should be accomplished to all kernels,&lt;br /&gt;
that you need on LiveCD. In this article I skip the description of building RPMS for all kernels. All description&lt;br /&gt;
below are based on &amp;lt;tt&amp;gt;028stab035&amp;lt;/tt&amp;gt; kernel, that has been just build above. But some important differences in building&lt;br /&gt;
kernel of version other then 2.6.18 one is summarized below.&lt;br /&gt;
==== Peculiarities of building 2.6.9-rhel4 ====&lt;br /&gt;
* You should also include this patch (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da)&lt;br /&gt;
in building process. Hopefully will be fixed in &amp;lt;tt&amp;gt;2.6.9-044stab044.8&amp;lt;/tt&amp;gt; kernel.&lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unionfs 1.0.14&amp;lt;/tt&amp;gt;, but not &amp;lt;tt&amp;gt;unionfs 1.1.5&amp;lt;/tt&amp;gt;, as offered at its official site!&lt;br /&gt;
* Small problems while building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;: arguments of &amp;lt;tt&amp;gt;vfs_permissions()&amp;lt;/tt&amp;gt;. Just add &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt;&lt;br /&gt;
to appropriate places.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.18-rhel5 ====&lt;br /&gt;
* Note, &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch is already there, but you should use &amp;lt;tt&amp;gt;3.2&amp;lt;/tt&amp;gt;! :)&lt;br /&gt;
* While building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; some small fixes: &amp;lt;tt&amp;gt;i_blksize&amp;lt;/tt&amp;gt; field is missing in &amp;lt;tt&amp;gt;inode&amp;lt;/tt&amp;gt; structure, &amp;lt;tt&amp;gt;ino_t&amp;lt;/tt&amp;gt; should be changed to &amp;lt;tt&amp;gt;u64&amp;lt;/tt&amp;gt; in some functions.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.20 ====&lt;br /&gt;
* Only &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; is available for 2.6.20 kernel and it is distributed as a patch. Consequently modify &amp;lt;tt&amp;gt;spec&amp;lt;/tt&amp;gt;-file and configs while building the kernel&lt;br /&gt;
* &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; doesn't support unionctl. Consequently you have to modify &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file on &amp;lt;tt&amp;gt;initrd&amp;lt;/tt&amp;gt; image to mount all branches at once, but don't add them by ioctls.&lt;br /&gt;
&lt;br /&gt;
=== Unionfs kernel module ===&lt;br /&gt;
In most present-day LiveCDs &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem is used. This filesystem &amp;quot;can appear to merge the contents of several directories, while keeping their physical content separate&amp;quot;. For example, after the command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mount -t unionfs -o dirs=/tmp/changes=rw:/cdrom=ro unionfs /union&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
you will see merged contents of &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt; directories in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory. &lt;br /&gt;
At that, &amp;lt;tt&amp;gt;cdrom&amp;lt;/tt&amp;gt; will be read-only. I.e. if you will write to some file in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory, &lt;br /&gt;
that resides in &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; in fact, this modified file will be automatically moved to &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Such useful property is logically used in LiveCDs: &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; merges cdrom contents (that is read-only)&lt;br /&gt;
and temporary in-memory filesystem.&lt;br /&gt;
In order to add support of &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem to OpenVZ kernel we need to compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel&lt;br /&gt;
module against used kernel. Download the sources of unionfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget ftp://ftp.filesystems.org/pub/unionfs/unionfs-1.x/unionfs-1.4.tar.gz&lt;br /&gt;
# tar xzf unionfs-1.4.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In previous chapter we have created an RPM-package with OpenVZ kernel. We should install it: because&lt;br /&gt;
this packages contents kernel headers, required for building kernel modules.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ivh to_booted_livecd/kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
Preparing...                ########################################### [100%]&lt;br /&gt;
   1:kernel-smp             ########################################### [100%]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd unionfs-1.4&lt;br /&gt;
# echo 'LINUXSRC=/lib/modules/2.6.18-ovz028stab035.1-smp/build/&lt;br /&gt;
&amp;gt; TOPINC=-I$(LINUXSRC)/include&lt;br /&gt;
&amp;gt; MODDIR=/lib/modules/2.6.18-ovz028stab035.1-smp/' &amp;gt; fistdev.mk&lt;br /&gt;
# make&lt;br /&gt;
# ls unionfs.ko &lt;br /&gt;
unionfs.ko&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Later we will place &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to appropriate place in '''booted''' LiveCD filesystem.&lt;br /&gt;
At the moment copy it to local &amp;lt;tt&amp;gt;to_booted_livecd/unionfs-modules/2.6.18/&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir -p to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
# cp unionfs-1.4/unionfs.ko to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I repeat once again: if you want to use several kernels on LiveCD - the operation above should&lt;br /&gt;
be repeated for each wishful kernel.&lt;br /&gt;
&lt;br /&gt;
=== OpenVZ tools and templates. CentOS updates ===&lt;br /&gt;
We have now the kernel RPM-package. But we also need OpenVZ tools RPM-packages.&lt;br /&gt;
It is much easier with them: just download these packages from http://openvz.org:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/tools&lt;br /&gt;
# cd to_booted_livecd/tools/&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-lib-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzquota/3.0.9/vzquota-3.0.9-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-python-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzyum/current/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../template-metadatas&lt;br /&gt;
# cd ../template-metadatas&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/centos-4/vztmpl-centos-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-3/vztmpl-fedora-core-3-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-4/vztmpl-fedora-core-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-5/vztmpl-fedora-core-5-2.0-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../precreated&lt;br /&gt;
# cd ../precreated&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/centos-4-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/debian-3.1-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you understand, you can add other precreated templates to LiveCD. The main thing here is that usual CD is &lt;br /&gt;
not rubber and precreated templates are rather big! ;)&lt;br /&gt;
&lt;br /&gt;
Centos 4.4 LiveCD has a serios problem: &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package is broken and consequently&lt;br /&gt;
&amp;lt;tt&amp;gt;yum&amp;lt;/tt&amp;gt; doesn't work. In order to fix this problem we need updated &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/updates&lt;br /&gt;
# cd to_booted_livecd/updates&lt;br /&gt;
# wget http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install all these finally ===&lt;br /&gt;
We have all components that will be on '''booted''' LiveCD ready. Let's install them&lt;br /&gt;
in &amp;lt;tt&amp;gt;chrooted&amp;lt;/tt&amp;gt; environment. But before uninstall &amp;lt;tt&amp;gt;lsctp-tools&amp;lt;/tt&amp;gt; package,&lt;br /&gt;
because these tools need kernel version prior to 2.6.10. Then update &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&lt;br /&gt;
package. Also we need to remove some other packages in order to free some disk space:&lt;br /&gt;
I've removed &amp;lt;tt&amp;gt;openoffice.org&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;dia&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gnome-games&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;tetex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;latex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;k3b&amp;lt;/tt&amp;gt; and printing related packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r to_booted_livecd/ livecd-root/tmp/&lt;br /&gt;
# chroot livecd-root/&lt;br /&gt;
&lt;br /&gt;
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386&lt;br /&gt;
&lt;br /&gt;
# rpm -e openoffice.org-libs openoffice.org&lt;br /&gt;
# rpm -e gimp-data-extras xsane-gimp gimp-print-plugin gimp-print-utils&lt;br /&gt;
# rpm -e gimp gimp-print gimp-help gimp-gap&lt;br /&gt;
# rpm -e dia&lt;br /&gt;
# rpm -e planner&lt;br /&gt;
# rpm -e gnome-games&lt;br /&gt;
# rpm -e tetex-latex jadetex xmltex passivetex tetex tetex-afm \&lt;br /&gt;
tetex-dvips tetex-fonts tetex-xdvi&lt;br /&gt;
# rpm -e k3b&lt;br /&gt;
# rpm -e foomatic Omni Omni-foomatic system-config-printer \&lt;br /&gt;
system-config-printer-gui hal-cups-utils desktop-printing&lt;br /&gt;
&lt;br /&gt;
# cd /tmp/to_booted_livecd/&lt;br /&gt;
&lt;br /&gt;
# rpm -Uvh updates/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# rpm -ivh kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
# rpm -ivh tools/*.rpm&lt;br /&gt;
# rpm -ivh template-metadatas/*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy precreated templates to appropriate place:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp  precreated/* /vz/template/cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to other kernel modules and run &amp;lt;tt&amp;gt;depmod&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs&lt;br /&gt;
# cp unionfs-modules/2.6.18/unionfs.ko /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs/&lt;br /&gt;
# depmod 2.6.18-ovz028stab035.1-smp&lt;br /&gt;
# exit&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
While being in chrooted environment bash history was written to &amp;lt;tt&amp;gt;~/.bash_history&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
Clean it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm livecd-root/root/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment&lt;br /&gt;
chekpointing isn't supported on &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem ([http://bugzilla.openvz.org/show_bug.cgi?id=606  Bug #606]).&lt;br /&gt;
But we want of course checkpoiting to work on LiveCD. If we mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;/vz/private/&amp;lt;/tt&amp;gt; on '''booted''' LiveCD,&lt;br /&gt;
then all newly created VEs reside on &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; and checkpointing works. Moreover we do not introduce any additional memory usage,&lt;br /&gt;
because even without &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; all VEs reside in RAM (they contain new/updated files for &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; directory, later, while modifying initrd image we will add the line that will mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
on this directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir livecd-root/vz/private/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At the moment vzquota doesn't support &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; ([http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #558]).&lt;br /&gt;
We're working on this problem, but for now '''switching the disk quota off''' in &amp;lt;tt&amp;gt;/etc/vz/vz.conf&amp;lt;/tt&amp;gt;: &amp;lt;tt&amp;gt;DISK_QUOTA=no&amp;lt;/tt&amp;gt;.&lt;br /&gt;
But when disk quota is off &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt; fails! ;) This is the [http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #512].&lt;br /&gt;
So, don't forget to apply the patch attached to this bug report to &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Booted''' LiveCD filesystem is ready, congratulations!&lt;br /&gt;
&lt;br /&gt;
=== Compressing '''booted''' LiveCD filesystem ===&lt;br /&gt;
Since &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool is already installed we can simply use it to create&lt;br /&gt;
&amp;lt;tt&amp;gt;*.mo&amp;lt;/tt&amp;gt; files: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm -f ovz-livecd/base/*.mo&lt;br /&gt;
# for f in bin etc lib root sbin usr var vz; do \&lt;br /&gt;
    mksquashfs livecd-root/$f ovz-livecd/base/$f.mo -keep-as-directory; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vmlinux, initrd and isolinux.cfg ===&lt;br /&gt;
The next step is to force &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; (cdrom boot loader) to boot OpenVZ kernel.&lt;br /&gt;
First, copy kernel image to OpenVZ CD. It is important to give '''short name''' (not greater&lt;br /&gt;
than 8 characters) to kernel image, otherwise &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; will not see it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there&lt;br /&gt;
and apply small patches to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file. Initrd image that goes with Centos 4.4 is&lt;br /&gt;
of size 40Mb. OpenVZ LiveCD will contain several kernels, so initrd should have several sets of&lt;br /&gt;
kernel modules (for each kernel) and 40Mb isn't enough in this case. I created an initrd of size 100Mb.&lt;br /&gt;
Don't forget to update &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;isolinux.cfg&amp;lt;/tt&amp;gt; file later!&lt;br /&gt;
&lt;br /&gt;
Creating &amp;quot;big&amp;quot; initrd with original content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir initrd.d&lt;br /&gt;
# cp ovz-livecd/boot/initrd.gz initrd.d/initrd-old.gz&lt;br /&gt;
# cd initrd.d/&lt;br /&gt;
# mkdir mount-old&lt;br /&gt;
# gunzip initrd-old.gz &lt;br /&gt;
# mount -o loop initrd-old mount-old/&lt;br /&gt;
# dd if=/dev/zero of=initrd bs=1048576 count=100&lt;br /&gt;
# mke2fs initrd&lt;br /&gt;
initrd is not a block special device.&lt;br /&gt;
Proceed anyway? (y,n) y&lt;br /&gt;
...&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop initrd mount/&lt;br /&gt;
# cp -a mount-old/* mount/&lt;br /&gt;
# umount mount-old/&lt;br /&gt;
# rm -rf mount-old initrd-old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy modules to initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r ../root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/&lt;br /&gt;
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build                 # we don't neet it on initrd image&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I also delete some not necessary kernel modules from initrd to free space.&lt;br /&gt;
They are stil on CD, so init sctipts will be able to load them later.&lt;br /&gt;
&lt;br /&gt;
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules.&lt;br /&gt;
It works well for CentOS kernel, because cdrom support is built-in there.&lt;br /&gt;
But OpenVZ kernel supports cdrom (usual ide cdrom) via kernel module.&lt;br /&gt;
Consequetnly we need to apply the following patch to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig   2006-08-19 08:53:11.000000000 +0400&lt;br /&gt;
+++ liblinuxlive        2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
@@ -337,6 +337,9 @@ modprobe_essential_modules()&lt;br /&gt;
 {&lt;br /&gt;
    echolog &amp;quot;starting loop device support&amp;quot;&lt;br /&gt;
    modprobe_module loop max_loop=32&lt;br /&gt;
+   echolog &amp;quot;starting cdrom support&amp;quot;&lt;br /&gt;
+   modprobe_module cdrom&lt;br /&gt;
+   modprobe_module ide-cd&lt;br /&gt;
    echolog &amp;quot;starting cdrom filesystem support&amp;quot;&lt;br /&gt;
    modprobe_module isofs&lt;br /&gt;
    echolog &amp;quot;starting squashfs support&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As mentioned earlier we want to mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on /vz/private automatically. Just apply this patch to&lt;br /&gt;
&amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig-fstab     2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
+++ mount/liblinuxlive  2007-07-03 12:33:30.000000000 +0400&lt;br /&gt;
@@ -414,6 +414,7 @@ activate_fstab()&lt;br /&gt;
    echo &amp;quot;tmpfs            /                tmpfs       defaults         0   0&amp;quot; &amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;devpts           /dev/pts         devpts      gid=5,mode=620   0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;proc             /proc            proc        defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
+   echo &amp;quot;tmpfs            /vz/private      tmpfs       defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
&lt;br /&gt;
    # now done by fstab-sync&lt;br /&gt;
    # list_cdrom_devices | while read DEVICE; do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finishing actions with initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sync&lt;br /&gt;
# umount mount/&lt;br /&gt;
# gzip initrd&lt;br /&gt;
# /bin/cp initrd.gz ../ovz-livecd/boot/initrd.gz&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we should modify &amp;lt;tt&amp;gt;ovz-livecd/isolinux.cfg&amp;lt;/tt&amp;gt; file, that controls &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; boot loader.&lt;br /&gt;
We inform boot loader, that new kernel was added by introducing the following changes (in diff format):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- ovz-livecd/isolinux.cfg.orig   2006-08-19 08:53:09.000000000 +0400&lt;br /&gt;
+++ ovz-livecd/isolinux.cfg     2007-07-02 19:10:51.000000000 +0400&lt;br /&gt;
@@ -1,5 +1,5 @@&lt;br /&gt;
 display boot/splash.cfg&lt;br /&gt;
-default linux&lt;br /&gt;
+default ovz18&lt;br /&gt;
 prompt 1&lt;br /&gt;
 timeout 300&lt;br /&gt;
 F1 boot/help1.txt&lt;br /&gt;
@@ -11,5 +11,9 @@ label linux&lt;br /&gt;
 kernel boot/vmlinuz&lt;br /&gt;
 append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=40000 root=/dev/ram0 rw rhgb quiet&lt;br /&gt;
&lt;br /&gt;
+label ovz18 &lt;br /&gt;
+kernel boot/ovz18&lt;br /&gt;
+append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 root=/dev/ram0 rw rhgb&lt;br /&gt;
+&lt;br /&gt;
 label memtest&lt;br /&gt;
 kernel boot/memtest&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also '''don't forget''' to change &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; to 102400 for all kernels including Centos 4.4 default! &lt;br /&gt;
&lt;br /&gt;
And I suggest to remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; parameter, to see what happens: it will help greatly if some problem will happen.&lt;br /&gt;
&lt;br /&gt;
=== Embellishment ===&lt;br /&gt;
If you want to release LiveCD to other people some &amp;quot;embelishments&amp;quot; should be added.&lt;br /&gt;
&lt;br /&gt;
First, edit &amp;lt;tt&amp;gt;splash.cfg&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help1.txt&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help2.txt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;help3.txt&amp;lt;/tt&amp;gt;&lt;br /&gt;
files (that are in &amp;lt;tt&amp;gt;~/workbench/ovz-livecd/boot/help&amp;lt;/tt&amp;gt; directory) to contain appropriate information.&lt;br /&gt;
These messages appear on the LiveCD initial boot: they help to choose kernel and kernel options.&lt;br /&gt;
&lt;br /&gt;
Also, you can note, that CentOS logo appears at this moment. This logo resides in &amp;lt;tt&amp;gt;ovz-livecd/boot/splash.lss&amp;lt;/tt&amp;gt;&lt;br /&gt;
file. I added OpenVZ logo there. The following tools will help you: &amp;lt;tt&amp;gt;lss16toppm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ppmtolss16&amp;lt;/tt&amp;gt; and&lt;br /&gt;
of course &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt; :)&lt;br /&gt;
&lt;br /&gt;
One more thing we change is default desktop background. It resides in &amp;lt;tt&amp;gt;usr/share/backgrounds/images/default.png&amp;lt;/tt&amp;gt;.&lt;br /&gt;
I added OpenVZ logo there.&lt;br /&gt;
&lt;br /&gt;
=== Creating ISO ===&lt;br /&gt;
Centos 4.4 LiveCD creators were very gentle and have placed &amp;lt;tt&amp;gt;make_iso.sh&amp;lt;/tt&amp;gt; script on CD.&lt;br /&gt;
Using this script, it is very easy to create iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ovz-livecd&lt;br /&gt;
# ./make_iso.sh ../CentOS-4.4-i386-OpenVZ-LiveCD.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debugging LiveCD ==&lt;br /&gt;
If you have trouble with created OpenVZ LiveCD, boot the kernel with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vga=0 debug&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command line options. It will help you to diagnose the problem more precisely.&lt;br /&gt;
Also it can be useful to redirect kernel output to serial console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more at [[remote console setup]].&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://centos.org Official CentOS community website]&lt;br /&gt;
* [http://kernel.org Linux kernel website]&lt;br /&gt;
* [http://redhat.com RedHat Inc. website]&lt;br /&gt;
* [http://squashfs.sourceforge.net/ squashfs website]&lt;br /&gt;
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Live CD]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6123</id>
		<title>Creating OpenVZ LiveCD based on Centos 4.4</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6123"/>
		<updated>2008-07-07T06:38:58Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* Install all these finally */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is a step by step guide explaining how to add OpenVZ functionality to Centos 4.4 LiveCD.&lt;br /&gt;
As a result, you will have a LiveCD, that can boot in various OpenVZ kernels (rhel4-2.6.9, 2.6.18,&lt;br /&gt;
rhel5-2.6.18, 2.6.20) and in original CentOS kernel also. After booting from the CD, you will be able &lt;br /&gt;
to create [[VE]]s, start them, enter them - i.e. perform [[Getting started with OpenVZ live CD | common OpenVZ activity]].&lt;br /&gt;
&lt;br /&gt;
CentOS 5 LiveCD is already announced and as soon as it will be available we'll update the article.&lt;br /&gt;
&lt;br /&gt;
== General actions ==&lt;br /&gt;
It is quite easy to add OpenVZ functionality to existent LiveCD. The most difficult work is already done&lt;br /&gt;
by the original LiveCD creators. But it requires pretty much hand job. Probably some day some good guy will&lt;br /&gt;
automatize this process. ;)&lt;br /&gt;
&lt;br /&gt;
Actually you need to accomplish the following general actions - everything else is only technical details:&lt;br /&gt;
* Get a copy of CentOS 4.4 LiveCD image &lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool to extract the contents of *.mo files, located on the image&lt;br /&gt;
* Construct '''booted''' LiveCD root filesystem from extracted files&lt;br /&gt;
* Create OpenVZ kernel RPM-packages  with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support&lt;br /&gt;
* Compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel modules against OpenVZ kernels&lt;br /&gt;
* Get OpenVZ tools RPM-packages: vzctl, vzquota, vzpkg, etc. Get template metadatas and precreated templates&lt;br /&gt;
* Remove some RPM-packages from '''booted''' LiveCD root filesystem (conflicting with OpenVZ kernel packages and redundant packages - to free some disk space)&lt;br /&gt;
* Install OpenVZ kernels, tools and templates in '''booted''' LiveCD root filesystem&lt;br /&gt;
* Using &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool compress '''booted''' CD root filesystem&lt;br /&gt;
* Modify initrd image: add there kernel modules for OpenVZ kernels&lt;br /&gt;
* Introduce small modifications to isolinux configuration file&lt;br /&gt;
* Create new iso image&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
This part contains detailed description of LiveCD creation. I've removed the output of some&lt;br /&gt;
commands in order to simplify the reading.&lt;br /&gt;
&lt;br /&gt;
=== Creating booted LiveCD root filesystem ===&lt;br /&gt;
Create a directory, that will be our &amp;quot;workbench&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~&lt;br /&gt;
# mkdir workbench&lt;br /&gt;
# cd workbench&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all we need some raw material - CentOS 4.4 LiveCD image:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/CentOS-4.4-i386-LiveCD.iso&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/md5sum.livecd&lt;br /&gt;
# md5sum --check md5sum.livecd &lt;br /&gt;
CentOS-4.4-i386-LiveCD.iso: OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the contents of CD to the directory, where we will form the OpenVZ LiveCD filesystem.&lt;br /&gt;
I named this directory &amp;quot;ovz-livecd&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir ovz-livecd&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop -t iso9660 CentOS-4.4-i386-LiveCD.iso mount/&lt;br /&gt;
# cp -a mount/* ovz-livecd/&lt;br /&gt;
# umount mount&lt;br /&gt;
# rm -rf mount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see, that &amp;lt;tt&amp;gt;ovz-livecd/base/&amp;lt;/tt&amp;gt; directory owns several *.mo files - images of squashfs filesystem,&lt;br /&gt;
and each image holds one directory of '''booted''' LiveCD root filesystem: &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;usr&amp;lt;/tt&amp;gt; and so on:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -1 ovz-livecd/base&lt;br /&gt;
bin.mo etc.mo lib.mo root.mo sbin.mo usr.mo var.mo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decompress these images we need &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool. &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; source archive contains&lt;br /&gt;
patches for various kernel versions (to be able to mount &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;) and user-space tools for compressing usual filesytem into &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; filesystem and for decompressing it back. Well, we don't need kernel patches right now (but we will need them later), we only want to install &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; user-space tools.&lt;br /&gt;
Here is '''an important''' note. We want, our LiveCD to be able to boot original Centos 4.4 kernel. This original kernel doesn't support&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; of version &amp;lt;tt&amp;gt;3&amp;lt;/tt&amp;gt;. Consequently we use &amp;lt;tt&amp;gt;sqashfs2.2-r2&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;mksquasfs&amp;lt;/tt&amp;gt; tool, but for &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool and later for compiling fresh OpenVZ kernels with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support we use &amp;lt;tt&amp;gt;sqashfs3.2-r2&amp;lt;/tt&amp;gt; sources/patches, because they are back compatible with &amp;lt;tt&amp;gt;sqashfs v2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs2.2-r2.tar.gz&lt;br /&gt;
# cd squashfs2.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -o mksquashfs&lt;br /&gt;
# cp mksquashfs /usr/bin/&lt;br /&gt;
&lt;br /&gt;
# cd -&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs3.2-r2.tar.gz&lt;br /&gt;
# cd squashfs3.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -o mksquashfs&lt;br /&gt;
cc unsquashfs.o -lz -o unsquashfs&lt;br /&gt;
# cp unsquashfs /usr/bin/&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Well, having the intruments in hand, why not extract the images? Create a directory, called &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt;,&lt;br /&gt;
that will store the root filesystem of '''booted''' LiveCD. I.e. it will contain &amp;lt;tt&amp;gt;/bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sbin&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; and other directories, which you will see after booting the LiveCD. Unfortunately &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
tool is not very convenient, and I found only this way to use it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir livecd-root&lt;br /&gt;
&lt;br /&gt;
# for f in bin etc lib root sbin usr var; do \&lt;br /&gt;
    unsquashfs ovz-livecd/base/$f.mo; \&lt;br /&gt;
    mv squashfs-root/$f/ livecd-root; \&lt;br /&gt;
    rm -rf squashfs-root; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be patient, this will take a few minutes.&lt;br /&gt;
&lt;br /&gt;
Yet we have nearly complete root filesystem of '''booted''' LiveCD in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory. However some things&lt;br /&gt;
are missing, and I guess you know what are they: &amp;lt;tt&amp;gt;/dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; directories. We need them, because some tools (&amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, ...) will not work without them in chrooted environment later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd livecd-root&lt;br /&gt;
# mkdir dev&lt;br /&gt;
# cp -a /dev/* dev/&lt;br /&gt;
# mkdir proc&lt;br /&gt;
# mount -t proc proc proc/&lt;br /&gt;
# mkdir sys&lt;br /&gt;
# mount -t sysfs sysfs sys/&lt;br /&gt;
# mkdir tmp&lt;br /&gt;
# mkdir boot&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it. We have '''bootstrapped''' LiveCD root filesystem in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
Now we can &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; in this directory and install all needed packages. But what&lt;br /&gt;
packages do we need?&lt;br /&gt;
* OpenVZ kernels&lt;br /&gt;
* OpenVZ tools: vzctl, vzquota, vzpkg, vzrpm43, vzrpm44, vzyum&lt;br /&gt;
* OpenVZ template metadatas: centos-4, fc-3, fc4 and fc-5&lt;br /&gt;
* Some OpenVZ precreated templates&lt;br /&gt;
* Some CentOS tool updates: sqlite package&lt;br /&gt;
Tools and templates related packages can be simply downloaded and installed.&lt;br /&gt;
But it is not so easy with kernel. Usual OpenVZ kernel won't work: it doesn't&lt;br /&gt;
support &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;. The next chapter explains how to create RPM-package with&lt;br /&gt;
OpenVZ kernel, that supports &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building OpenVZ kernels ===&lt;br /&gt;
Let's consider, how to build &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt; OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support.&lt;br /&gt;
First  download and install OpenVZ source RPM:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://download.openvz.org/kernel/branches/2.6.18/028stab035.1/kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
# rpm -ivh kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; sources contain the patch against &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt;. Let's copy this patch to RPM build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp squashfs3.2-r2/kernel-patches/linux-2.6.18/squashfs3.2-patch /usr/src/redhat/SOURCES/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we need to modify the spec-file (&amp;lt;tt&amp;gt;/usr/src/redhat/SPECS/kernel-ovz.spec&amp;lt;/tt&amp;gt;) in order to add &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch to build process. Below are the changes you should introduce in diff format.&lt;br /&gt;
The meaning of changes is transparent: firstly, do not build UP, enterprise and debug kernels (our LiveCD will be&lt;br /&gt;
based on SMP kernel) and secondly, apply &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch before compilation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- kernel-ovz.spec.orig        2007-06-09 11:40:15.000000000 +0400&lt;br /&gt;
+++ kernel-ovz.spec     2007-06-28 17:42:41.000000000 +0400&lt;br /&gt;
@@ -5,13 +5,13 @@ Summary: The Linux kernel (the core of t&lt;br /&gt;
&lt;br /&gt;
 # normal/debug/debuginfo&lt;br /&gt;
 %define buildnormal 1&lt;br /&gt;
-%define builddebug 1&lt;br /&gt;
+%define builddebug 0&lt;br /&gt;
 %define builddebuginfo 0&lt;br /&gt;
&lt;br /&gt;
 # kernels we want to build&lt;br /&gt;
-%define buildup 1&lt;br /&gt;
+%define buildup 0&lt;br /&gt;
 %define buildsmp 1&lt;br /&gt;
-%define buildenterprise 1&lt;br /&gt;
+%define buildenterprise 0&lt;br /&gt;
 %define buildentnosplit 0&lt;br /&gt;
&lt;br /&gt;
 # versions&lt;br /&gt;
@@ -161,6 +161,9 @@ Patch2104: linux-2.6.18-drbd-0.7.22-0.8.&lt;br /&gt;
 Patch2105: linux-2.6.18-drbd-8.0.0-8.0.2.patch&lt;br /&gt;
 Patch2106: linux-2.6.18-drbd-8.0.2-8.0.3.patch&lt;br /&gt;
&lt;br /&gt;
+# squashfs3.2-patch&lt;br /&gt;
+Patch2107: squashfs3.2-patch&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root&lt;br /&gt;
@@ -318,6 +321,8 @@ cd linux-%{kversion}&lt;br /&gt;
 %patch2105 -p1&lt;br /&gt;
 %patch2106 -p1&lt;br /&gt;
&lt;br /&gt;
+%patch2107 -p1&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 mkdir configs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We need one more tiny hack in order RPM-build process to walk smoothly.&lt;br /&gt;
There are config files for various OpenVZ kernel flavours &lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls /usr/src/redhat/SOURCES/*.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686.config.ovz             /usr/src/redhat/SOURCES/kernel-2.6.18-ppc64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-enterprise.config.ovz  /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-smp.config.ovz         /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64-smp.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-ia64.config.ovz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''All''' these files should contain information about &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
In fact, only two additional lines are necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I did it with the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SOURCES/&lt;br /&gt;
# echo &amp;quot;CONFIG_SQUASHFS=m&lt;br /&gt;
&amp;gt; CONFIG_SQUASHFS_EMBEDDED=n&amp;quot; | tee -a *.config.ovz&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After all efforts, building the RPM-package is very easy:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SPECS/&lt;br /&gt;
# rpmbuild --target=i686 -ba kernel-ovz.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything goes smoothly, in several tens of minutes depending on the power of your node you willl have OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support. Let's copy it to our local directory &amp;lt;tt&amp;gt;to_booted_livecd/kernels/&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
# ls /usr/src/redhat/RPMS/i686/&lt;br /&gt;
kernel-smp-2.6.18-ovz028stab035.1.i686.rpm&lt;br /&gt;
# mkdir -p to_booted_livecd/kernels&lt;br /&gt;
# cp /usr/src/redhat/RPMS/i686/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm to_booted_livecd/kernels/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OpenVZ LiveCD supports several kernels. So, the actions mentioned above should be accomplished to all kernels,&lt;br /&gt;
that you need on LiveCD. In this article I skip the description of building RPMS for all kernels. All description&lt;br /&gt;
below are based on &amp;lt;tt&amp;gt;028stab035&amp;lt;/tt&amp;gt; kernel, that has been just build above. But some important differences in building&lt;br /&gt;
kernel of version other then 2.6.18 one is summarized below.&lt;br /&gt;
==== Peculiarities of building 2.6.9-rhel4 ====&lt;br /&gt;
* You should also include this patch (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da)&lt;br /&gt;
in building process. Hopefully will be fixed in &amp;lt;tt&amp;gt;2.6.9-044stab044.8&amp;lt;/tt&amp;gt; kernel.&lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unionfs 1.0.14&amp;lt;/tt&amp;gt;, but not &amp;lt;tt&amp;gt;unionfs 1.1.5&amp;lt;/tt&amp;gt;, as offered at its official site!&lt;br /&gt;
* Small problems while building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;: arguments of &amp;lt;tt&amp;gt;vfs_permissions()&amp;lt;/tt&amp;gt;. Just add &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt;&lt;br /&gt;
to appropriate places.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.18-rhel5 ====&lt;br /&gt;
* Note, &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch is already there, but you should use &amp;lt;tt&amp;gt;3.2&amp;lt;/tt&amp;gt;! :)&lt;br /&gt;
* While building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; some small fixes: &amp;lt;tt&amp;gt;i_blksize&amp;lt;/tt&amp;gt; field is missing in &amp;lt;tt&amp;gt;inode&amp;lt;/tt&amp;gt; structure, &amp;lt;tt&amp;gt;ino_t&amp;lt;/tt&amp;gt; should be changed to &amp;lt;tt&amp;gt;u64&amp;lt;/tt&amp;gt; in some functions.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.20 ====&lt;br /&gt;
* Only &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; is available for 2.6.20 kernel and it is distributed as a patch. Consequently modify &amp;lt;tt&amp;gt;spec&amp;lt;/tt&amp;gt;-file and configs while building the kernel&lt;br /&gt;
* &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; doesn't support unionctl. Consequently you have to modify &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file on &amp;lt;tt&amp;gt;initrd&amp;lt;/tt&amp;gt; image to mount all branches at once, but don't add them by ioctls.&lt;br /&gt;
&lt;br /&gt;
=== Unionfs kernel module ===&lt;br /&gt;
In most present-day LiveCDs &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem is used. This filesystem &amp;quot;can appear to merge the contents of several directories, while keeping their physical content separate&amp;quot;. For example, after the command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mount -t unionfs -o dirs=/tmp/changes=rw:/cdrom=ro unionfs /union&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
you will see merged contents of &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt; directories in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory. &lt;br /&gt;
At that, &amp;lt;tt&amp;gt;cdrom&amp;lt;/tt&amp;gt; will be read-only. I.e. if you will write to some file in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory, &lt;br /&gt;
that resides in &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; in fact, this modified file will be automatically moved to &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Such useful property is logically used in LiveCDs: &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; merges cdrom contents (that is read-only)&lt;br /&gt;
and temporary in-memory filesystem.&lt;br /&gt;
In order to add support of &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem to OpenVZ kernel we need to compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel&lt;br /&gt;
module against used kernel. Download the sources of unionfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget ftp://ftp.filesystems.org/pub/unionfs/unionfs-1.x/unionfs-1.4.tar.gz&lt;br /&gt;
# tar xzf unionfs-1.4.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In previous chapter we have created an RPM-package with OpenVZ kernel. We should install it: because&lt;br /&gt;
this packages contents kernel headers, required for building kernel modules.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ivh to_booted_livecd/kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
Preparing...                ########################################### [100%]&lt;br /&gt;
   1:kernel-smp             ########################################### [100%]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd unionfs-1.4&lt;br /&gt;
# echo 'LINUXSRC=/lib/modules/2.6.18-ovz028stab035.1-smp/build/&lt;br /&gt;
&amp;gt; TOPINC=-I$(LINUXSRC)/include&lt;br /&gt;
&amp;gt; MODDIR=/lib/modules/2.6.18-ovz028stab035.1-smp/' &amp;gt; fistdev.mk&lt;br /&gt;
# make&lt;br /&gt;
# ls unionfs.ko &lt;br /&gt;
unionfs.ko&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Later we will place &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to appropriate place in '''booted''' LiveCD filesystem.&lt;br /&gt;
At the moment copy it to local &amp;lt;tt&amp;gt;to_booted_livecd/unionfs-modules/2.6.18/&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir -p to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
# cp unionfs-1.4/unionfs.ko to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I repeat once again: if you want to use several kernels on LiveCD - the operation above should&lt;br /&gt;
be repeated for each wishful kernel.&lt;br /&gt;
&lt;br /&gt;
=== OpenVZ tools and templates. CentOS updates ===&lt;br /&gt;
We have now the kernel RPM-package. But we also need OpenVZ tools RPM-packages.&lt;br /&gt;
It is much easier with them: just download these packages from http://openvz.org:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/tools&lt;br /&gt;
# cd to_booted_livecd/tools/&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-lib-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzquota/3.0.9/vzquota-3.0.9-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-python-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzyum/current/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../template-metadatas&lt;br /&gt;
# cd ../template-metadatas&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/centos-4/vztmpl-centos-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-3/vztmpl-fedora-core-3-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-4/vztmpl-fedora-core-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-5/vztmpl-fedora-core-5-2.0-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../precreated&lt;br /&gt;
# cd ../precreated&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/centos-4-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/debian-3.1-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you understand, you can add other precreated templates to LiveCD. The main thing here is that usual CD is &lt;br /&gt;
not rubber and precreated templates are rather big! ;)&lt;br /&gt;
&lt;br /&gt;
Centos 4.4 LiveCD has a serios problem: &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package is broken and consequently&lt;br /&gt;
&amp;lt;tt&amp;gt;yum&amp;lt;/tt&amp;gt; doesn't work. In order to fix this problem we need updated &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/updates&lt;br /&gt;
# cd to_booted_livecd/updates&lt;br /&gt;
# wget http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install all these finally ===&lt;br /&gt;
We have all components that will be on '''booted''' LiveCD ready. Let's install them&lt;br /&gt;
in &amp;lt;tt&amp;gt;chrooted&amp;lt;/tt&amp;gt; environment. But before uninstall &amp;lt;tt&amp;gt;lsctp-tools&amp;lt;/tt&amp;gt; package,&lt;br /&gt;
because these tools need kernel version prior to 2.6.10. Then update &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&lt;br /&gt;
package. Also we need to remove some other packages in order to free some disk space:&lt;br /&gt;
I've removed &amp;lt;tt&amp;gt;openoffice.org&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;dia&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gnome-games&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;tetex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;latex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;k3b&amp;lt;/tt&amp;gt; and printing related packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r to_booted_livecd/ livecd-root/tmp/&lt;br /&gt;
# chroot livecd-root/&lt;br /&gt;
&lt;br /&gt;
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386&lt;br /&gt;
&lt;br /&gt;
# rpm -e openoffice.org-libs openoffice.org&lt;br /&gt;
# rpm -e gimp-data-extras xsane-gimp gimp-print-plugin gimp-print-utils&lt;br /&gt;
# rpm -e gimp gimp-print gimp-help gimp-gap&lt;br /&gt;
# rpm -e dia&lt;br /&gt;
# rpm -e planner&lt;br /&gt;
# rpm -e gnome-games&lt;br /&gt;
# rpm -e tetex-latex jadetex xmltex passivetex tetex tetex-afm \&lt;br /&gt;
tetex-dvips tetex-fonts tetex-xdvi&lt;br /&gt;
# rpm -e k3b&lt;br /&gt;
# rpm -e foomatic Omni Omni-foomatic system-config-printer \&lt;br /&gt;
system-config-printer-gui hal-cups-utils desktop-printing&lt;br /&gt;
&lt;br /&gt;
# cd /tmp/to_booted_livecd/&lt;br /&gt;
&lt;br /&gt;
# rpm -Uvh updates/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# rpm -ivh kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
# rpm -ivh tools/*.rpm&lt;br /&gt;
# rpm -ivh template-metadatas/*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy precreated templates to appropriate place:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp  precreated/* /vz/template/cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to other kernel modules and run &amp;lt;tt&amp;gt;depmod&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs&lt;br /&gt;
# cp unionfs-modules/2.6.18/unionfs.ko /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs/&lt;br /&gt;
# depmod 2.6.18-ovz028stab035.1-smp&lt;br /&gt;
# exit&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
While being in chrooted environment bash history was written to &amp;lt;tt&amp;gt;~/.bash_history&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
Clean it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm livecd-root/root/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment&lt;br /&gt;
chekpointing isn't supported on &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem ([http://bugzilla.openvz.org/show_bug.cgi?id=606  Bug #606]).&lt;br /&gt;
But we want of course checkpoiting to work on LiveCD. If we mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;/vz/private/&amp;lt;/tt&amp;gt; on '''booted''' LiveCD,&lt;br /&gt;
then all newly created VEs reside on &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; and checkpointing works. Moreover we do not introduce any additional memory usage,&lt;br /&gt;
because even without &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; all VEs reside in RAM (they contain new/updated files for &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; directory, later, while modifying initrd image we will add the line that will mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
on this directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir livecd-root/vz/private/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At the moment vzquota doesn't support &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; ([http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #558]).&lt;br /&gt;
We're working on this problem, but for now '''switching the disk quota off''' in &amp;lt;tt&amp;gt;/etc/vz/vz.conf&amp;lt;/tt&amp;gt;: &amp;lt;tt&amp;gt;DISK_QUOTA=no&amp;lt;/tt&amp;gt;.&lt;br /&gt;
But when disk quota is off &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt; fails! ;) This is the [http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #512].&lt;br /&gt;
So, don't forget to apply the patch attached to this bug report to &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Booted''' LiveCD filesystem is ready, congratulations!&lt;br /&gt;
&lt;br /&gt;
=== Compressing '''booted''' LiveCD filesystem ===&lt;br /&gt;
Since &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool is already installed we can simply use it to create&lt;br /&gt;
&amp;lt;tt&amp;gt;*.mo&amp;lt;/tt&amp;gt; files: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm -f ovz-livecd/base/*.mo&lt;br /&gt;
# for f in bin etc lib root sbin usr var vz; do \&lt;br /&gt;
    mksquashfs root/$f ovz-livecd/base/$f.mo -keep-as-directory; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vmlinux, initrd and isolinux.cfg ===&lt;br /&gt;
The next step is to force &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; (cdrom boot loader) to boot OpenVZ kernel.&lt;br /&gt;
First, copy kernel image to OpenVZ CD. It is important to give '''short name''' (not greater&lt;br /&gt;
than 8 characters) to kernel image, otherwise &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; will not see it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there&lt;br /&gt;
and apply small patches to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file. Initrd image that goes with Centos 4.4 is&lt;br /&gt;
of size 40Mb. OpenVZ LiveCD will contain several kernels, so initrd should have several sets of&lt;br /&gt;
kernel modules (for each kernel) and 40Mb isn't enough in this case. I created an initrd of size 100Mb.&lt;br /&gt;
Don't forget to update &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;isolinux.cfg&amp;lt;/tt&amp;gt; file later!&lt;br /&gt;
&lt;br /&gt;
Creating &amp;quot;big&amp;quot; initrd with original content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir initrd.d&lt;br /&gt;
# cp ovz-livecd/boot/initrd.gz initrd.d/initrd-old.gz&lt;br /&gt;
# cd initrd.d/&lt;br /&gt;
# mkdir mount-old&lt;br /&gt;
# gunzip initrd-old.gz &lt;br /&gt;
# mount -o loop initrd-old mount-old/&lt;br /&gt;
# dd if=/dev/zero of=initrd bs=1048576 count=100&lt;br /&gt;
# mke2fs initrd&lt;br /&gt;
initrd is not a block special device.&lt;br /&gt;
Proceed anyway? (y,n) y&lt;br /&gt;
...&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop initrd mount/&lt;br /&gt;
# cp -a mount-old/* mount/&lt;br /&gt;
# umount mount-old/&lt;br /&gt;
# rm -rf mount-old initrd-old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy modules to initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r ../root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/&lt;br /&gt;
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build                 # we don't neet it on initrd image&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I also delete some not necessary kernel modules from initrd to free space.&lt;br /&gt;
They are stil on CD, so init sctipts will be able to load them later.&lt;br /&gt;
&lt;br /&gt;
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules.&lt;br /&gt;
It works well for CentOS kernel, because cdrom support is built-in there.&lt;br /&gt;
But OpenVZ kernel supports cdrom (usual ide cdrom) via kernel module.&lt;br /&gt;
Consequetnly we need to apply the following patch to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig   2006-08-19 08:53:11.000000000 +0400&lt;br /&gt;
+++ liblinuxlive        2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
@@ -337,6 +337,9 @@ modprobe_essential_modules()&lt;br /&gt;
 {&lt;br /&gt;
    echolog &amp;quot;starting loop device support&amp;quot;&lt;br /&gt;
    modprobe_module loop max_loop=32&lt;br /&gt;
+   echolog &amp;quot;starting cdrom support&amp;quot;&lt;br /&gt;
+   modprobe_module cdrom&lt;br /&gt;
+   modprobe_module ide-cd&lt;br /&gt;
    echolog &amp;quot;starting cdrom filesystem support&amp;quot;&lt;br /&gt;
    modprobe_module isofs&lt;br /&gt;
    echolog &amp;quot;starting squashfs support&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As mentioned earlier we want to mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on /vz/private automatically. Just apply this patch to&lt;br /&gt;
&amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig-fstab     2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
+++ mount/liblinuxlive  2007-07-03 12:33:30.000000000 +0400&lt;br /&gt;
@@ -414,6 +414,7 @@ activate_fstab()&lt;br /&gt;
    echo &amp;quot;tmpfs            /                tmpfs       defaults         0   0&amp;quot; &amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;devpts           /dev/pts         devpts      gid=5,mode=620   0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;proc             /proc            proc        defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
+   echo &amp;quot;tmpfs            /vz/private      tmpfs       defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
&lt;br /&gt;
    # now done by fstab-sync&lt;br /&gt;
    # list_cdrom_devices | while read DEVICE; do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finishing actions with initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sync&lt;br /&gt;
# umount mount/&lt;br /&gt;
# gzip initrd&lt;br /&gt;
# /bin/cp initrd.gz ../ovz-livecd/boot/initrd.gz&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we should modify &amp;lt;tt&amp;gt;ovz-livecd/isolinux.cfg&amp;lt;/tt&amp;gt; file, that controls &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; boot loader.&lt;br /&gt;
We inform boot loader, that new kernel was added by introducing the following changes (in diff format):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- ovz-livecd/isolinux.cfg.orig   2006-08-19 08:53:09.000000000 +0400&lt;br /&gt;
+++ ovz-livecd/isolinux.cfg     2007-07-02 19:10:51.000000000 +0400&lt;br /&gt;
@@ -1,5 +1,5 @@&lt;br /&gt;
 display boot/splash.cfg&lt;br /&gt;
-default linux&lt;br /&gt;
+default ovz18&lt;br /&gt;
 prompt 1&lt;br /&gt;
 timeout 300&lt;br /&gt;
 F1 boot/help1.txt&lt;br /&gt;
@@ -11,5 +11,9 @@ label linux&lt;br /&gt;
 kernel boot/vmlinuz&lt;br /&gt;
 append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=40000 root=/dev/ram0 rw rhgb quiet&lt;br /&gt;
&lt;br /&gt;
+label ovz18 &lt;br /&gt;
+kernel boot/ovz18&lt;br /&gt;
+append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 root=/dev/ram0 rw rhgb&lt;br /&gt;
+&lt;br /&gt;
 label memtest&lt;br /&gt;
 kernel boot/memtest&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also '''don't forget''' to change &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; to 102400 for all kernels including Centos 4.4 default! &lt;br /&gt;
&lt;br /&gt;
And I suggest to remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; parameter, to see what happens: it will help greatly if some problem will happen.&lt;br /&gt;
&lt;br /&gt;
=== Embellishment ===&lt;br /&gt;
If you want to release LiveCD to other people some &amp;quot;embelishments&amp;quot; should be added.&lt;br /&gt;
&lt;br /&gt;
First, edit &amp;lt;tt&amp;gt;splash.cfg&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help1.txt&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help2.txt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;help3.txt&amp;lt;/tt&amp;gt;&lt;br /&gt;
files (that are in &amp;lt;tt&amp;gt;~/workbench/ovz-livecd/boot/help&amp;lt;/tt&amp;gt; directory) to contain appropriate information.&lt;br /&gt;
These messages appear on the LiveCD initial boot: they help to choose kernel and kernel options.&lt;br /&gt;
&lt;br /&gt;
Also, you can note, that CentOS logo appears at this moment. This logo resides in &amp;lt;tt&amp;gt;ovz-livecd/boot/splash.lss&amp;lt;/tt&amp;gt;&lt;br /&gt;
file. I added OpenVZ logo there. The following tools will help you: &amp;lt;tt&amp;gt;lss16toppm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ppmtolss16&amp;lt;/tt&amp;gt; and&lt;br /&gt;
of course &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt; :)&lt;br /&gt;
&lt;br /&gt;
One more thing we change is default desktop background. It resides in &amp;lt;tt&amp;gt;usr/share/backgrounds/images/default.png&amp;lt;/tt&amp;gt;.&lt;br /&gt;
I added OpenVZ logo there.&lt;br /&gt;
&lt;br /&gt;
=== Creating ISO ===&lt;br /&gt;
Centos 4.4 LiveCD creators were very gentle and have placed &amp;lt;tt&amp;gt;make_iso.sh&amp;lt;/tt&amp;gt; script on CD.&lt;br /&gt;
Using this script, it is very easy to create iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ovz-livecd&lt;br /&gt;
# ./make_iso.sh ../CentOS-4.4-i386-OpenVZ-LiveCD.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debugging LiveCD ==&lt;br /&gt;
If you have trouble with created OpenVZ LiveCD, boot the kernel with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vga=0 debug&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command line options. It will help you to diagnose the problem more precisely.&lt;br /&gt;
Also it can be useful to redirect kernel output to serial console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more at [[remote console setup]].&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://centos.org Official CentOS community website]&lt;br /&gt;
* [http://kernel.org Linux kernel website]&lt;br /&gt;
* [http://redhat.com RedHat Inc. website]&lt;br /&gt;
* [http://squashfs.sourceforge.net/ squashfs website]&lt;br /&gt;
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Live CD]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6122</id>
		<title>Creating OpenVZ LiveCD based on Centos 4.4</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6122"/>
		<updated>2008-07-06T16:07:22Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* Creating booted LiveCD root filesystem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is a step by step guide explaining how to add OpenVZ functionality to Centos 4.4 LiveCD.&lt;br /&gt;
As a result, you will have a LiveCD, that can boot in various OpenVZ kernels (rhel4-2.6.9, 2.6.18,&lt;br /&gt;
rhel5-2.6.18, 2.6.20) and in original CentOS kernel also. After booting from the CD, you will be able &lt;br /&gt;
to create [[VE]]s, start them, enter them - i.e. perform [[Getting started with OpenVZ live CD | common OpenVZ activity]].&lt;br /&gt;
&lt;br /&gt;
CentOS 5 LiveCD is already announced and as soon as it will be available we'll update the article.&lt;br /&gt;
&lt;br /&gt;
== General actions ==&lt;br /&gt;
It is quite easy to add OpenVZ functionality to existent LiveCD. The most difficult work is already done&lt;br /&gt;
by the original LiveCD creators. But it requires pretty much hand job. Probably some day some good guy will&lt;br /&gt;
automatize this process. ;)&lt;br /&gt;
&lt;br /&gt;
Actually you need to accomplish the following general actions - everything else is only technical details:&lt;br /&gt;
* Get a copy of CentOS 4.4 LiveCD image &lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool to extract the contents of *.mo files, located on the image&lt;br /&gt;
* Construct '''booted''' LiveCD root filesystem from extracted files&lt;br /&gt;
* Create OpenVZ kernel RPM-packages  with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support&lt;br /&gt;
* Compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel modules against OpenVZ kernels&lt;br /&gt;
* Get OpenVZ tools RPM-packages: vzctl, vzquota, vzpkg, etc. Get template metadatas and precreated templates&lt;br /&gt;
* Remove some RPM-packages from '''booted''' LiveCD root filesystem (conflicting with OpenVZ kernel packages and redundant packages - to free some disk space)&lt;br /&gt;
* Install OpenVZ kernels, tools and templates in '''booted''' LiveCD root filesystem&lt;br /&gt;
* Using &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool compress '''booted''' CD root filesystem&lt;br /&gt;
* Modify initrd image: add there kernel modules for OpenVZ kernels&lt;br /&gt;
* Introduce small modifications to isolinux configuration file&lt;br /&gt;
* Create new iso image&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
This part contains detailed description of LiveCD creation. I've removed the output of some&lt;br /&gt;
commands in order to simplify the reading.&lt;br /&gt;
&lt;br /&gt;
=== Creating booted LiveCD root filesystem ===&lt;br /&gt;
Create a directory, that will be our &amp;quot;workbench&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~&lt;br /&gt;
# mkdir workbench&lt;br /&gt;
# cd workbench&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all we need some raw material - CentOS 4.4 LiveCD image:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/CentOS-4.4-i386-LiveCD.iso&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/md5sum.livecd&lt;br /&gt;
# md5sum --check md5sum.livecd &lt;br /&gt;
CentOS-4.4-i386-LiveCD.iso: OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the contents of CD to the directory, where we will form the OpenVZ LiveCD filesystem.&lt;br /&gt;
I named this directory &amp;quot;ovz-livecd&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir ovz-livecd&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop -t iso9660 CentOS-4.4-i386-LiveCD.iso mount/&lt;br /&gt;
# cp -a mount/* ovz-livecd/&lt;br /&gt;
# umount mount&lt;br /&gt;
# rm -rf mount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see, that &amp;lt;tt&amp;gt;ovz-livecd/base/&amp;lt;/tt&amp;gt; directory owns several *.mo files - images of squashfs filesystem,&lt;br /&gt;
and each image holds one directory of '''booted''' LiveCD root filesystem: &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;usr&amp;lt;/tt&amp;gt; and so on:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -1 ovz-livecd/base&lt;br /&gt;
bin.mo etc.mo lib.mo root.mo sbin.mo usr.mo var.mo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decompress these images we need &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool. &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; source archive contains&lt;br /&gt;
patches for various kernel versions (to be able to mount &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;) and user-space tools for compressing usual filesytem into &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; filesystem and for decompressing it back. Well, we don't need kernel patches right now (but we will need them later), we only want to install &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; user-space tools.&lt;br /&gt;
Here is '''an important''' note. We want, our LiveCD to be able to boot original Centos 4.4 kernel. This original kernel doesn't support&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; of version &amp;lt;tt&amp;gt;3&amp;lt;/tt&amp;gt;. Consequently we use &amp;lt;tt&amp;gt;sqashfs2.2-r2&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;mksquasfs&amp;lt;/tt&amp;gt; tool, but for &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool and later for compiling fresh OpenVZ kernels with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support we use &amp;lt;tt&amp;gt;sqashfs3.2-r2&amp;lt;/tt&amp;gt; sources/patches, because they are back compatible with &amp;lt;tt&amp;gt;sqashfs v2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs2.2-r2.tar.gz&lt;br /&gt;
# cd squashfs2.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -o mksquashfs&lt;br /&gt;
# cp mksquashfs /usr/bin/&lt;br /&gt;
&lt;br /&gt;
# cd -&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs3.2-r2.tar.gz&lt;br /&gt;
# cd squashfs3.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -o mksquashfs&lt;br /&gt;
cc unsquashfs.o -lz -o unsquashfs&lt;br /&gt;
# cp unsquashfs /usr/bin/&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Well, having the intruments in hand, why not extract the images? Create a directory, called &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt;,&lt;br /&gt;
that will store the root filesystem of '''booted''' LiveCD. I.e. it will contain &amp;lt;tt&amp;gt;/bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sbin&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; and other directories, which you will see after booting the LiveCD. Unfortunately &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
tool is not very convenient, and I found only this way to use it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir livecd-root&lt;br /&gt;
&lt;br /&gt;
# for f in bin etc lib root sbin usr var; do \&lt;br /&gt;
    unsquashfs ovz-livecd/base/$f.mo; \&lt;br /&gt;
    mv squashfs-root/$f/ livecd-root; \&lt;br /&gt;
    rm -rf squashfs-root; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be patient, this will take a few minutes.&lt;br /&gt;
&lt;br /&gt;
Yet we have nearly complete root filesystem of '''booted''' LiveCD in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory. However some things&lt;br /&gt;
are missing, and I guess you know what are they: &amp;lt;tt&amp;gt;/dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; directories. We need them, because some tools (&amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, ...) will not work without them in chrooted environment later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd livecd-root&lt;br /&gt;
# mkdir dev&lt;br /&gt;
# cp -a /dev/* dev/&lt;br /&gt;
# mkdir proc&lt;br /&gt;
# mount -t proc proc proc/&lt;br /&gt;
# mkdir sys&lt;br /&gt;
# mount -t sysfs sysfs sys/&lt;br /&gt;
# mkdir tmp&lt;br /&gt;
# mkdir boot&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it. We have '''bootstrapped''' LiveCD root filesystem in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
Now we can &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; in this directory and install all needed packages. But what&lt;br /&gt;
packages do we need?&lt;br /&gt;
* OpenVZ kernels&lt;br /&gt;
* OpenVZ tools: vzctl, vzquota, vzpkg, vzrpm43, vzrpm44, vzyum&lt;br /&gt;
* OpenVZ template metadatas: centos-4, fc-3, fc4 and fc-5&lt;br /&gt;
* Some OpenVZ precreated templates&lt;br /&gt;
* Some CentOS tool updates: sqlite package&lt;br /&gt;
Tools and templates related packages can be simply downloaded and installed.&lt;br /&gt;
But it is not so easy with kernel. Usual OpenVZ kernel won't work: it doesn't&lt;br /&gt;
support &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;. The next chapter explains how to create RPM-package with&lt;br /&gt;
OpenVZ kernel, that supports &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building OpenVZ kernels ===&lt;br /&gt;
Let's consider, how to build &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt; OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support.&lt;br /&gt;
First  download and install OpenVZ source RPM:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://download.openvz.org/kernel/branches/2.6.18/028stab035.1/kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
# rpm -ivh kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; sources contain the patch against &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt;. Let's copy this patch to RPM build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp squashfs3.2-r2/kernel-patches/linux-2.6.18/squashfs3.2-patch /usr/src/redhat/SOURCES/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we need to modify the spec-file (&amp;lt;tt&amp;gt;/usr/src/redhat/SPECS/kernel-ovz.spec&amp;lt;/tt&amp;gt;) in order to add &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch to build process. Below are the changes you should introduce in diff format.&lt;br /&gt;
The meaning of changes is transparent: firstly, do not build UP, enterprise and debug kernels (our LiveCD will be&lt;br /&gt;
based on SMP kernel) and secondly, apply &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch before compilation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- kernel-ovz.spec.orig        2007-06-09 11:40:15.000000000 +0400&lt;br /&gt;
+++ kernel-ovz.spec     2007-06-28 17:42:41.000000000 +0400&lt;br /&gt;
@@ -5,13 +5,13 @@ Summary: The Linux kernel (the core of t&lt;br /&gt;
&lt;br /&gt;
 # normal/debug/debuginfo&lt;br /&gt;
 %define buildnormal 1&lt;br /&gt;
-%define builddebug 1&lt;br /&gt;
+%define builddebug 0&lt;br /&gt;
 %define builddebuginfo 0&lt;br /&gt;
&lt;br /&gt;
 # kernels we want to build&lt;br /&gt;
-%define buildup 1&lt;br /&gt;
+%define buildup 0&lt;br /&gt;
 %define buildsmp 1&lt;br /&gt;
-%define buildenterprise 1&lt;br /&gt;
+%define buildenterprise 0&lt;br /&gt;
 %define buildentnosplit 0&lt;br /&gt;
&lt;br /&gt;
 # versions&lt;br /&gt;
@@ -161,6 +161,9 @@ Patch2104: linux-2.6.18-drbd-0.7.22-0.8.&lt;br /&gt;
 Patch2105: linux-2.6.18-drbd-8.0.0-8.0.2.patch&lt;br /&gt;
 Patch2106: linux-2.6.18-drbd-8.0.2-8.0.3.patch&lt;br /&gt;
&lt;br /&gt;
+# squashfs3.2-patch&lt;br /&gt;
+Patch2107: squashfs3.2-patch&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root&lt;br /&gt;
@@ -318,6 +321,8 @@ cd linux-%{kversion}&lt;br /&gt;
 %patch2105 -p1&lt;br /&gt;
 %patch2106 -p1&lt;br /&gt;
&lt;br /&gt;
+%patch2107 -p1&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 mkdir configs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We need one more tiny hack in order RPM-build process to walk smoothly.&lt;br /&gt;
There are config files for various OpenVZ kernel flavours &lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls /usr/src/redhat/SOURCES/*.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686.config.ovz             /usr/src/redhat/SOURCES/kernel-2.6.18-ppc64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-enterprise.config.ovz  /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-smp.config.ovz         /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64-smp.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-ia64.config.ovz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''All''' these files should contain information about &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
In fact, only two additional lines are necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I did it with the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SOURCES/&lt;br /&gt;
# echo &amp;quot;CONFIG_SQUASHFS=m&lt;br /&gt;
&amp;gt; CONFIG_SQUASHFS_EMBEDDED=n&amp;quot; | tee -a *.config.ovz&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After all efforts, building the RPM-package is very easy:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SPECS/&lt;br /&gt;
# rpmbuild --target=i686 -ba kernel-ovz.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything goes smoothly, in several tens of minutes depending on the power of your node you willl have OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support. Let's copy it to our local directory &amp;lt;tt&amp;gt;to_booted_livecd/kernels/&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
# ls /usr/src/redhat/RPMS/i686/&lt;br /&gt;
kernel-smp-2.6.18-ovz028stab035.1.i686.rpm&lt;br /&gt;
# mkdir -p to_booted_livecd/kernels&lt;br /&gt;
# cp /usr/src/redhat/RPMS/i686/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm to_booted_livecd/kernels/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OpenVZ LiveCD supports several kernels. So, the actions mentioned above should be accomplished to all kernels,&lt;br /&gt;
that you need on LiveCD. In this article I skip the description of building RPMS for all kernels. All description&lt;br /&gt;
below are based on &amp;lt;tt&amp;gt;028stab035&amp;lt;/tt&amp;gt; kernel, that has been just build above. But some important differences in building&lt;br /&gt;
kernel of version other then 2.6.18 one is summarized below.&lt;br /&gt;
==== Peculiarities of building 2.6.9-rhel4 ====&lt;br /&gt;
* You should also include this patch (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da)&lt;br /&gt;
in building process. Hopefully will be fixed in &amp;lt;tt&amp;gt;2.6.9-044stab044.8&amp;lt;/tt&amp;gt; kernel.&lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unionfs 1.0.14&amp;lt;/tt&amp;gt;, but not &amp;lt;tt&amp;gt;unionfs 1.1.5&amp;lt;/tt&amp;gt;, as offered at its official site!&lt;br /&gt;
* Small problems while building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;: arguments of &amp;lt;tt&amp;gt;vfs_permissions()&amp;lt;/tt&amp;gt;. Just add &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt;&lt;br /&gt;
to appropriate places.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.18-rhel5 ====&lt;br /&gt;
* Note, &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch is already there, but you should use &amp;lt;tt&amp;gt;3.2&amp;lt;/tt&amp;gt;! :)&lt;br /&gt;
* While building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; some small fixes: &amp;lt;tt&amp;gt;i_blksize&amp;lt;/tt&amp;gt; field is missing in &amp;lt;tt&amp;gt;inode&amp;lt;/tt&amp;gt; structure, &amp;lt;tt&amp;gt;ino_t&amp;lt;/tt&amp;gt; should be changed to &amp;lt;tt&amp;gt;u64&amp;lt;/tt&amp;gt; in some functions.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.20 ====&lt;br /&gt;
* Only &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; is available for 2.6.20 kernel and it is distributed as a patch. Consequently modify &amp;lt;tt&amp;gt;spec&amp;lt;/tt&amp;gt;-file and configs while building the kernel&lt;br /&gt;
* &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; doesn't support unionctl. Consequently you have to modify &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file on &amp;lt;tt&amp;gt;initrd&amp;lt;/tt&amp;gt; image to mount all branches at once, but don't add them by ioctls.&lt;br /&gt;
&lt;br /&gt;
=== Unionfs kernel module ===&lt;br /&gt;
In most present-day LiveCDs &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem is used. This filesystem &amp;quot;can appear to merge the contents of several directories, while keeping their physical content separate&amp;quot;. For example, after the command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mount -t unionfs -o dirs=/tmp/changes=rw:/cdrom=ro unionfs /union&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
you will see merged contents of &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt; directories in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory. &lt;br /&gt;
At that, &amp;lt;tt&amp;gt;cdrom&amp;lt;/tt&amp;gt; will be read-only. I.e. if you will write to some file in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory, &lt;br /&gt;
that resides in &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; in fact, this modified file will be automatically moved to &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Such useful property is logically used in LiveCDs: &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; merges cdrom contents (that is read-only)&lt;br /&gt;
and temporary in-memory filesystem.&lt;br /&gt;
In order to add support of &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem to OpenVZ kernel we need to compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel&lt;br /&gt;
module against used kernel. Download the sources of unionfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget ftp://ftp.filesystems.org/pub/unionfs/unionfs-1.x/unionfs-1.4.tar.gz&lt;br /&gt;
# tar xzf unionfs-1.4.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In previous chapter we have created an RPM-package with OpenVZ kernel. We should install it: because&lt;br /&gt;
this packages contents kernel headers, required for building kernel modules.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ivh to_booted_livecd/kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
Preparing...                ########################################### [100%]&lt;br /&gt;
   1:kernel-smp             ########################################### [100%]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd unionfs-1.4&lt;br /&gt;
# echo 'LINUXSRC=/lib/modules/2.6.18-ovz028stab035.1-smp/build/&lt;br /&gt;
&amp;gt; TOPINC=-I$(LINUXSRC)/include&lt;br /&gt;
&amp;gt; MODDIR=/lib/modules/2.6.18-ovz028stab035.1-smp/' &amp;gt; fistdev.mk&lt;br /&gt;
# make&lt;br /&gt;
# ls unionfs.ko &lt;br /&gt;
unionfs.ko&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Later we will place &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to appropriate place in '''booted''' LiveCD filesystem.&lt;br /&gt;
At the moment copy it to local &amp;lt;tt&amp;gt;to_booted_livecd/unionfs-modules/2.6.18/&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir -p to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
# cp unionfs-1.4/unionfs.ko to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I repeat once again: if you want to use several kernels on LiveCD - the operation above should&lt;br /&gt;
be repeated for each wishful kernel.&lt;br /&gt;
&lt;br /&gt;
=== OpenVZ tools and templates. CentOS updates ===&lt;br /&gt;
We have now the kernel RPM-package. But we also need OpenVZ tools RPM-packages.&lt;br /&gt;
It is much easier with them: just download these packages from http://openvz.org:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/tools&lt;br /&gt;
# cd to_booted_livecd/tools/&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-lib-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzquota/3.0.9/vzquota-3.0.9-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-python-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzyum/current/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../template-metadatas&lt;br /&gt;
# cd ../template-metadatas&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/centos-4/vztmpl-centos-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-3/vztmpl-fedora-core-3-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-4/vztmpl-fedora-core-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-5/vztmpl-fedora-core-5-2.0-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../precreated&lt;br /&gt;
# cd ../precreated&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/centos-4-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/debian-3.1-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you understand, you can add other precreated templates to LiveCD. The main thing here is that usual CD is &lt;br /&gt;
not rubber and precreated templates are rather big! ;)&lt;br /&gt;
&lt;br /&gt;
Centos 4.4 LiveCD has a serios problem: &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package is broken and consequently&lt;br /&gt;
&amp;lt;tt&amp;gt;yum&amp;lt;/tt&amp;gt; doesn't work. In order to fix this problem we need updated &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/updates&lt;br /&gt;
# cd to_booted_livecd/updates&lt;br /&gt;
# wget http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install all these finally ===&lt;br /&gt;
We have all components that will be on '''booted''' LiveCD ready. Let's install them&lt;br /&gt;
in &amp;lt;tt&amp;gt;chrooted&amp;lt;/tt&amp;gt; environment. But before uninstall &amp;lt;tt&amp;gt;lsctp-tools&amp;lt;/tt&amp;gt; package,&lt;br /&gt;
because these tools need kernel version prior to 2.6.10. Then update &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&lt;br /&gt;
package. Also we need to remove some other packages in order to free some disk space:&lt;br /&gt;
I've removed &amp;lt;tt&amp;gt;openoffice.org&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;dia&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gnome-games&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;tetex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;latex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;k3b&amp;lt;/tt&amp;gt; and printing related packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r to_booted_livecd/ root/tmp/&lt;br /&gt;
# chroot root/&lt;br /&gt;
&lt;br /&gt;
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386&lt;br /&gt;
&lt;br /&gt;
# rpm -e openoffice.org-libs openoffice.org&lt;br /&gt;
# rpm -e gimp-data-extras xsane-gimp gimp-print-plugin gimp-print-utils&lt;br /&gt;
# rpm -e gimp gimp-print gimp-help gimp-gap&lt;br /&gt;
# rpm -e dia&lt;br /&gt;
# rpm -e planner&lt;br /&gt;
# rpm -e gnome-games&lt;br /&gt;
# rpm -e tetex-latex jadetex xmltex passivetex tetex tetex-afm \&lt;br /&gt;
tetex-dvips tetex-fonts tetex-xdvi&lt;br /&gt;
# rpm -e k3b&lt;br /&gt;
# rpm -e foomatic Omni Omni-foomatic system-config-printer \&lt;br /&gt;
system-config-printer-gui hal-cups-utils desktop-printing&lt;br /&gt;
&lt;br /&gt;
# cd /tmp/to_booted_livecd/&lt;br /&gt;
&lt;br /&gt;
# rpm -Uvh updates/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# rpm -ivh kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
# rpm -ivh tools/*.rpm&lt;br /&gt;
# rpm -ivh template-metadatas/*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy precreated templates to appropriate place:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp  precreated/* /vz/template/cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to other kernel modules and run &amp;lt;tt&amp;gt;depmod&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs&lt;br /&gt;
# cp unionfs-modules/2.6.18/unionfs.ko /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs/&lt;br /&gt;
# depmod 2.6.18-ovz028stab035.1-smp&lt;br /&gt;
# exit&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
While being in chrooted environment bash history was written to &amp;lt;tt&amp;gt;~/.bash_history&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
Clean it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm root/root/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment&lt;br /&gt;
chekpointing isn't supported on &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem ([http://bugzilla.openvz.org/show_bug.cgi?id=606  Bug #606]).&lt;br /&gt;
But we want of course checkpoiting to work on LiveCD. If we mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;/vz/private/&amp;lt;/tt&amp;gt; on '''booted''' LiveCD,&lt;br /&gt;
then all newly created VEs reside on &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; and checkpointing works. Moreover we do not introduce any additional memory usage,&lt;br /&gt;
because even without &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; all VEs reside in RAM (they contain new/updated files for &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; directory, later, while modifying initrd image we will add the line that will mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
on this directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir root/vz/private/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At the moment vzquota doesn't support &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; ([http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #558]).&lt;br /&gt;
We're working on this problem, but for now '''switching the disk quota off''' in &amp;lt;tt&amp;gt;/etc/vz/vz.conf&amp;lt;/tt&amp;gt;: &amp;lt;tt&amp;gt;DISK_QUOTA=no&amp;lt;/tt&amp;gt;.&lt;br /&gt;
But when disk quota is off &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt; fails! ;) This is the [http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #512].&lt;br /&gt;
So, don't forget to apply the patch attached to this bug report to &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Booted''' LiveCD filesystem is ready, congratulations!&lt;br /&gt;
&lt;br /&gt;
=== Compressing '''booted''' LiveCD filesystem ===&lt;br /&gt;
Since &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool is already installed we can simply use it to create&lt;br /&gt;
&amp;lt;tt&amp;gt;*.mo&amp;lt;/tt&amp;gt; files: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm -f ovz-livecd/base/*.mo&lt;br /&gt;
# for f in bin etc lib root sbin usr var vz; do \&lt;br /&gt;
    mksquashfs root/$f ovz-livecd/base/$f.mo -keep-as-directory; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vmlinux, initrd and isolinux.cfg ===&lt;br /&gt;
The next step is to force &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; (cdrom boot loader) to boot OpenVZ kernel.&lt;br /&gt;
First, copy kernel image to OpenVZ CD. It is important to give '''short name''' (not greater&lt;br /&gt;
than 8 characters) to kernel image, otherwise &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; will not see it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there&lt;br /&gt;
and apply small patches to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file. Initrd image that goes with Centos 4.4 is&lt;br /&gt;
of size 40Mb. OpenVZ LiveCD will contain several kernels, so initrd should have several sets of&lt;br /&gt;
kernel modules (for each kernel) and 40Mb isn't enough in this case. I created an initrd of size 100Mb.&lt;br /&gt;
Don't forget to update &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;isolinux.cfg&amp;lt;/tt&amp;gt; file later!&lt;br /&gt;
&lt;br /&gt;
Creating &amp;quot;big&amp;quot; initrd with original content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir initrd.d&lt;br /&gt;
# cp ovz-livecd/boot/initrd.gz initrd.d/initrd-old.gz&lt;br /&gt;
# cd initrd.d/&lt;br /&gt;
# mkdir mount-old&lt;br /&gt;
# gunzip initrd-old.gz &lt;br /&gt;
# mount -o loop initrd-old mount-old/&lt;br /&gt;
# dd if=/dev/zero of=initrd bs=1048576 count=100&lt;br /&gt;
# mke2fs initrd&lt;br /&gt;
initrd is not a block special device.&lt;br /&gt;
Proceed anyway? (y,n) y&lt;br /&gt;
...&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop initrd mount/&lt;br /&gt;
# cp -a mount-old/* mount/&lt;br /&gt;
# umount mount-old/&lt;br /&gt;
# rm -rf mount-old initrd-old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy modules to initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r ../root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/&lt;br /&gt;
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build                 # we don't neet it on initrd image&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I also delete some not necessary kernel modules from initrd to free space.&lt;br /&gt;
They are stil on CD, so init sctipts will be able to load them later.&lt;br /&gt;
&lt;br /&gt;
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules.&lt;br /&gt;
It works well for CentOS kernel, because cdrom support is built-in there.&lt;br /&gt;
But OpenVZ kernel supports cdrom (usual ide cdrom) via kernel module.&lt;br /&gt;
Consequetnly we need to apply the following patch to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig   2006-08-19 08:53:11.000000000 +0400&lt;br /&gt;
+++ liblinuxlive        2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
@@ -337,6 +337,9 @@ modprobe_essential_modules()&lt;br /&gt;
 {&lt;br /&gt;
    echolog &amp;quot;starting loop device support&amp;quot;&lt;br /&gt;
    modprobe_module loop max_loop=32&lt;br /&gt;
+   echolog &amp;quot;starting cdrom support&amp;quot;&lt;br /&gt;
+   modprobe_module cdrom&lt;br /&gt;
+   modprobe_module ide-cd&lt;br /&gt;
    echolog &amp;quot;starting cdrom filesystem support&amp;quot;&lt;br /&gt;
    modprobe_module isofs&lt;br /&gt;
    echolog &amp;quot;starting squashfs support&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As mentioned earlier we want to mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on /vz/private automatically. Just apply this patch to&lt;br /&gt;
&amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig-fstab     2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
+++ mount/liblinuxlive  2007-07-03 12:33:30.000000000 +0400&lt;br /&gt;
@@ -414,6 +414,7 @@ activate_fstab()&lt;br /&gt;
    echo &amp;quot;tmpfs            /                tmpfs       defaults         0   0&amp;quot; &amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;devpts           /dev/pts         devpts      gid=5,mode=620   0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;proc             /proc            proc        defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
+   echo &amp;quot;tmpfs            /vz/private      tmpfs       defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
&lt;br /&gt;
    # now done by fstab-sync&lt;br /&gt;
    # list_cdrom_devices | while read DEVICE; do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finishing actions with initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sync&lt;br /&gt;
# umount mount/&lt;br /&gt;
# gzip initrd&lt;br /&gt;
# /bin/cp initrd.gz ../ovz-livecd/boot/initrd.gz&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we should modify &amp;lt;tt&amp;gt;ovz-livecd/isolinux.cfg&amp;lt;/tt&amp;gt; file, that controls &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; boot loader.&lt;br /&gt;
We inform boot loader, that new kernel was added by introducing the following changes (in diff format):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- ovz-livecd/isolinux.cfg.orig   2006-08-19 08:53:09.000000000 +0400&lt;br /&gt;
+++ ovz-livecd/isolinux.cfg     2007-07-02 19:10:51.000000000 +0400&lt;br /&gt;
@@ -1,5 +1,5 @@&lt;br /&gt;
 display boot/splash.cfg&lt;br /&gt;
-default linux&lt;br /&gt;
+default ovz18&lt;br /&gt;
 prompt 1&lt;br /&gt;
 timeout 300&lt;br /&gt;
 F1 boot/help1.txt&lt;br /&gt;
@@ -11,5 +11,9 @@ label linux&lt;br /&gt;
 kernel boot/vmlinuz&lt;br /&gt;
 append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=40000 root=/dev/ram0 rw rhgb quiet&lt;br /&gt;
&lt;br /&gt;
+label ovz18 &lt;br /&gt;
+kernel boot/ovz18&lt;br /&gt;
+append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 root=/dev/ram0 rw rhgb&lt;br /&gt;
+&lt;br /&gt;
 label memtest&lt;br /&gt;
 kernel boot/memtest&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also '''don't forget''' to change &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; to 102400 for all kernels including Centos 4.4 default! &lt;br /&gt;
&lt;br /&gt;
And I suggest to remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; parameter, to see what happens: it will help greatly if some problem will happen.&lt;br /&gt;
&lt;br /&gt;
=== Embellishment ===&lt;br /&gt;
If you want to release LiveCD to other people some &amp;quot;embelishments&amp;quot; should be added.&lt;br /&gt;
&lt;br /&gt;
First, edit &amp;lt;tt&amp;gt;splash.cfg&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help1.txt&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help2.txt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;help3.txt&amp;lt;/tt&amp;gt;&lt;br /&gt;
files (that are in &amp;lt;tt&amp;gt;~/workbench/ovz-livecd/boot/help&amp;lt;/tt&amp;gt; directory) to contain appropriate information.&lt;br /&gt;
These messages appear on the LiveCD initial boot: they help to choose kernel and kernel options.&lt;br /&gt;
&lt;br /&gt;
Also, you can note, that CentOS logo appears at this moment. This logo resides in &amp;lt;tt&amp;gt;ovz-livecd/boot/splash.lss&amp;lt;/tt&amp;gt;&lt;br /&gt;
file. I added OpenVZ logo there. The following tools will help you: &amp;lt;tt&amp;gt;lss16toppm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ppmtolss16&amp;lt;/tt&amp;gt; and&lt;br /&gt;
of course &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt; :)&lt;br /&gt;
&lt;br /&gt;
One more thing we change is default desktop background. It resides in &amp;lt;tt&amp;gt;usr/share/backgrounds/images/default.png&amp;lt;/tt&amp;gt;.&lt;br /&gt;
I added OpenVZ logo there.&lt;br /&gt;
&lt;br /&gt;
=== Creating ISO ===&lt;br /&gt;
Centos 4.4 LiveCD creators were very gentle and have placed &amp;lt;tt&amp;gt;make_iso.sh&amp;lt;/tt&amp;gt; script on CD.&lt;br /&gt;
Using this script, it is very easy to create iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ovz-livecd&lt;br /&gt;
# ./make_iso.sh ../CentOS-4.4-i386-OpenVZ-LiveCD.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debugging LiveCD ==&lt;br /&gt;
If you have trouble with created OpenVZ LiveCD, boot the kernel with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vga=0 debug&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command line options. It will help you to diagnose the problem more precisely.&lt;br /&gt;
Also it can be useful to redirect kernel output to serial console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more at [[remote console setup]].&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://centos.org Official CentOS community website]&lt;br /&gt;
* [http://kernel.org Linux kernel website]&lt;br /&gt;
* [http://redhat.com RedHat Inc. website]&lt;br /&gt;
* [http://squashfs.sourceforge.net/ squashfs website]&lt;br /&gt;
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Live CD]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6121</id>
		<title>Creating OpenVZ LiveCD based on Centos 4.4</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_OpenVZ_LiveCD_based_on_Centos_4.4&amp;diff=6121"/>
		<updated>2008-07-06T15:54:35Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* Creating booted LiveCD root filesystem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article is a step by step guide explaining how to add OpenVZ functionality to Centos 4.4 LiveCD.&lt;br /&gt;
As a result, you will have a LiveCD, that can boot in various OpenVZ kernels (rhel4-2.6.9, 2.6.18,&lt;br /&gt;
rhel5-2.6.18, 2.6.20) and in original CentOS kernel also. After booting from the CD, you will be able &lt;br /&gt;
to create [[VE]]s, start them, enter them - i.e. perform [[Getting started with OpenVZ live CD | common OpenVZ activity]].&lt;br /&gt;
&lt;br /&gt;
CentOS 5 LiveCD is already announced and as soon as it will be available we'll update the article.&lt;br /&gt;
&lt;br /&gt;
== General actions ==&lt;br /&gt;
It is quite easy to add OpenVZ functionality to existent LiveCD. The most difficult work is already done&lt;br /&gt;
by the original LiveCD creators. But it requires pretty much hand job. Probably some day some good guy will&lt;br /&gt;
automatize this process. ;)&lt;br /&gt;
&lt;br /&gt;
Actually you need to accomplish the following general actions - everything else is only technical details:&lt;br /&gt;
* Get a copy of CentOS 4.4 LiveCD image &lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool to extract the contents of *.mo files, located on the image&lt;br /&gt;
* Construct '''booted''' LiveCD root filesystem from extracted files&lt;br /&gt;
* Create OpenVZ kernel RPM-packages  with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support&lt;br /&gt;
* Compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel modules against OpenVZ kernels&lt;br /&gt;
* Get OpenVZ tools RPM-packages: vzctl, vzquota, vzpkg, etc. Get template metadatas and precreated templates&lt;br /&gt;
* Remove some RPM-packages from '''booted''' LiveCD root filesystem (conflicting with OpenVZ kernel packages and redundant packages - to free some disk space)&lt;br /&gt;
* Install OpenVZ kernels, tools and templates in '''booted''' LiveCD root filesystem&lt;br /&gt;
* Using &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool compress '''booted''' CD root filesystem&lt;br /&gt;
* Modify initrd image: add there kernel modules for OpenVZ kernels&lt;br /&gt;
* Introduce small modifications to isolinux configuration file&lt;br /&gt;
* Create new iso image&lt;br /&gt;
&lt;br /&gt;
== Technical details ==&lt;br /&gt;
This part contains detailed description of LiveCD creation. I've removed the output of some&lt;br /&gt;
commands in order to simplify the reading.&lt;br /&gt;
&lt;br /&gt;
=== Creating booted LiveCD root filesystem ===&lt;br /&gt;
Create a directory, that will be our &amp;quot;workbench&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~&lt;br /&gt;
# mkdir workbench&lt;br /&gt;
# cd workbench&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First of all we need some raw material - CentOS 4.4 LiveCD image:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/CentOS-4.4-i386-LiveCD.iso&lt;br /&gt;
# wget http://mirror.nsc.liu.se/CentOS/4.4/isos/i386/md5sum.livecd&lt;br /&gt;
# md5sum --check md5sum.livecd &lt;br /&gt;
CentOS-4.4-i386-LiveCD.iso: OK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the contents of CD to the directory, where we will form the OpenVZ LiveCD filesystem.&lt;br /&gt;
I named this directory &amp;quot;ovz-livecd&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir ovz-livecd&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop -t iso9660 CentOS-4.4-i386-LiveCD.iso mount/&lt;br /&gt;
# cp -a mount/* ovz-livecd/&lt;br /&gt;
# umount mount&lt;br /&gt;
# rm -rf mount&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see, that &amp;lt;tt&amp;gt;ovz-livecd/base/&amp;lt;/tt&amp;gt; directory owns several *.mo files - images of squashfs filesystem,&lt;br /&gt;
and each image holds one directory of '''booted''' LiveCD root filesystem: &amp;lt;tt&amp;gt;bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;usr&amp;lt;/tt&amp;gt; and so on:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -1 ovz-livecd/base&lt;br /&gt;
bin.mo etc.mo lib.mo root.mo sbin.mo usr.mo var.mo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decompress these images we need &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool. &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; source archive contains&lt;br /&gt;
patches for various kernel versions (to be able to mount &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;) and user-space tools for compressing usual filesytem into &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; filesystem and for decompressing it back. Well, we don't need kernel patches right now (but we will need them later), we only want to install &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; user-space tools.&lt;br /&gt;
Here is '''an important''' note. We want, our LiveCD to be able to boot original Centos 4.4 kernel. This original kernel doesn't support&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; of version &amp;lt;tt&amp;gt;3&amp;lt;/tt&amp;gt;. Consequently we use &amp;lt;tt&amp;gt;sqashfs2.2-r2&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;mksquasfs&amp;lt;/tt&amp;gt; tool, but for &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt; tool and later for compiling fresh OpenVZ kernels with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support we use &amp;lt;tt&amp;gt;sqashfs3.2-r2&amp;lt;/tt&amp;gt; sources/patches, because they are back compatible with &amp;lt;tt&amp;gt;sqashfs v2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs2.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs2.2-r2.tar.gz&lt;br /&gt;
# cd squashfs2.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -o mksquashfs&lt;br /&gt;
# cp mksquashfs /usr/bin/&lt;br /&gt;
&lt;br /&gt;
# cd -&lt;br /&gt;
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz&lt;br /&gt;
# tar xzf squashfs3.2-r2.tar.gz&lt;br /&gt;
# cd squashfs3.2-r2/squashfs-tools/&lt;br /&gt;
# make&lt;br /&gt;
cc mksquashfs.o read_fs.o sort.o -lz -lpthread -lm -o mksquashfs&lt;br /&gt;
cc unsquashfs.o -lz -o unsquashfs&lt;br /&gt;
# cp unsquashfs /usr/bin/&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Well, having the intruments in hand, why not extract the images? Create a directory, called &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt;,&lt;br /&gt;
that will store the root filesystem of '''booted''' LiveCD. I.e. it will contain &amp;lt;tt&amp;gt;/bin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sbin&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc&amp;lt;/tt&amp;gt; and other directories, which you will see after booting the LiveCD. Unfortunately &amp;lt;tt&amp;gt;unsquashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
tool is not very convenient, and I found only this way to use it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir livecd-root&lt;br /&gt;
&lt;br /&gt;
# for f in bin etc lib root sbin usr var; do \&lt;br /&gt;
    unsquashfs ovz-livecd/base/$f.mo; \&lt;br /&gt;
    mv squashfs-root/$f/ livecd-root; \&lt;br /&gt;
    rm -rf squashfs-root; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Be patient, this will take a few minutes.&lt;br /&gt;
&lt;br /&gt;
Yet we have nearly complete root filesystem of '''booted''' LiveCD in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory. However some things&lt;br /&gt;
are missing, and I guess you know what are they: &amp;lt;tt&amp;gt;/dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/proc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/sys&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; directories. We need them, because some tools (&amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;bash&amp;lt;/tt&amp;gt;, ...) will not work without them in chrooted environment later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd livecd-root&lt;br /&gt;
# mkdir dev&lt;br /&gt;
# cp -a /dev/* root/dev&lt;br /&gt;
# mkdir proc&lt;br /&gt;
# mount -t proc proc proc/&lt;br /&gt;
# mkdir sys&lt;br /&gt;
# mount -t sysfs sysfs sys/&lt;br /&gt;
# mkdir tmp&lt;br /&gt;
# mkdir boot&lt;br /&gt;
# cd -&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's it. We have '''bootstrapped''' LiveCD root filesystem in &amp;lt;tt&amp;gt;livecd-root&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
Now we can &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; in this directory and install all needed packages. But what&lt;br /&gt;
packages do we need?&lt;br /&gt;
* OpenVZ kernels&lt;br /&gt;
* OpenVZ tools: vzctl, vzquota, vzpkg, vzrpm43, vzrpm44, vzyum&lt;br /&gt;
* OpenVZ template metadatas: centos-4, fc-3, fc4 and fc-5&lt;br /&gt;
* Some OpenVZ precreated templates&lt;br /&gt;
* Some CentOS tool updates: sqlite package&lt;br /&gt;
Tools and templates related packages can be simply downloaded and installed.&lt;br /&gt;
But it is not so easy with kernel. Usual OpenVZ kernel won't work: it doesn't&lt;br /&gt;
support &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;. The next chapter explains how to create RPM-package with&lt;br /&gt;
OpenVZ kernel, that supports &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Building OpenVZ kernels ===&lt;br /&gt;
Let's consider, how to build &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt; OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support.&lt;br /&gt;
First  download and install OpenVZ source RPM:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget http://download.openvz.org/kernel/branches/2.6.18/028stab035.1/kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
# rpm -ivh kernel-2.6.18-ovz028stab035.1.src.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; sources contain the patch against &amp;lt;tt&amp;gt;2.6.18&amp;lt;/tt&amp;gt;. Let's copy this patch to RPM build directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp squashfs3.2-r2/kernel-patches/linux-2.6.18/squashfs3.2-patch /usr/src/redhat/SOURCES/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we need to modify the spec-file (&amp;lt;tt&amp;gt;/usr/src/redhat/SPECS/kernel-ovz.spec&amp;lt;/tt&amp;gt;) in order to add &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch to build process. Below are the changes you should introduce in diff format.&lt;br /&gt;
The meaning of changes is transparent: firstly, do not build UP, enterprise and debug kernels (our LiveCD will be&lt;br /&gt;
based on SMP kernel) and secondly, apply &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch before compilation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- kernel-ovz.spec.orig        2007-06-09 11:40:15.000000000 +0400&lt;br /&gt;
+++ kernel-ovz.spec     2007-06-28 17:42:41.000000000 +0400&lt;br /&gt;
@@ -5,13 +5,13 @@ Summary: The Linux kernel (the core of t&lt;br /&gt;
&lt;br /&gt;
 # normal/debug/debuginfo&lt;br /&gt;
 %define buildnormal 1&lt;br /&gt;
-%define builddebug 1&lt;br /&gt;
+%define builddebug 0&lt;br /&gt;
 %define builddebuginfo 0&lt;br /&gt;
&lt;br /&gt;
 # kernels we want to build&lt;br /&gt;
-%define buildup 1&lt;br /&gt;
+%define buildup 0&lt;br /&gt;
 %define buildsmp 1&lt;br /&gt;
-%define buildenterprise 1&lt;br /&gt;
+%define buildenterprise 0&lt;br /&gt;
 %define buildentnosplit 0&lt;br /&gt;
&lt;br /&gt;
 # versions&lt;br /&gt;
@@ -161,6 +161,9 @@ Patch2104: linux-2.6.18-drbd-0.7.22-0.8.&lt;br /&gt;
 Patch2105: linux-2.6.18-drbd-8.0.0-8.0.2.patch&lt;br /&gt;
 Patch2106: linux-2.6.18-drbd-8.0.2-8.0.3.patch&lt;br /&gt;
&lt;br /&gt;
+# squashfs3.2-patch&lt;br /&gt;
+Patch2107: squashfs3.2-patch&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root&lt;br /&gt;
@@ -318,6 +321,8 @@ cd linux-%{kversion}&lt;br /&gt;
 %patch2105 -p1&lt;br /&gt;
 %patch2106 -p1&lt;br /&gt;
&lt;br /&gt;
+%patch2107 -p1&lt;br /&gt;
+&lt;br /&gt;
 # ----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
 mkdir configs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We need one more tiny hack in order RPM-build process to walk smoothly.&lt;br /&gt;
There are config files for various OpenVZ kernel flavours &lt;br /&gt;
in &amp;lt;tt&amp;gt;/usr/src/redhat/SOURCES&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls /usr/src/redhat/SOURCES/*.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686.config.ovz             /usr/src/redhat/SOURCES/kernel-2.6.18-ppc64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-enterprise.config.ovz  /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-i686-smp.config.ovz         /usr/src/redhat/SOURCES/kernel-2.6.18-x86_64-smp.config.ovz&lt;br /&gt;
/usr/src/redhat/SOURCES/kernel-2.6.18-ia64.config.ovz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''All''' these files should contain information about &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt;.&lt;br /&gt;
In fact, only two additional lines are necessary:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I did it with the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SOURCES/&lt;br /&gt;
# echo &amp;quot;CONFIG_SQUASHFS=m&lt;br /&gt;
&amp;gt; CONFIG_SQUASHFS_EMBEDDED=n&amp;quot; | tee -a *.config.ovz&lt;br /&gt;
CONFIG_SQUASHFS=m&lt;br /&gt;
CONFIG_SQUASHFS_EMBEDDED=n&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After all efforts, building the RPM-package is very easy:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /usr/src/redhat/SPECS/&lt;br /&gt;
# rpmbuild --target=i686 -ba kernel-ovz.spec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If everything goes smoothly, in several tens of minutes depending on the power of your node you willl have OpenVZ kernel RPM-package with &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; support. Let's copy it to our local directory &amp;lt;tt&amp;gt;to_booted_livecd/kernels/&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
# ls /usr/src/redhat/RPMS/i686/&lt;br /&gt;
kernel-smp-2.6.18-ovz028stab035.1.i686.rpm&lt;br /&gt;
# mkdir -p to_booted_livecd/kernels&lt;br /&gt;
# cp /usr/src/redhat/RPMS/i686/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm to_booted_livecd/kernels/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
OpenVZ LiveCD supports several kernels. So, the actions mentioned above should be accomplished to all kernels,&lt;br /&gt;
that you need on LiveCD. In this article I skip the description of building RPMS for all kernels. All description&lt;br /&gt;
below are based on &amp;lt;tt&amp;gt;028stab035&amp;lt;/tt&amp;gt; kernel, that has been just build above. But some important differences in building&lt;br /&gt;
kernel of version other then 2.6.18 one is summarized below.&lt;br /&gt;
==== Peculiarities of building 2.6.9-rhel4 ====&lt;br /&gt;
* You should also include this patch (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da)&lt;br /&gt;
in building process. Hopefully will be fixed in &amp;lt;tt&amp;gt;2.6.9-044stab044.8&amp;lt;/tt&amp;gt; kernel.&lt;br /&gt;
* Use &amp;lt;tt&amp;gt;unionfs 1.0.14&amp;lt;/tt&amp;gt;, but not &amp;lt;tt&amp;gt;unionfs 1.1.5&amp;lt;/tt&amp;gt;, as offered at its official site!&lt;br /&gt;
* Small problems while building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;: arguments of &amp;lt;tt&amp;gt;vfs_permissions()&amp;lt;/tt&amp;gt;. Just add &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt;&lt;br /&gt;
to appropriate places.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.18-rhel5 ====&lt;br /&gt;
* Note, &amp;lt;tt&amp;gt;squashfs&amp;lt;/tt&amp;gt; patch is already there, but you should use &amp;lt;tt&amp;gt;3.2&amp;lt;/tt&amp;gt;! :)&lt;br /&gt;
* While building &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; some small fixes: &amp;lt;tt&amp;gt;i_blksize&amp;lt;/tt&amp;gt; field is missing in &amp;lt;tt&amp;gt;inode&amp;lt;/tt&amp;gt; structure, &amp;lt;tt&amp;gt;ino_t&amp;lt;/tt&amp;gt; should be changed to &amp;lt;tt&amp;gt;u64&amp;lt;/tt&amp;gt; in some functions.&lt;br /&gt;
&lt;br /&gt;
==== Peculiarities of building 2.6.20 ====&lt;br /&gt;
* Only &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; is available for 2.6.20 kernel and it is distributed as a patch. Consequently modify &amp;lt;tt&amp;gt;spec&amp;lt;/tt&amp;gt;-file and configs while building the kernel&lt;br /&gt;
* &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;2.0&amp;lt;/tt&amp;gt; doesn't support unionctl. Consequently you have to modify &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file on &amp;lt;tt&amp;gt;initrd&amp;lt;/tt&amp;gt; image to mount all branches at once, but don't add them by ioctls.&lt;br /&gt;
&lt;br /&gt;
=== Unionfs kernel module ===&lt;br /&gt;
In most present-day LiveCDs &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem is used. This filesystem &amp;quot;can appear to merge the contents of several directories, while keeping their physical content separate&amp;quot;. For example, after the command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mount -t unionfs -o dirs=/tmp/changes=rw:/cdrom=ro unionfs /union&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
you will see merged contents of &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt; directories in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory. &lt;br /&gt;
At that, &amp;lt;tt&amp;gt;cdrom&amp;lt;/tt&amp;gt; will be read-only. I.e. if you will write to some file in &amp;lt;tt&amp;gt;/union&amp;lt;/tt&amp;gt; directory, &lt;br /&gt;
that resides in &amp;lt;tt&amp;gt;/cdrom&amp;lt;/tt&amp;gt; in fact, this modified file will be automatically moved to &amp;lt;tt&amp;gt;/tmp/changes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Such useful property is logically used in LiveCDs: &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; merges cdrom contents (that is read-only)&lt;br /&gt;
and temporary in-memory filesystem.&lt;br /&gt;
In order to add support of &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem to OpenVZ kernel we need to compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; kernel&lt;br /&gt;
module against used kernel. Download the sources of unionfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# wget ftp://ftp.filesystems.org/pub/unionfs/unionfs-1.x/unionfs-1.4.tar.gz&lt;br /&gt;
# tar xzf unionfs-1.4.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In previous chapter we have created an RPM-package with OpenVZ kernel. We should install it: because&lt;br /&gt;
this packages contents kernel headers, required for building kernel modules.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ivh to_booted_livecd/kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
Preparing...                ########################################### [100%]&lt;br /&gt;
   1:kernel-smp             ########################################### [100%]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now compile &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd unionfs-1.4&lt;br /&gt;
# echo 'LINUXSRC=/lib/modules/2.6.18-ovz028stab035.1-smp/build/&lt;br /&gt;
&amp;gt; TOPINC=-I$(LINUXSRC)/include&lt;br /&gt;
&amp;gt; MODDIR=/lib/modules/2.6.18-ovz028stab035.1-smp/' &amp;gt; fistdev.mk&lt;br /&gt;
# make&lt;br /&gt;
# ls unionfs.ko &lt;br /&gt;
unionfs.ko&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Later we will place &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to appropriate place in '''booted''' LiveCD filesystem.&lt;br /&gt;
At the moment copy it to local &amp;lt;tt&amp;gt;to_booted_livecd/unionfs-modules/2.6.18/&amp;lt;/tt&amp;gt; directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir -p to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
# cp unionfs-1.4/unionfs.ko to_booted_livecd/unionfs-modules/2.6.18/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I repeat once again: if you want to use several kernels on LiveCD - the operation above should&lt;br /&gt;
be repeated for each wishful kernel.&lt;br /&gt;
&lt;br /&gt;
=== OpenVZ tools and templates. CentOS updates ===&lt;br /&gt;
We have now the kernel RPM-package. But we also need OpenVZ tools RPM-packages.&lt;br /&gt;
It is much easier with them: just download these packages from http://openvz.org:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/tools&lt;br /&gt;
# cd to_booted_livecd/tools/&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzctl/3.0.16/vzctl-lib-3.0.16-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/utils/vzquota/3.0.9/vzquota-3.0.9-1.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzpkg/2.7.0-18/vzpkg-2.7.0-18.noarch.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm43/current/vzrpm43-python-4.3.3-7_nonptl.6.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzrpm44/current/vzrpm44-python-4.4.1-22.5.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/utils/vzyum/current/vzyum-2.4.0-11.noarch.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../template-metadatas&lt;br /&gt;
# cd ../template-metadatas&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/centos-4/vztmpl-centos-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-3/vztmpl-fedora-core-3-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-4/vztmpl-fedora-core-4-2.0-2.i386.rpm&lt;br /&gt;
# wget http://download.openvz.org/template/metadata/fedora-core-5/vztmpl-fedora-core-5-2.0-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# mkdir ../precreated&lt;br /&gt;
# cd ../precreated&lt;br /&gt;
&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/centos-4-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/debian-3.1-i386-minimal.tar.gz&lt;br /&gt;
# wget http://download.openvz.org/template/precreated/fedora-core-5-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you understand, you can add other precreated templates to LiveCD. The main thing here is that usual CD is &lt;br /&gt;
not rubber and precreated templates are rather big! ;)&lt;br /&gt;
&lt;br /&gt;
Centos 4.4 LiveCD has a serios problem: &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package is broken and consequently&lt;br /&gt;
&amp;lt;tt&amp;gt;yum&amp;lt;/tt&amp;gt; doesn't work. In order to fix this problem we need updated &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir to_booted_livecd/updates&lt;br /&gt;
# cd to_booted_livecd/updates&lt;br /&gt;
# wget http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
# cd ~/workbench/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install all these finally ===&lt;br /&gt;
We have all components that will be on '''booted''' LiveCD ready. Let's install them&lt;br /&gt;
in &amp;lt;tt&amp;gt;chrooted&amp;lt;/tt&amp;gt; environment. But before uninstall &amp;lt;tt&amp;gt;lsctp-tools&amp;lt;/tt&amp;gt; package,&lt;br /&gt;
because these tools need kernel version prior to 2.6.10. Then update &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&lt;br /&gt;
package. Also we need to remove some other packages in order to free some disk space:&lt;br /&gt;
I've removed &amp;lt;tt&amp;gt;openoffice.org&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;dia&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gnome-games&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&amp;lt;tt&amp;gt;tetex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;latex&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;k3b&amp;lt;/tt&amp;gt; and printing related packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r to_booted_livecd/ root/tmp/&lt;br /&gt;
# chroot root/&lt;br /&gt;
&lt;br /&gt;
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386&lt;br /&gt;
&lt;br /&gt;
# rpm -e openoffice.org-libs openoffice.org&lt;br /&gt;
# rpm -e gimp-data-extras xsane-gimp gimp-print-plugin gimp-print-utils&lt;br /&gt;
# rpm -e gimp gimp-print gimp-help gimp-gap&lt;br /&gt;
# rpm -e dia&lt;br /&gt;
# rpm -e planner&lt;br /&gt;
# rpm -e gnome-games&lt;br /&gt;
# rpm -e tetex-latex jadetex xmltex passivetex tetex tetex-afm \&lt;br /&gt;
tetex-dvips tetex-fonts tetex-xdvi&lt;br /&gt;
# rpm -e k3b&lt;br /&gt;
# rpm -e foomatic Omni Omni-foomatic system-config-printer \&lt;br /&gt;
system-config-printer-gui hal-cups-utils desktop-printing&lt;br /&gt;
&lt;br /&gt;
# cd /tmp/to_booted_livecd/&lt;br /&gt;
&lt;br /&gt;
# rpm -Uvh updates/sqlite-3.3.6-2.i386.rpm&lt;br /&gt;
&lt;br /&gt;
# rpm -ivh kernels/kernel-smp-2.6.18-ovz028stab035.1.i686.rpm &lt;br /&gt;
# rpm -ivh tools/*.rpm&lt;br /&gt;
# rpm -ivh template-metadatas/*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy precreated templates to appropriate place:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp  precreated/* /vz/template/cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add &amp;lt;tt&amp;gt;unionfs.ko&amp;lt;/tt&amp;gt; to other kernel modules and run &amp;lt;tt&amp;gt;depmod&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs&lt;br /&gt;
# cp unionfs-modules/2.6.18/unionfs.ko /lib/modules/2.6.18-ovz028stab035.1-smp/kernel/fs/unionfs/&lt;br /&gt;
# depmod 2.6.18-ovz028stab035.1-smp&lt;br /&gt;
# exit&lt;br /&gt;
exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
While being in chrooted environment bash history was written to &amp;lt;tt&amp;gt;~/.bash_history&amp;lt;/tt&amp;gt; file.&lt;br /&gt;
Clean it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm root/root/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment&lt;br /&gt;
chekpointing isn't supported on &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt; filesystem ([http://bugzilla.openvz.org/show_bug.cgi?id=606  Bug #606]).&lt;br /&gt;
But we want of course checkpoiting to work on LiveCD. If we mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on &amp;lt;tt&amp;gt;/vz/private/&amp;lt;/tt&amp;gt; on '''booted''' LiveCD,&lt;br /&gt;
then all newly created VEs reside on &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; and checkpointing works. Moreover we do not introduce any additional memory usage,&lt;br /&gt;
because even without &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; all VEs reside in RAM (they contain new/updated files for &amp;lt;tt&amp;gt;unionfs&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Create &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; directory, later, while modifying initrd image we will add the line that will mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt;&lt;br /&gt;
on this directory:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir root/vz/private/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
At the moment vzquota doesn't support &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; ([http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #558]).&lt;br /&gt;
We're working on this problem, but for now '''switching the disk quota off''' in &amp;lt;tt&amp;gt;/etc/vz/vz.conf&amp;lt;/tt&amp;gt;: &amp;lt;tt&amp;gt;DISK_QUOTA=no&amp;lt;/tt&amp;gt;.&lt;br /&gt;
But when disk quota is off &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt; fails! ;) This is the [http://bugzilla.openvz.org/show_bug.cgi?id=558  Bug #512].&lt;br /&gt;
So, don't forget to apply the patch attached to this bug report to &amp;lt;tt&amp;gt;vzmigrate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Booted''' LiveCD filesystem is ready, congratulations!&lt;br /&gt;
&lt;br /&gt;
=== Compressing '''booted''' LiveCD filesystem ===&lt;br /&gt;
Since &amp;lt;tt&amp;gt;mksquashfs&amp;lt;/tt&amp;gt; tool is already installed we can simply use it to create&lt;br /&gt;
&amp;lt;tt&amp;gt;*.mo&amp;lt;/tt&amp;gt; files: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rm -f ovz-livecd/base/*.mo&lt;br /&gt;
# for f in bin etc lib root sbin usr var vz; do \&lt;br /&gt;
    mksquashfs root/$f ovz-livecd/base/$f.mo -keep-as-directory; \&lt;br /&gt;
  done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vmlinux, initrd and isolinux.cfg ===&lt;br /&gt;
The next step is to force &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; (cdrom boot loader) to boot OpenVZ kernel.&lt;br /&gt;
First, copy kernel image to OpenVZ CD. It is important to give '''short name''' (not greater&lt;br /&gt;
than 8 characters) to kernel image, otherwise &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; will not see it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there&lt;br /&gt;
and apply small patches to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file. Initrd image that goes with Centos 4.4 is&lt;br /&gt;
of size 40Mb. OpenVZ LiveCD will contain several kernels, so initrd should have several sets of&lt;br /&gt;
kernel modules (for each kernel) and 40Mb isn't enough in this case. I created an initrd of size 100Mb.&lt;br /&gt;
Don't forget to update &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;isolinux.cfg&amp;lt;/tt&amp;gt; file later!&lt;br /&gt;
&lt;br /&gt;
Creating &amp;quot;big&amp;quot; initrd with original content:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkdir initrd.d&lt;br /&gt;
# cp ovz-livecd/boot/initrd.gz initrd.d/initrd-old.gz&lt;br /&gt;
# cd initrd.d/&lt;br /&gt;
# mkdir mount-old&lt;br /&gt;
# gunzip initrd-old.gz &lt;br /&gt;
# mount -o loop initrd-old mount-old/&lt;br /&gt;
# dd if=/dev/zero of=initrd bs=1048576 count=100&lt;br /&gt;
# mke2fs initrd&lt;br /&gt;
initrd is not a block special device.&lt;br /&gt;
Proceed anyway? (y,n) y&lt;br /&gt;
...&lt;br /&gt;
# mkdir mount&lt;br /&gt;
# mount -o loop initrd mount/&lt;br /&gt;
# cp -a mount-old/* mount/&lt;br /&gt;
# umount mount-old/&lt;br /&gt;
# rm -rf mount-old initrd-old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Copy modules to initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cp -r ../root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/&lt;br /&gt;
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build                 # we don't neet it on initrd image&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
I also delete some not necessary kernel modules from initrd to free space.&lt;br /&gt;
They are stil on CD, so init sctipts will be able to load them later.&lt;br /&gt;
&lt;br /&gt;
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules.&lt;br /&gt;
It works well for CentOS kernel, because cdrom support is built-in there.&lt;br /&gt;
But OpenVZ kernel supports cdrom (usual ide cdrom) via kernel module.&lt;br /&gt;
Consequetnly we need to apply the following patch to &amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig   2006-08-19 08:53:11.000000000 +0400&lt;br /&gt;
+++ liblinuxlive        2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
@@ -337,6 +337,9 @@ modprobe_essential_modules()&lt;br /&gt;
 {&lt;br /&gt;
    echolog &amp;quot;starting loop device support&amp;quot;&lt;br /&gt;
    modprobe_module loop max_loop=32&lt;br /&gt;
+   echolog &amp;quot;starting cdrom support&amp;quot;&lt;br /&gt;
+   modprobe_module cdrom&lt;br /&gt;
+   modprobe_module ide-cd&lt;br /&gt;
    echolog &amp;quot;starting cdrom filesystem support&amp;quot;&lt;br /&gt;
    modprobe_module isofs&lt;br /&gt;
    echolog &amp;quot;starting squashfs support&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As mentioned earlier we want to mount &amp;lt;tt&amp;gt;tmpfs&amp;lt;/tt&amp;gt; on /vz/private automatically. Just apply this patch to&lt;br /&gt;
&amp;lt;tt&amp;gt;liblinuxlive&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- liblinuxlive.orig-fstab     2007-07-02 17:50:34.000000000 +0400&lt;br /&gt;
+++ mount/liblinuxlive  2007-07-03 12:33:30.000000000 +0400&lt;br /&gt;
@@ -414,6 +414,7 @@ activate_fstab()&lt;br /&gt;
    echo &amp;quot;tmpfs            /                tmpfs       defaults         0   0&amp;quot; &amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;devpts           /dev/pts         devpts      gid=5,mode=620   0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
    echo &amp;quot;proc             /proc            proc        defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
+   echo &amp;quot;tmpfs            /vz/private      tmpfs       defaults         0   0&amp;quot; &amp;gt;&amp;gt;$FSTAB&lt;br /&gt;
&lt;br /&gt;
    # now done by fstab-sync&lt;br /&gt;
    # list_cdrom_devices | while read DEVICE; do&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finishing actions with initrd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# sync&lt;br /&gt;
# umount mount/&lt;br /&gt;
# gzip initrd&lt;br /&gt;
# /bin/cp initrd.gz ../ovz-livecd/boot/initrd.gz&lt;br /&gt;
# cd ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we should modify &amp;lt;tt&amp;gt;ovz-livecd/isolinux.cfg&amp;lt;/tt&amp;gt; file, that controls &amp;lt;tt&amp;gt;isolinux&amp;lt;/tt&amp;gt; boot loader.&lt;br /&gt;
We inform boot loader, that new kernel was added by introducing the following changes (in diff format):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--- ovz-livecd/isolinux.cfg.orig   2006-08-19 08:53:09.000000000 +0400&lt;br /&gt;
+++ ovz-livecd/isolinux.cfg     2007-07-02 19:10:51.000000000 +0400&lt;br /&gt;
@@ -1,5 +1,5 @@&lt;br /&gt;
 display boot/splash.cfg&lt;br /&gt;
-default linux&lt;br /&gt;
+default ovz18&lt;br /&gt;
 prompt 1&lt;br /&gt;
 timeout 300&lt;br /&gt;
 F1 boot/help1.txt&lt;br /&gt;
@@ -11,5 +11,9 @@ label linux&lt;br /&gt;
 kernel boot/vmlinuz&lt;br /&gt;
 append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=40000 root=/dev/ram0 rw rhgb quiet&lt;br /&gt;
&lt;br /&gt;
+label ovz18 &lt;br /&gt;
+kernel boot/ovz18&lt;br /&gt;
+append max_loop=32 vga=791 initrd=boot/initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=102400 root=/dev/ram0 rw rhgb&lt;br /&gt;
+&lt;br /&gt;
 label memtest&lt;br /&gt;
 kernel boot/memtest&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also '''don't forget''' to change &amp;lt;tt&amp;gt;ramdisk_size&amp;lt;/tt&amp;gt; to 102400 for all kernels including Centos 4.4 default! &lt;br /&gt;
&lt;br /&gt;
And I suggest to remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; parameter, to see what happens: it will help greatly if some problem will happen.&lt;br /&gt;
&lt;br /&gt;
=== Embellishment ===&lt;br /&gt;
If you want to release LiveCD to other people some &amp;quot;embelishments&amp;quot; should be added.&lt;br /&gt;
&lt;br /&gt;
First, edit &amp;lt;tt&amp;gt;splash.cfg&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help1.txt&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;help2.txt&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;help3.txt&amp;lt;/tt&amp;gt;&lt;br /&gt;
files (that are in &amp;lt;tt&amp;gt;~/workbench/ovz-livecd/boot/help&amp;lt;/tt&amp;gt; directory) to contain appropriate information.&lt;br /&gt;
These messages appear on the LiveCD initial boot: they help to choose kernel and kernel options.&lt;br /&gt;
&lt;br /&gt;
Also, you can note, that CentOS logo appears at this moment. This logo resides in &amp;lt;tt&amp;gt;ovz-livecd/boot/splash.lss&amp;lt;/tt&amp;gt;&lt;br /&gt;
file. I added OpenVZ logo there. The following tools will help you: &amp;lt;tt&amp;gt;lss16toppm&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ppmtolss16&amp;lt;/tt&amp;gt; and&lt;br /&gt;
of course &amp;lt;tt&amp;gt;gimp&amp;lt;/tt&amp;gt; :)&lt;br /&gt;
&lt;br /&gt;
One more thing we change is default desktop background. It resides in &amp;lt;tt&amp;gt;usr/share/backgrounds/images/default.png&amp;lt;/tt&amp;gt;.&lt;br /&gt;
I added OpenVZ logo there.&lt;br /&gt;
&lt;br /&gt;
=== Creating ISO ===&lt;br /&gt;
Centos 4.4 LiveCD creators were very gentle and have placed &amp;lt;tt&amp;gt;make_iso.sh&amp;lt;/tt&amp;gt; script on CD.&lt;br /&gt;
Using this script, it is very easy to create iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd ovz-livecd&lt;br /&gt;
# ./make_iso.sh ../CentOS-4.4-i386-OpenVZ-LiveCD.iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Debugging LiveCD ==&lt;br /&gt;
If you have trouble with created OpenVZ LiveCD, boot the kernel with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vga=0 debug&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
command line options. It will help you to diagnose the problem more precisely.&lt;br /&gt;
Also it can be useful to redirect kernel output to serial console:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
console=ttyS0,115200 console=tty&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See more at [[remote console setup]].&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://centos.org Official CentOS community website]&lt;br /&gt;
* [http://kernel.org Linux kernel website]&lt;br /&gt;
* [http://redhat.com RedHat Inc. website]&lt;br /&gt;
* [http://squashfs.sourceforge.net/ squashfs website]&lt;br /&gt;
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Live CD]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=X_inside_VE&amp;diff=3983</id>
		<title>X inside VE</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=X_inside_VE&amp;diff=3983"/>
		<updated>2008-01-22T13:51:27Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: /* XDM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are several ways to run X applications inside your [[VE]].&lt;br /&gt;
&lt;br /&gt;
== X forwarding ==&lt;br /&gt;
&lt;br /&gt;
=== Single application ===&lt;br /&gt;
&lt;br /&gt;
To run an X application inside a [[VE]], one need simply to connect to a VE with '''ssh -X''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
host# ssh -2 -c blowfish -X user@address&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After login to VE check that &amp;lt;code&amp;gt;$DISPLAY&amp;lt;/code&amp;gt; variable is set and X11 forwarding is enabled:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ve# echo $DISPLAY&lt;br /&gt;
localhost:10.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case &amp;lt;code&amp;gt;$DISPLAY&amp;lt;/code&amp;gt; is not set, make sure that X forwarding is enabled in &amp;lt;code&amp;gt;sshd&amp;lt;/code&amp;gt; config inside VE. In most Linux distros sshd configuration is stored in &amp;lt;code&amp;gt;/etc/ssh/sshd_config&amp;lt;/code&amp;gt;. You should set parameter &amp;lt;code&amp;gt;X11Forwarding&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;. Also VE should contain &amp;lt;code&amp;gt;xauth&amp;lt;/code&amp;gt; package, thus install &amp;lt;code&amp;gt;xauth&amp;lt;/code&amp;gt; if it is missing (in Debian this is part of the xbase-clients package). After that, restart your sshd daemon:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ve# /etc/init.d/sshd restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|Don't forget to reconnect after this}}&lt;br /&gt;
&lt;br /&gt;
Now you can run X applications from your VE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ve# firefox&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Desktop ===&lt;br /&gt;
&lt;br /&gt;
Note : If you want to run complete X window environment (including window manager), you should kill local window manager and run only pure X server. Secondly you should use  '''-Y''' option when invoking ssh. And if you want to run gnome/kde/..., don't forget to increase [[UBC]] limits, 'cause default values are certainly too small for these monsters. ;)&lt;br /&gt;
&lt;br /&gt;
You can run a desktop with ''xinit'' (on the node):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
xinit -e ssh -XCc blowfish user@ip_address &amp;quot;/usr/bin/xfce4-session &amp;amp;&amp;quot; -- :1 &amp;amp; disown&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Substitute the window manager of choice&lt;br /&gt;
* Once xfce has started, you can then close the xterm if you like&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Your node will be on Ctrl-Alt-F7&lt;br /&gt;
&lt;br /&gt;
And your VM on Ctrl-Alt-F8&lt;br /&gt;
&lt;br /&gt;
== VNC for X desktop ==&lt;br /&gt;
First, one need to run '''Xvnc''' server inside VE. The easiest way for this is to run&lt;br /&gt;
'''vncserver''' script. This scripts starts all the required services&lt;br /&gt;
and small http daemon which provides graphical web access to your desktop (via Java applet).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ve# vncserver -name mydesktop&lt;br /&gt;
New 'mydekstop' desktop is ve:1&lt;br /&gt;
&lt;br /&gt;
Starting applications specified in ~/.vnc/xstartup&lt;br /&gt;
Log file is ~/.vnc/ve:1.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now when your desktop is up and running you can connect to it&lt;br /&gt;
using '''vncviewer''' command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
host# vncviewer &amp;lt;VE_IP&amp;gt;:1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the VNC desktop is the same size or larger than your X desktop, you will see scroll bars on the bottom and the side.  This is often inconvenient. You may reduce your VNC desktop to a more reasonable size like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;vncserver -geometry 1000x650&amp;lt;/pre&amp;gt;&lt;br /&gt;
This setting works quite well for a 1024 by 768 X desktop setting.&lt;br /&gt;
&lt;br /&gt;
=== Starting KDE desktop with VNC ===&lt;br /&gt;
To start KDE desktop instead of default twm one replace &amp;lt;code&amp;gt;twm &amp;amp;&amp;lt;/code&amp;gt; line with &amp;lt;code&amp;gt;startkde &amp;amp;&amp;lt;/code&amp;gt; in user's&lt;br /&gt;
&amp;lt;code&amp;gt;~/.vnc/xstartup&amp;lt;/code&amp;gt; file on the VE.&lt;br /&gt;
&lt;br /&gt;
=== Connecting with VNC from firewalled network ===&lt;br /&gt;
VNC uses 590x TCP ports for its connections. These ports can be firewalled in&lt;br /&gt;
many networks so in order to be able to connect to remote side one need to tunnel VNC connections somehow.&lt;br /&gt;
A usual '''ssh''' can be used for tunneling VNC connections as described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localhost# ssh -L 5900:localhost:5900 &amp;lt;remote host&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;remote host&amp;gt; is the name of the system you want to connect to. When you are asked for a username and password enter your normal username and password. Then start the VNC session to localhost, i.e.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localhost# vncviewer localhost&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using Xephyr ==&lt;br /&gt;
&lt;br /&gt;
Xephyr gives you nested X windows.&lt;br /&gt;
&lt;br /&gt;
First, install Xephyr on your host.&lt;br /&gt;
&lt;br /&gt;
Start Xephyr&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Xephyr -ac -screen 1280x1024 -br -reset -terminate :1 &amp;amp;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change your display settings (don't forget to change them back after you establish a connection)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DISPLAY=:1,0&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Forward your application or desktop over ssh to Xephyr&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ssh -XfC -c blowfish user@server xfce4-session&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use an alternate window manager, substitute &amp;quot;startkde&amp;quot;, &amp;quot;gnome-session&amp;quot;, &amp;quot;startfluxbox&amp;quot;, etc. as needed. &lt;br /&gt;
&lt;br /&gt;
[http://cafelinux.org/OptickleArt/albums/userpics/Xephyr.png Screenshot]&lt;br /&gt;
&lt;br /&gt;
== Using XDM with XDMCP ==&lt;br /&gt;
This method will give you a graphical login prompt remotely similar to VNC, but with some differences. Most notably, XDMCP is faster than VNC (due to the way each deals with screen handling) and but you CANNOT connect to existing sessions like you can with VNC. Each time you logout, your programs are closed. XDMCP is better suited in situations where you don't have a local display (or dumb terminals/clients) but want to run X11 programs&lt;br /&gt;
&lt;br /&gt;
=== VE Configuration ===&lt;br /&gt;
Install your desktop environment as you'd like (kde/gnome/xfce/etc) and ensure you install at least XDM. You can opt to use GDM/KDM as they also do the same job as XDM. The configuration for KDM/GDM is different than XDM's and I was only able to find one link on configuring GDM (more below).&lt;br /&gt;
&lt;br /&gt;
===== XDM =====&lt;br /&gt;
Configuring XDM requires editing 3 files: /etc/X11/xdm/xdm-config, /etc/X11/xdm/Xservers, /etc/X11/xdm/Xaccess&lt;br /&gt;
&lt;br /&gt;
In xdm-config, comment out the line where it says '''DisplayManager.requestPort:    0'''&lt;br /&gt;
&lt;br /&gt;
In Xservers, comment out the line ''':0 local /usr/bin/X :0 vt7'''' (this starts a local X server, which will fail)&lt;br /&gt;
&lt;br /&gt;
In Xaccess, uncomment the line with ''' *          #any host can get a login window'''&lt;br /&gt;
(Please keep in mind the security implications by the above line. Read the comments found in the file and set it appropriately)&lt;br /&gt;
&lt;br /&gt;
To provide the possibility to run sound applications from VE, /dev/dsp device file needs to be exported in VE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl set 221 --devnodes dsp:rw --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, if you intend to make xdm invoking a heavy desktop like kde, it is reasonable to increase the amount of memory available for allocation inside  this VE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl set 221 --privvmpages 500M:600M --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For light desktop like icewm this is not needed.&lt;br /&gt;
&lt;br /&gt;
Once these changes have been made, start your xdm server by the appropriate startup script (typically similar to /etc/init.d/xdm start). That concludes the XDM setup in the VE.&lt;br /&gt;
&lt;br /&gt;
===== GDM =====&lt;br /&gt;
Edit the '''gdm.conf''' file and in xdmcp section, comment out the 0=standard line under the [servers] section - this will prevent gdm from trying to launch an X server on the local machine - it will simply listen for xdmcp requests. Also, change from VCAllocation=true to VTAllocation=false and comment out the FirstVT=7 line. Change the access restrictions (if any) to suit your needs and then start GDM.&lt;br /&gt;
&lt;br /&gt;
=== Hostnode Configuration ===&lt;br /&gt;
On the HN, you need to install ONLY a bare Xserver as per your OS instructions (use yum, emerge, apt, whatever). A desktop environment like XFCE/GNOME/KDE are entirely optional (and not recommended as it'll unnecessarily just chew up resources) on the HN.&lt;br /&gt;
&lt;br /&gt;
To get access to the XDM server, just start an Xserver with '''X -query &amp;lt;remote IP&amp;gt; :0''' (where :0 is the local display...set to :1 if you already have an X session running, or use Xnest)&lt;br /&gt;
&lt;br /&gt;
There are guides online on howto tunnel the XDMCP settings over ssh giving you security, in an otherwise INSECURE protocol.&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
On a side note, as of December 2007, I was never able to successfully get an Xserver to run inside a VE and have the display output onto virtual-terminal 7 (the Xserver default), However, you can get an Xserver running on the hostnode to display output on virtual-terminal 7 without any special configuration (as the hostnode has direct access to all necessary devices).&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* http://forum.openvz.org/index.php?t=tree&amp;amp;th=235&amp;amp;mid=1115&amp;amp;&amp;amp;rev=&amp;amp;reveal=&lt;br /&gt;
* http://ait.web.psi.ch/services/linux/kde-desktop-sharing.htm&lt;br /&gt;
* http://ait.web.psi.ch/services/ssh/vnc-ssh.html&lt;br /&gt;
* http://www.vnc.com/pipermail/vnc-list/2002-July/031831.html&lt;br /&gt;
* http://www.linuxjournal.com/article/5499&lt;br /&gt;
* http://www.realvnc.com/pipermail/vnc-list/2002-March/029502.html&lt;br /&gt;
* http://www.redhat.com/archives/rhl-list/2003-December/msg01859.html&lt;br /&gt;
* http://faq.gotomyvnc.com/fom-serve/cache/56.html&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Networking]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Asterisk_from_source&amp;diff=3945</id>
		<title>Asterisk from source</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Asterisk_from_source&amp;diff=3945"/>
		<updated>2008-01-14T12:15:04Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General==&lt;br /&gt;
Asterisk is free and open source code to create software PBX server. See [http://www.asterisk.org] for details. This package perfectly runs inside OpenVZ container. Some users run up to 60 containers with Asterisk deployed for production per single hardware node. Although the easiest way to install Asterisk into container is to use pre-build package from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site.&lt;br /&gt;
&lt;br /&gt;
In order to do it the following remarks are worth reading:&lt;br /&gt;
&lt;br /&gt;
==Building Asterisk in CT==&lt;br /&gt;
Asterisk PBX server itself is compiled out of the shelf in CT provided that develop application template is installed on this CT. The functionality of the resulting executable is enough to support simple VoIP telephony.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-x.x.xx.tar.gz&lt;br /&gt;
tar xzf asterisk-x.x.xx.tar.gz&lt;br /&gt;
cd asterisk-x.x.xx.tar.gz&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
make samples&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command is not needed in case you have your own configuration as it installs some sample configuration files.&lt;br /&gt;
To configure Asterisk itself see for example [http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.oreilly.com/books/9780596510480.pdf].&lt;br /&gt;
&lt;br /&gt;
==MeetMe problem==&lt;br /&gt;
Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package. Zaptel provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called ztdummy kernel module. Ztdummy works like a simple metronome which is required to synchronize multiple sound streams in case of conference call. &lt;br /&gt;
&lt;br /&gt;
If you do not plan to use analog telephone lines, hence don't like in install the hardware, nothing is lost provided you run your HN with 2.6.XX kernel. You just need to play a little trick with Asterisk make system: download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location /usr/include/zaptel/zaptel.h in CT where you plan to build Asterisk. This tweaks MeetMe for installation.&lt;br /&gt;
&lt;br /&gt;
==HN configuration==&lt;br /&gt;
Finally you need to make sure that on HN ztdummy kernel module is loaded and the access to /dev/zap/pseudo device file is granted to&lt;br /&gt;
CT:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
modprobe ztdummy&lt;br /&gt;
vzctl set 240 --devnodes zap/pseudo:rw --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Asterisk_from_source&amp;diff=3944</id>
		<title>Asterisk from source</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Asterisk_from_source&amp;diff=3944"/>
		<updated>2008-01-14T12:00:06Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General==&lt;br /&gt;
Asterisk is free and open source code to create software PBX server. See [http://www.asterisk.org] for details. This package perfectly runs inside OpenVZ container. Some users run up to 60 containers with Asterisk deployed for production per single hardware node. Although the easiest way to install Asterisk into container is to use pre-build package from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site.&lt;br /&gt;
&lt;br /&gt;
In order to do it the following remarks are worth reading:&lt;br /&gt;
&lt;br /&gt;
==Building Asterisk in CT==&lt;br /&gt;
Asterisk PBX server itself is compiled out of the shelf in CT provided that develop application template is installed on this CT. The functionality of the resulting executable is enough to support simple VoIP telephony.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-x.x.xx.tar.gz&lt;br /&gt;
tar xzf asterisk-x.x.xx.tar.gz&lt;br /&gt;
cd asterisk-x.x.xx.tar.gz&lt;br /&gt;
./configure&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
make samples&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last command is not needed in case you have your own configuration as it installs some sample configuration files.&lt;br /&gt;
&lt;br /&gt;
==MeetMe problem==&lt;br /&gt;
Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package. Zaptel provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called ztdummy kernel module. Ztdummy works like a simple metronome which is required to synchronize multiple sound streams in case of conference call. &lt;br /&gt;
&lt;br /&gt;
If you do not plan to use analog telephone lines, hence don't like in install the hardware, nothing is lost provided you run your HN with 2.6.XX kernel. You just need to play a little trick with Asterisk make system: download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location /usr/include/zaptel/zaptel.h in CT where you plan to build Asterisk. This tweaks MeetMe for installation.&lt;br /&gt;
&lt;br /&gt;
==HN configuration==&lt;br /&gt;
Finally you need to make sure that on HN ztdummy kernel module is loaded and the access to /dev/zap/pseudo device file is granted to&lt;br /&gt;
CT:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
modprobe ztdummy&lt;br /&gt;
vzctl set 240 --devnodes zap/pseudo:rw --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Asterisk_from_source&amp;diff=3943</id>
		<title>Asterisk from source</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Asterisk_from_source&amp;diff=3943"/>
		<updated>2008-01-14T11:36:48Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: New page: Asterisk is free and open source code to create software PBX server. See [http://www.asterisk.org] for details. This package perfectly runs inside OpenVZ container. Some users run up to 60...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Asterisk is free and open source code to create software PBX server. See [http://www.asterisk.org] for details. This package perfectly runs inside OpenVZ container. Some users run up to 60 containers with Asterisk deployed for production per single hardware node. Although the easiest way to install Asterisk into container is to use pre-build package from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site.&lt;br /&gt;
&lt;br /&gt;
In order to do it the following remarks are worth reading:&lt;br /&gt;
&lt;br /&gt;
Asterisk PBX server itself is compiled out of the shelf in CT provided that develop application template is installed on this CT. The functionality of the resulting executable is enough to support simple VoIP telephony.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package. Zaptel provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called ztdummy kernel module. Ztdummy works like a simple metronome which is required to synchronize multiple sound streams in case of conference call. &lt;br /&gt;
&lt;br /&gt;
If you do not plan to use analog telephone lines, hence don't like in install the hardware, nothing is lost provided you run your HN with 2.6.XX kernel. You just need to play a little trick with Asterisk make system: download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location /usr/include/zaptel/zaptel.h in CT where you plan to build Asterisk. This tweaks MeetMe for installation.&lt;br /&gt;
&lt;br /&gt;
Finally you need to make sure that on HN ztdummy kernel module is loaded and the access to /dev/zap/pseudo device file is granted to&lt;br /&gt;
CT:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
modprobe ztdummy&lt;br /&gt;
vzctl set 240 --devnodes zap/pseudo:rw --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Asterisk_in_container_with_Debian_stable&amp;diff=3942</id>
		<title>Asterisk in container with Debian stable</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Asterisk_in_container_with_Debian_stable&amp;diff=3942"/>
		<updated>2008-01-14T11:36:18Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Below is an example of how to install Asterisk into OpenVZ VE based on debian stable aka. &amp;quot;sarge&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ apt-get install asterisk&lt;br /&gt;
&lt;br /&gt;
$ nano /etc/defaults/asterisk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
change:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUNASTERISK=no -&amp;gt; yes&lt;br /&gt;
AST_REALTIME=yes -&amp;gt; no (for realtime, you need&lt;br /&gt;
&lt;br /&gt;
$ /etc/init.d/asterisk start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
modify the config files for asterisk, and done!&lt;br /&gt;
&lt;br /&gt;
if you need capi or/and zaptel/zaphfc:&lt;br /&gt;
&lt;br /&gt;
* for capi: you need the /dev files on you hw-node and vps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crw-rw---- 1 root dialout 68, 0 Jan 3 2006 /dev/capi20&lt;br /&gt;
crw-rw---- 1 root dialout 68, 1 Jan 3 2006 /dev/capi20.00&lt;br /&gt;
crw-rw---- 1 root dialout 68, 2 Jan 3 2006 /dev/capi20.01&lt;br /&gt;
crw-rw---- 1 root dialout 68, 3 Jan 3 2006 /dev/capi20.02&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
/* if the files doesn' exist use mknod for creating it*/&lt;br /&gt;
&lt;br /&gt;
and in your vps config add for directly access:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEVICES=&amp;quot;c:68:0:rw, c:68:1:rw, c:68:2:rw&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* for zaptel/zaphfc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crw-rw---- 1 root dialout 196, 0 Jan 4 2006 ctl&lt;br /&gt;
crw-rw---- 1 root dialout 196, 1 Jan 4 2006 1&lt;br /&gt;
crw-rw---- 1 root dialout 196, 2 Jan 4 2006 2&lt;br /&gt;
crw-rw---- 1 root dialout 196, 3 Jan 4 2006 3&lt;br /&gt;
crw-rw---- 1 root dialout 196, 4 Jan 4 2006 4&lt;br /&gt;
[...]&lt;br /&gt;
crw-rw---- 1 root dialout 196, 253 Jan 4 2006 timer&lt;br /&gt;
crw-rw---- 1 root dialout 196, 255 Jan 4 2006 pseudo&lt;br /&gt;
crw-rw---- 1 root dialout 196, 254 Jan 4 2006 channel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
/* if the files doesn' exist use mknod for creating it*/&lt;br /&gt;
&lt;br /&gt;
and in your vps config&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEVICES=&amp;quot;c:196:0:rw, c:196:2:rw, c:196:1:rw, c:196:253:rw,c:196:254:rw,c:196:255:rw&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if need both (capi and zaphfc)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEVICES=&amp;quot;c:68:0:rw, c:68:1:rw, c:68:2:rw c:196:0:rw, c:196:2:rw, c:196:1:rw, c:196:253:rw,c:196:254:rw,c:196:255:rw&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Asterisk_in_container_with_Debian_stable&amp;diff=3929</id>
		<title>Asterisk in container with Debian stable</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Asterisk_in_container_with_Debian_stable&amp;diff=3929"/>
		<updated>2008-01-11T14:25:10Z</updated>

		<summary type="html">&lt;p&gt;Kirshil: how to compile asterisk inside CT&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Asterisk is free and open source code to create software PBX server. See [http://www.asterisk.org] for details.&lt;br /&gt;
This package perfectly runs in side OpenVZ container. Some users run up to 60 containers with Asterisk deployed for&lt;br /&gt;
production per single hardware node. Although the easiest way to install Asterisk into container is to use pre-build package&lt;br /&gt;
from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site. &lt;br /&gt;
&lt;br /&gt;
In order to do it the following remarks are worth reading:&lt;br /&gt;
&lt;br /&gt;
Asterisk PBX server itself is compiled out of the shelf in CT provided that develop application template is installed for this CT.&lt;br /&gt;
The functionality of the resulting executable is enough to support simple VoIP telephony. &lt;br /&gt;
&lt;br /&gt;
Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package.&lt;br /&gt;
This package provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called ztdummy kernel module.  Ztdummy works like a simple metronome which is required  to synchronize multiple sound streams in case of conference call. Initially this module requires 1 kHz clock which is avail for example on all Digium cards. &lt;br /&gt;
&lt;br /&gt;
If you do not have this card (or equivalent from other vendors) as in case if you do not plan to use analog telephone lines, nothing is lost. You just need to play a little trick with Asterisk make system and HN ovz kernel. &lt;br /&gt;
First one needs to download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location&lt;br /&gt;
/usr/include/zaptel/zaptel.h in the CT where you plan to build Asterisk. This tweaks MeetMe for installation. Then you need to build&lt;br /&gt;
ztdummy.ko in HN and make it auto-loaded.&lt;br /&gt;
&lt;br /&gt;
Below is an example of how to install Asterisk into OpenVZ VE based on debian stable aka. &amp;quot;sarge&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ apt-get install asterisk&lt;br /&gt;
&lt;br /&gt;
$ nano /etc/defaults/asterisk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
change:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RUNASTERISK=no -&amp;gt; yes&lt;br /&gt;
AST_REALTIME=yes -&amp;gt; no (for realtime, you need&lt;br /&gt;
&lt;br /&gt;
$ /etc/init.d/asterisk start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
modify the config files for asterisk, and done!&lt;br /&gt;
&lt;br /&gt;
if you need capi or/and zaptel/zaphfc:&lt;br /&gt;
&lt;br /&gt;
* for capi: you need the /dev files on you hw-node and vps:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crw-rw---- 1 root dialout 68, 0 Jan 3 2006 /dev/capi20&lt;br /&gt;
crw-rw---- 1 root dialout 68, 1 Jan 3 2006 /dev/capi20.00&lt;br /&gt;
crw-rw---- 1 root dialout 68, 2 Jan 3 2006 /dev/capi20.01&lt;br /&gt;
crw-rw---- 1 root dialout 68, 3 Jan 3 2006 /dev/capi20.02&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
/* if the files doesn' exist use mknod for creating it*/&lt;br /&gt;
&lt;br /&gt;
and in your vps config add for directly access:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEVICES=&amp;quot;c:68:0:rw, c:68:1:rw, c:68:2:rw&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* for zaptel/zaphfc:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
crw-rw---- 1 root dialout 196, 0 Jan 4 2006 ctl&lt;br /&gt;
crw-rw---- 1 root dialout 196, 1 Jan 4 2006 1&lt;br /&gt;
crw-rw---- 1 root dialout 196, 2 Jan 4 2006 2&lt;br /&gt;
crw-rw---- 1 root dialout 196, 3 Jan 4 2006 3&lt;br /&gt;
crw-rw---- 1 root dialout 196, 4 Jan 4 2006 4&lt;br /&gt;
[...]&lt;br /&gt;
crw-rw---- 1 root dialout 196, 253 Jan 4 2006 timer&lt;br /&gt;
crw-rw---- 1 root dialout 196, 255 Jan 4 2006 pseudo&lt;br /&gt;
crw-rw---- 1 root dialout 196, 254 Jan 4 2006 channel&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
/* if the files doesn' exist use mknod for creating it*/&lt;br /&gt;
&lt;br /&gt;
and in your vps config&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEVICES=&amp;quot;c:196:0:rw, c:196:2:rw, c:196:1:rw, c:196:253:rw,c:196:254:rw,c:196:255:rw&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if need both (capi and zaphfc)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEVICES=&amp;quot;c:68:0:rw, c:68:1:rw, c:68:2:rw c:196:0:rw, c:196:2:rw, c:196:1:rw, c:196:253:rw,c:196:254:rw,c:196:255:rw&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Kirshil</name></author>
		
	</entry>
</feed>