October 6, 2008

OpenVZ - sed error

Here is a quick fix on how I was able once to fix an OpenVZ virtualization node, when trying to emulate a container.

If during vzctl create … you meet this kind of error

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

Here is how you may fix it:

vi /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"

Try now :-)