Difference between revisions of "OpenSUSE template creation"
(Added instructions about /dev/console) |
|||
(11 intermediate revisions by 4 users not shown) | |||
Line 24: | Line 24: | ||
</pre> | </pre> | ||
− | + | === Fix console redirect === | |
+ | |||
+ | Open <code>etc/init.d/halt</code> script and replace the following lines: | ||
+ | <pre> | ||
+ | # Redirect our mesages to default console | ||
+ | test -n "$REDIRECT" && exec 0<> $REDIRECT 1>&0 2>&0 | ||
+ | </pre> | ||
+ | with this one (note <code>|| true</code> at the end): | ||
+ | <pre> | ||
+ | # Redirect our mesages to default console | ||
+ | test -n "$REDIRECT" && exec 0<> $REDIRECT 1>&0 2>&0 || true | ||
+ | </pre> | ||
+ | |||
+ | The reason is that this redirect fails with permission denied in OpenVZ environment if <code>$REDIRECT</code> is console device (<code>/dev/console</code>). As a result, script terminates with error (because of <code>set +e</code> at the beginning) and the box is not stopped properly. | ||
+ | |||
+ | As an option, you can replace console device with regular file: | ||
+ | |||
<pre> | <pre> | ||
rm lib/udev/devices/console ; touch lib/udev/devices/console | rm lib/udev/devices/console ; touch lib/udev/devices/console | ||
+ | </pre> | ||
+ | |||
+ | === Make df working === | ||
+ | <pre> | ||
+ | rm -f etc/mtab | ||
+ | ln -s /proc/mounts etc/mtab | ||
</pre> | </pre> | ||
Line 35: | Line 57: | ||
== Disable boot.klog == | == Disable boot.klog == | ||
− | For some reason, <code>klogd</code> hangs when tries to retrieve kernel log. You need to disable it. Simply delete <code>etc/rc.d/boot.d/ | + | For some reason, <code>klogd</code> hangs when tries to retrieve kernel log. You need to disable it. Simply delete <code>etc/rc.d/boot.d/S*boot.klog</code> |
== Create OS template == | == Create OS template == | ||
− | |||
Create OS template cache by invoking the following command: | Create OS template cache by invoking the following command: | ||
− | + | tar --numeric-owner -czf /vz/template/cache/opensuse-10.3-i386-default.tar.gz ./ | |
− | tar -czf /vz/template/cache/opensuse-10.3-i386-default.tar.gz ./ | ||
− | |||
{{Note|For Debian-based host you should put the archive inside <code>/var/lib/vz/template/cache</code>}} | {{Note|For Debian-based host you should put the archive inside <code>/var/lib/vz/template/cache</code>}} | ||
+ | |||
+ | |||
+ | == startproc troubleshooting == | ||
+ | |||
+ | It was noted that <code>startproc</code> under recent OpenVZ kernels sometimes fails with errors like <code>startproc: cannot stat /proc/1128/exe: Permission denied</code>. See http://openvz.org/pipermail/devel/2008-January/010278.html and follow-ups for workaround. | ||
[[Category: HOWTO]] | [[Category: HOWTO]] | ||
[[Category: Templates]] | [[Category: Templates]] |
Latest revision as of 13:58, 27 January 2011
Instructions manually create a minimal openSUSE 10.3 template.
Contents
Prerequisites[edit]
You need running openSUSE 10.3 installation.
Creating template[edit]
Preparing the base system[edit]
Run yast2
on your openSUSE 10.3 installation (this does not have to be your OpenVZ HN, you can prepare cache on one box and put it on your OpenVZ HN). Proceed with Software->Installation into directory
option. It is assumed that this directory is current directory in following instructions (unless otherwise stated).
Create device nodes[edit]
I suggest creating all required nodes directly in the lib/udev/devices/
, in that case you don't have to disable udev in startup scripts.
Execute the following commands to create device files:
mknod -m 666 lib/udev/devices/full c 1 7 mknod -m 600 lib/udev/devices/initctl p mknod -m 666 lib/udev/devices/random c 1 8 mknod -m 444 lib/udev/devices/urandom c 1 9
Fix console redirect[edit]
Open etc/init.d/halt
script and replace the following lines:
# Redirect our mesages to default console test -n "$REDIRECT" && exec 0<> $REDIRECT 1>&0 2>&0
with this one (note || true
at the end):
# Redirect our mesages to default console test -n "$REDIRECT" && exec 0<> $REDIRECT 1>&0 2>&0 || true
The reason is that this redirect fails with permission denied in OpenVZ environment if $REDIRECT
is console device (/dev/console
). As a result, script terminates with error (because of set +e
at the beginning) and the box is not stopped properly.
As an option, you can replace console device with regular file:
rm lib/udev/devices/console ; touch lib/udev/devices/console
Make df working[edit]
rm -f etc/mtab ln -s /proc/mounts etc/mtab
Disable parallel startup of services[edit]
Set RUN_PARALLEL
variable in <DIRINSTALL>/etc/sysconfig/boot
to "no".
Disable boot.klog[edit]
For some reason, klogd
hangs when tries to retrieve kernel log. You need to disable it. Simply delete etc/rc.d/boot.d/S*boot.klog
Create OS template[edit]
Create OS template cache by invoking the following command:
tar --numeric-owner -czf /vz/template/cache/opensuse-10.3-i386-default.tar.gz ./
Note: For Debian-based host you should put the archive inside /var/lib/vz/template/cache
|
startproc troubleshooting[edit]
It was noted that startproc
under recent OpenVZ kernels sometimes fails with errors like startproc: cannot stat /proc/1128/exe: Permission denied
. See http://openvz.org/pipermail/devel/2008-January/010278.html and follow-ups for workaround.