Ref : https://bugs.openvz.org/browse/OVZ-7218
If you're using Openvz7 and recently getting the following error while creating a Openvz container :
vzpkg clean 'ubuntu-18.04-x86_64'
Can not find 'ubuntu-18.04-x86_64' EZ os template
Looking for the precreated template cache /vz/template/cache/ubuntu-18.04-x86_64.tar.gz
File "/usr/libexec/ovz-template-converter", line 36
def writeconfig(configfile, configtext, configmode=0644):
^
SyntaxError: invalid token
Error: Failed to convert the precreated cache /vz/template/cache/ubuntu-18.04-x86_64.tar.gz
Workaround: Add the following line at the beginning in /usr/libexec/ovz-template-converter file on that particular host server.
#!/usr/bin/python
Note : Also make sure factory repo (/etc/yum.repos.d/factory.repo) on the server is disabled since it is made available only for the developers and updating packages from that repo might cause package conflict issues.
If you've already installed packages from that repo , you will need to remove the packages that were installed from that repo then disable that repo and install those packages back from the stable repo i.e openvz-os.
Solution : vztt package installed from factory repo would be causing the issue, updating OS to latest stable or higher than Vz7.0-Update14 is recommended.