Porting Templates / Migrating OpenVZ Containers across PVE 1.x and PVE 2.x

From Proxmox VE
Jump to: navigation, search

Due to recent (Jan 2013) changes in Console Access in PVE 2.x the following use cases need attention:

  • Backing up from PVE 1.x and restoring to PVE 2.x or vice versa
  • Deploying / Migrating OpenVZ containers based on OpenVZ templates designed for PVE 1.x (OpenVZ.org supplied templates and ProxmoxVE 1.x Templates) in PVE 2.x and viceversa
  • The OpenVZ team decided to do not include the init logger code. Hence PVE 2.2 onwards now use the official OpenVZz solution for the console.

OpenVZ Template Design Issues in DAB

pveversion | cut -d/ -f2

on the host yields 1.9 for PVE 1.9 and 2.2 for PVE 2.2 and may be used to determine the host in which the template is being made in DAB.

A way to determine the PVE version of the host from within the OpenVZ Container would be useful.

Startup Scripts

  • init rc was switched to insserv before PVE 1.9 itself and continues to be so in PVE 2.x


Recently (Jan 2013) PVE 2.2 switched to using the new Console Access method that uses a Virtualised a TTY Console. This requires the appending of the following line to the file /etc/inittab in the template and the recent versions of DAB do so without change to the DAB code - possibly through one of the debs / rpms.

1:2345:respawn:/sbin/getty 38400 tty1

Although many hacks have been found where code appended to the /etc/inittab have been the entry point, in this case it is intentional.

For PVE 1.x hosts, the OpenVZ containers should comment out the said line if present.

Error if not corrected in PVE 1.x

If the said corrections are not carried out, then the following will show up in the container logs and taken from:

# cat /var/log/syslog
Jan 29 17:38:13 myvmname init: Id "1" respawning too fast: disabled for 5 minutes

If not corrected in PVE 2.x

The new console access feature will not be available if the said line is absent in the /etc/inittab file.

Usage in DAB Makefile for PVE 1.x

sed -e 's/^\s*1:2345:respawn/# 1:2345:respawn/' -i ${BASEDIR}/etc/inittab

The above maybe placed just before the dab finalize statement.

Migration Issues for OpenVZ Containers

As there is no way currently to determine the PVE version of the host, the OpenVZ container to be migrated should have it's /etc/inittab corrected as above before switching it on in the target host.

If the OpenVZ container is running and the above change was made in the /etc/inittab file, then the following can be run to re-initialise the container:

telinit q