Unable to start init, probably incorrect template error in OpenVZ Error
Posted on December 13th, 2016
In this tutorial we can learn how to fix the error – “Unable to start init, probably incorrect template error in OpenVZ”
OpenVZ is an operating system-level virtualization technology for Linux. It allows Multiple isolated operating system instances, called containers/Virtual Private Servers(VPS)/Virtual Environments(VE) to run on a single physical server.
The first action the Linux kernel performs is to execute init program. Init (short for initialization) is a daemon process that continues running until the system is shutdown. The kernel, once it is loaded, finds init in sbin and executes it. When init starts, it becomes the parent/root for all processes executing on Linux. The first thing init does, is reading its initialization file located in /etc/inittab and sets the default runlevel. A runlevel is a configuration of processes and inittab describes how the system should be set up in each runlevel. To know the default runlevel enter the below command.
—[root@bee test]# who -r
run-level 3 Nov 25 09:28
Unable to start init, probably incorrect template
You may receive an error “Unable to start init, probably incorrect template” starting/restarting an OpenVZ VPS. The “incorrect template” issue usually occurs when the init file on the VPS is missing. Here is an example of the error displayed when starting an OpenVZ container.
—[root@bee Openvz11 ~]# vzctl start 9163
—Container is mounted
—Adding IP address(es): 220.127.116.11
—Setting CPU limit: 200
—Setting CPU units: 1000
—Setting CPUs: 2
—Unable to start init, probably incorrect template
—Container start failed
—Killing container …
—Container was stopped
—Container is unmounted
How to fix it?
What distro is the OS Template of?
The first thing to be done is to identify the OS template. An OS template is a set of packages from some Linux distributions used to populate a container. Multiple OS templates are available in OpenVZ. To identify the OS template, use the command below.
Where, 9163 —> container ID
In the output of the above command spot the line that mentions the ‘OSTEMPLATE’, which tells what is the default OS template. For example, assume “ubuntu-13.04-x86_64” is my OSTEMPLATE.
Search init file
The init file resides under /sbin by default. Every OpenVZ container has a private directory in which container private details are stored. To check for the init file use the command below.
Where, 9163 —> container ID
If the init file is missing or the file size is zero, your VPS will not start.
This issue can be fixed in two ways, you may follow any method
1) Copy the init file from a different VPS using the same OS template. To perform this use the below command
—cp /vz/root/9758/sbin/init /vz/private/9163/sbin/
Where, 9758 —> container ID of another VPS
2) You can untar the OS template located under /vz/template/cache/ directory and copy the init file from there.
—tar -zxvf /vz/template/cache/os_template.tar.gz
—cp /vz/template/cache/sbin/init /vz/private/9163/sbin/
Start the VPS
You will be able to start your VPS once everything beforehand has been completed.
To start the VPS, use the below command
—vzctl start 9163
If you need any further assistance please contact our support department.