Editing Creating OpenVZ LiveCD based on Centos 4.4
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 28: | Line 28: | ||
This part contains detailed description of LiveCD creation. I've removed the output of some | This part contains detailed description of LiveCD creation. I've removed the output of some | ||
commands in order to simplify the reading. | commands in order to simplify the reading. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Creating booted LiveCD root filesystem === | === Creating booted LiveCD root filesystem === | ||
Line 85: | Line 75: | ||
# cp mksquashfs /usr/bin/ | # cp mksquashfs /usr/bin/ | ||
− | # cd | + | # cd ~/workbench/ |
# wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz | # wget http://belnet.dl.sourceforge.net/sourceforge/squashfs/squashfs3.2-r2.tar.gz | ||
# tar xzf squashfs3.2-r2.tar.gz | # tar xzf squashfs3.2-r2.tar.gz | ||
Line 93: | Line 83: | ||
cc unsquashfs.o -lz -o unsquashfs | cc unsquashfs.o -lz -o unsquashfs | ||
# cp unsquashfs /usr/bin/ | # cp unsquashfs /usr/bin/ | ||
− | # cd | + | # cd ~/workbench |
</pre> | </pre> | ||
Well, having the intruments in hand, why not extract the images? Create a directory, called <tt>livecd-root</tt>, | Well, having the intruments in hand, why not extract the images? Create a directory, called <tt>livecd-root</tt>, | ||
Line 102: | Line 92: | ||
# mkdir livecd-root | # mkdir livecd-root | ||
− | # | + | # unsquashfs ovz-livecd/base/bin.mo |
− | + | # mv squashfs-root/bin/ livecd-root/ | |
− | + | # rm -rf squashfs-root | |
− | + | ||
− | + | # unsquashfs ovz-livecd/base/etc.mo | |
− | + | # mv squashfs-root/etc/ livecd-root/ | |
+ | # rm -rf squashfs-root | ||
+ | |||
+ | # unsquashfs ovz-livecd/base/lib.mo | ||
+ | # mv squashfs-root/lib/ livecd-root/ | ||
+ | # rm -rf squashfs-root | ||
+ | |||
+ | # unsquashfs ovz-livecd/base/root.mo | ||
+ | # mv squashfs-root/root/ livecd-root/ | ||
+ | # rm -rf squashfs-root | ||
+ | |||
+ | # unsquashfs ovz-livecd/base/sbin.mo | ||
+ | # mv squashfs-root/sbin/ livecd-root/ | ||
+ | # rm -rf squashfs-root | ||
− | + | # unsquashfs ovz-livecd/base/usr.mo # this action takes some time, be patient ;) | |
+ | # mv squashfs-root/usr/ livecd-root/ | ||
+ | # rm -rf squashfs-root | ||
+ | # unsquashfs ovz-livecd/base/var.mo | ||
+ | # mv squashfs-root/var/ livecd-root/ | ||
+ | # rm -rf squashfs-root | ||
+ | </pre> | ||
Yet we have nearly complete root filesystem of '''booted''' LiveCD in <tt>livecd-root</tt> directory. However some things | Yet we have nearly complete root filesystem of '''booted''' LiveCD in <tt>livecd-root</tt> directory. However some things | ||
are missing, and I guess you know what are they: <tt>/dev</tt>, <tt>/proc</tt>, <tt>/sys</tt>, <tt>/tmp</tt> and <tt>/boot</tt> directories. We need them, because some tools (<tt>rpm</tt>, <tt>bash</tt>, ...) will not work without them in chrooted environment later. | are missing, and I guess you know what are they: <tt>/dev</tt>, <tt>/proc</tt>, <tt>/sys</tt>, <tt>/tmp</tt> and <tt>/boot</tt> directories. We need them, because some tools (<tt>rpm</tt>, <tt>bash</tt>, ...) will not work without them in chrooted environment later. | ||
<pre> | <pre> | ||
− | # | + | # mkdir root/dev |
− | + | # cp -a /dev/* root/dev | |
− | # cp -a /dev/* dev | + | # mkdir root/proc |
− | # mkdir proc | + | # mount -t proc proc root/proc/ |
− | # mount -t proc proc proc/ | + | # mkdir root/sys |
− | # mkdir sys | + | # mount -t sysfs sysfs root/sys/ |
− | # mount -t sysfs sysfs sys/ | + | # mkdir root/tmp |
− | # mkdir tmp | + | # mkdir root/boot |
− | # mkdir boot | ||
− | |||
</pre> | </pre> | ||
− | That's it. We have ''' | + | That's it. We have '''booted''' LiveCD root filesystem in <tt>livecd-root</tt> directory. |
Now we can <tt>chroot</tt> in this directory and install all needed packages. But what | Now we can <tt>chroot</tt> in this directory and install all needed packages. But what | ||
packages do we need? | packages do we need? | ||
Line 235: | Line 242: | ||
kernel of version other then 2.6.18 one is summarized below. | kernel of version other then 2.6.18 one is summarized below. | ||
==== Peculiarities of building 2.6.9-rhel4 ==== | ==== Peculiarities of building 2.6.9-rhel4 ==== | ||
− | * You should also include this | + | * You should also include this path (http://git.openvz.org/?p=linux-2.6.18-openvz;a=commit;h=681d0b65dedd54d8c716cef56418ac1a478f94da) |
in building process. Hopefully will be fixed in <tt>2.6.9-044stab044.8</tt> kernel. | in building process. Hopefully will be fixed in <tt>2.6.9-044stab044.8</tt> kernel. | ||
* Use <tt>unionfs 1.0.14</tt>, but not <tt>unionfs 1.1.5</tt>, as offered at its official site! | * Use <tt>unionfs 1.0.14</tt>, but not <tt>unionfs 1.1.5</tt>, as offered at its official site! | ||
* Small problems while building <tt>unionfs</tt>: arguments of <tt>vfs_permissions()</tt>. Just add <tt>NULL</tt> | * Small problems while building <tt>unionfs</tt>: arguments of <tt>vfs_permissions()</tt>. Just add <tt>NULL</tt> | ||
to appropriate places. | to appropriate places. | ||
− | |||
==== Peculiarities of building 2.6.18-rhel5 ==== | ==== Peculiarities of building 2.6.18-rhel5 ==== | ||
* Note, <tt>squashfs</tt> patch is already there, but you should use <tt>3.2</tt>! :) | * Note, <tt>squashfs</tt> patch is already there, but you should use <tt>3.2</tt>! :) | ||
Line 246: | Line 252: | ||
==== Peculiarities of building 2.6.20 ==== | ==== Peculiarities of building 2.6.20 ==== | ||
− | * | + | * FIXME |
− | |||
=== Unionfs kernel module === | === Unionfs kernel module === | ||
Line 346: | Line 351: | ||
<tt>tetex</tt>, <tt>latex</tt>, <tt>k3b</tt> and printing related packages: | <tt>tetex</tt>, <tt>latex</tt>, <tt>k3b</tt> and printing related packages: | ||
<pre> | <pre> | ||
− | # cp -r to_booted_livecd/ | + | # cp -r to_booted_livecd/ root/tmp/ |
− | # chroot | + | # chroot root/ |
# rpm -e lksctp-tools-1.0.2-6.4E.1.i386 | # rpm -e lksctp-tools-1.0.2-6.4E.1.i386 | ||
Line 387: | Line 392: | ||
Clean it: | Clean it: | ||
<pre> | <pre> | ||
− | # rm | + | # rm root/root/.bash_history |
</pre> | </pre> | ||
Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment | Here we have to make one step to workaround [[Checkpointing and live migration]] problem. The thing is that at the moment | ||
Line 398: | Line 403: | ||
on this directory: | on this directory: | ||
<pre> | <pre> | ||
− | mkdir | + | mkdir root/vz/private/ |
</pre> | </pre> | ||
At the moment vzquota doesn't support <tt>tmpfs</tt> ([http://bugzilla.openvz.org/show_bug.cgi?id=558 Bug #558]). | At the moment vzquota doesn't support <tt>tmpfs</tt> ([http://bugzilla.openvz.org/show_bug.cgi?id=558 Bug #558]). | ||
Line 412: | Line 417: | ||
<pre> | <pre> | ||
# rm -f ovz-livecd/base/*.mo | # rm -f ovz-livecd/base/*.mo | ||
− | # | + | # mksquashfs root/lib/ ovz-livecd/base/bin.mo -keep-as-directory |
− | + | # mksquashfs root/etc/ ovz-livecd/base/etc.mo -keep-as-directory | |
− | + | # mksquashfs root/lib/ ovz-livecd/base/lib.mo -keep-as-directory | |
+ | # mksquashfs root/root/ ovz-livecd/base/root.mo -keep-as-directory | ||
+ | # mksquashfs root/sbin/ ovz-livecd/base/sbin.mo -keep-as-directory | ||
+ | # mksquashfs root/usr/ ovz-livecd/base/usr.mo -keep-as-directory # it can take long... | ||
+ | # mksquashfs root/var/ ovz-livecd/base/var.mo -keep-as-directory | ||
+ | # mksquashfs root/vz/ ovz-livecd/base/vz.mo -keep-as-directory | ||
</pre> | </pre> | ||
Line 422: | Line 432: | ||
than 8 characters) to kernel image, otherwise <tt>isolinux</tt> will not see it. | than 8 characters) to kernel image, otherwise <tt>isolinux</tt> will not see it. | ||
<pre> | <pre> | ||
− | # cp | + | # cp root/boot/vmlinuz-2.6.18-ovz028stab035.1-smp ovz-livecd/boot/ovz18 |
</pre> | </pre> | ||
Modify initrd image. More precisely, we need to add OpenVZ kernel modules there | Modify initrd image. More precisely, we need to add OpenVZ kernel modules there | ||
Line 439: | Line 449: | ||
# mount -o loop initrd-old mount-old/ | # mount -o loop initrd-old mount-old/ | ||
# dd if=/dev/zero of=initrd bs=1048576 count=100 | # dd if=/dev/zero of=initrd bs=1048576 count=100 | ||
− | |||
− | |||
− | |||
− | |||
# mkdir mount | # mkdir mount | ||
# mount -o loop initrd mount/ | # mount -o loop initrd mount/ | ||
Line 451: | Line 457: | ||
Copy modules to initrd: | Copy modules to initrd: | ||
<pre> | <pre> | ||
− | # cp -r ../ | + | # cp -r ../root/lib/modules/2.6.18-ovz028stab035.1-smp/ mount/lib/modules/ |
# rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build # we don't neet it on initrd image | # rm -rf mount/lib/modules/2.6.18-ovz028stab035.1-smp/build # we don't neet it on initrd image | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules. | initrd image, that goes with Centos 4.4 LiveCD doesn't load cdrom kernel modules. | ||
It works well for CentOS kernel, because cdrom support is built-in there. | It works well for CentOS kernel, because cdrom support is built-in there. | ||
Line 494: | Line 497: | ||
# umount mount/ | # umount mount/ | ||
# gzip initrd | # gzip initrd | ||
− | # cp initrd.gz ../ovz-livecd/boot/initrd.gz | + | # /bin/cp initrd.gz ../ovz-livecd/boot/initrd.gz |
# cd .. | # cd .. | ||
</pre> | </pre> | ||
Line 524: | Line 527: | ||
Also '''don't forget''' to change <tt>ramdisk_size</tt> to 102400 for all kernels including Centos 4.4 default! | Also '''don't forget''' to change <tt>ramdisk_size</tt> to 102400 for all kernels including Centos 4.4 default! | ||
− | And I suggest to remove <tt> | + | And I suggest to remove <tt>quite</tt> parameter, to see what happens: it will help greatly if some problem will happen. |
=== Embellishment === | === Embellishment === | ||
Line 558: | Line 561: | ||
console=ttyS0,115200 console=tty | console=ttyS0,115200 console=tty | ||
</pre> | </pre> | ||
− | |||
− | |||
== External Links == | == External Links == | ||
Line 567: | Line 568: | ||
* [http://squashfs.sourceforge.net/ squashfs website] | * [http://squashfs.sourceforge.net/ squashfs website] | ||
* [http://www.filesystems.org/project-unionfs.html uninonfs official homepage] | * [http://www.filesystems.org/project-unionfs.html uninonfs official homepage] | ||
− | |||
− | |||
− |