OpenVZ CentOS template cache creation with vzpkgcache

Following the instruction over at OpenVZ Wiki, I've had no problems with the installation and creation of templates prior to CentOS-5.2 on x86_64 systems. However, with the latest set of updates to CentOS-5.2, the vzpkgcache seems to have been broken as sysklogd is no longer being installed by default. Below is how I got it to work:

Note: edit /vz/template/centos/5/x86_64/config/minimal.list and append .x86_64 to all except for the addons packages. Then run:

# vzpkgcache -f centos-5-x86_64-minimal

which gives the below error at the end:

sed: can't read /etc/init.d/syslog: No such file or directory
ERROR: Script install-post failed

The solution was to edit "/vz/template/centos/5/x86_64/config/install-post" and set syslog and syslog.conf sed replacements with exit status of "0".

# Disable klogd
$VZCTL exec2 $VEID \
        "sed -i -e 's/daemon\\ klogd/passed\\ klogd\\ skipped/' \
                -e 's/killproc\\ klogd/passed\\ klogd\\ skipped/' \
                        /etc/init.d/syslog; exit 0"
...
# Disable fsync() in syslog
$VZCTL exec2 $VEID \
        "sed -i -e 's@\\\([[:space:]]\\\)\\\(/var/log/\\\)@\\\1-\\\2@' \
                /etc/syslog.conf; exit 0"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

vzpkgcache rpm module for 64 bit OS

vzpkgcache requires the below packages, else it will complain about "_rpm" module missing:

vzrpm44-python-4.4.1-22.5
vzrpm43-4.3.3-7_nonptl.6
vzrpm44-4.4.1-22.5
vzrpm43-python-4.3.3-7_nonptl.6

The above are all i386 packages. So on a 64 bit OS, vzrpm python needs to be fixed by copying over the appropriate rpm module:

For python-2.4:

cp /usr/lib64/python2.4/site-packages/rpm/_rpmmodule.so /usr/share/vzpkgtools/vzrpm44/lib/python2.4/site-packages/rpm/

Reference: wiki.openvz.org

Disable kernel logger from starting up in OpenVZ container

Edit /etc/init.d/rsyslog and comment out start and stop of rklogd (kernel logger which is not required in VE).

        echo
        echo -n $"Starting kernel logger: "
        #daemon rklogd $KLOGD_OPTIONS
        passed rklogd skipped $KLOGD_OPTIONS
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rsyslog
        return $RETVAL
}
stop() {
        echo -n $"Shutting down kernel logger: "
        #killproc rklogd
        passed rklogd skipped
        echo

Comment