Tag Archives: OpenVZ

Convert OpenVZ to LXC


Convert OpenVZ VM to LXC VM

Install same version lxc OS
lxc launch ubuntu:20.04 lxc-server
lxc stop lxc-server

rm -rf /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs
mkdir /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs

On Ubuntu 20.04 OpenVZ VM run:
rsync -avz -e ssh --exclude=etc/inittab --exclude=etc/network/interfaces --exclude=dev/ --exclude=sys/ --exclude=proc/ / [email protected]:/var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/

vim /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/etc/network/interfaces
auto lo
iface lo inet loopback
source /etc/network/interfaces.d/*.cfg

mkdir /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/etc/network/interfaces.d/
vim /var/snap/lxd/common/lxd/storage-pools/default/containers/lxc-server/rootfs/etc/network/interfaces.d/eth0.cfg
# The primary network interface
auto eth0
iface eth0 inet dhcp

lxc start lxc-server

For sure you need to stop MySQL/PostgreSQL before rsync or if huge database you can resync database after syncing data from OpenVZ server

Failed to register the CT: PRL_ERR_VZCTL_OPERATION_FAIL

Failed to register the CT: PRL_ERR_VZCTL_OPERATION_FAILED (Details: Creating OS template cache for centos-8-x86_64 template
Can’t open /proc/sys/kernel/virt_osrelease: No such file or directory
Error: /usr/share/vzyum/bin/yum failed, exitcode=1
VE_PRIVATE is not set
Creation of Container private area failed

Make sure you are using vz7 kernel:
uname -a | grep vz7
Linux CentOS-78-64-minimal 3.10.0-1127.8.2.vz7.151.14 #1 SMP Tue Jun 9 12:58:54 MSK 2020 x86_64 x86_64 x86_64 GNU/Linux

converting CentOS 7 to VZ7

centos install virtuozzo
yum install epel-release
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/p/python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/o/openvz-release-7.0.14-3.vz7.x86_64.rpm
yum localinstall openvz-release-7.0.14-3.vz7.x86_64.rpm python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm

wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/r/readykernel-scan-0.11-1.vl7.noarch.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/z/zstd-1.4.4-1.vl7.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/v/vzlinux-release-7-1.vl7.90.x86_64.rpm

mv /etc/yum.repos.d/CentOS-* /root/

rpm -e --nodeps --justdb json-c
yum erase jansson
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/jansson-2.10-1.vl7.1.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/json-c-0.11-13.vl7.1.x86_64.rpm

yum localinstall jansson-2.10-1.vl7.1.x86_64.rpm
yum localinstall json-c-0.11-13.vl7.1.x86_64.rpm
yum install prlctl prl-disp-service vzkernel *ploop*
yum update

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : Virtuozzo (3.10.0-1127.18.2.el7.x86_64) 7.0.14
1 : Virtuozzo (3.10.0-1127.8.2.vz7.151.14) 7.0.14
2 : Virtuozzo (3.10.0-1127.8.2.el7.x86_64) 7.0.14
3 : Virtuozzo (0-rescue-9063ac396d784f4c997ceacdd0590c25) 7.0.14

grub2-set-default 1
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

#OVZ templates
yum install *ez.noarch

Restarting network (via systemctl): Job for network.service canceled

service network restart
Restarting network (via systemctl): Job for network.service canceled.
[FAILED]

systemctl restart network
Job for network.service canceled.

If cyberpanel server network is down (venet0: mtu 1500 qdisc noop state DOWN) after server reboot, make sure:

vi /etc/fstab
#/usr/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0
#/tmp /var/tmp none bind 0 0

service network restart
Restarting network (via systemctl):
[ OK ]

Error: unsupported deleted submount: (deleted)/dev/log

Setting up checkpoint…
set CPU flags..
suspend…
Can not suspend container: Invalid argument
Error: unsupported deleted submount: (deleted)/dev/log
Checkpointing failed
Error in run_cmd (pcopy.c:334): Command date ‘+%s.%N’ > /tmp/tmp.sJn0B2zf0e; vzctl –skiplock chkpnt 31581 –suspend –flags 161183 1>&2 failed with code 16
Error: ploop copy -s /dev/ploop45973 failed
Error: Failed to copy top ploop delta
Killed by signal 15.

To find issue:
grep /dev/log /proc/*/mountinfo 2>/dev/null
/proc/20518/mountinfo:259 239 0:85 /log /dev/log rw,nosuid,relatime shared:161 – devtmpfs devtmpfs rw,size=1792000k,nr_inodes=448000,mode=755

lsof -p 20518
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 30264 mysql cwd DIR 182,735569 4096 5768267 /var/lib/mysq

Too many open files in system openvz

id: cannot find name for user ID 0
-bash: cannot make pipe for command substitution: Too many open files in system
-bash: /etc/profile.d/less.sh: Too many open files in system
-bash: /etc/profile.d/mc.sh: Too many open files in system
-bash: /etc/profile.d/vim.sh: Too many open files in system
-bash: /etc/profile.d/which-2.sh: Too many open files in system
-bash: /root/.bash_profile: Too many open files in system
-bash-3.2# logout
-bash: /root/.bash_logout: Too many open files in system
-bash: /etc/bash.bash_logout: Too many open files in system
exited from CT XXXX

Fast fix:
vzctl restart XXXX

Error in e2fsck (fsutils.c:288): e2fsck failed (exit code 4)

vzctl mount XXXX
Opening delta /vz/private/XXXX/root.hdd/root.hdd
Adding delta dev=/dev/ploopXXXX img=/vz/private/XXXX/root.hdd/root.hdd (rw)

/dev/ploop15649p1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
(i.e., without -a or -p options)
Error in e2fsck (fsutils.c:288): e2fsck failed (exit code 4)

Failed to mount image: Error in e2fsck (fsutils.c:288): e2fsck failed (exit code 4)
[41]

ploop check -F /vz/private/CID/root.hdd/root.hdd
ploop mount /vz/private/CID/root.hdd/DiskDescriptor.xml
fdisk -l /dev/ploopXXXXX
e2fsck -y /dev/ploopXXXX

ploop umount /vz/private/XXXX/root.hdd/DiskDescriptor.xm

Error: Package: kmod-kvdo vdo ( Requires: kernel dm_put_device)

Error: Package: kmod-kvdo-6.1.0.181-17.el7_5.x86_64 (updates)
Requires: kernel(dm_unregister_target) = 0x35ba4186
Installed: kernel-3.10.0-862.el7.x86_64 (@anaconda)
kernel(dm_unregister_target) = 0x62b8c739
Installed: vzkernel-3.10.0-862.9.1.vz7.63.3.x86_64 (@openvz-os)
kernel(dm_unregister_target) = 0x97f3d3e0
Available: kernel-debug-3.10.0-862.el7.x86_64 (base)
kernel(dm_unregister_target) = 0x9fea9142
Available: kernel-debug-3.10.0-862.2.3.el7.x86_64 (updates)
kernel(dm_unregister_target) = 0x9fea9142
Available: kernel-debug-3.10.0-862.3.2.el7.x86_64 (updates)
kernel(dm_unregister_target) = 0x9fea9142
Available: kernel-debug-3.10.0-862.3.3.el7.x86_64 (updates)
kernel(dm_unregister_target) = 0x9fea9142
Available: kernel-debug-3.10.0-862.6.3.el7.x86_64 (updates)
kernel(dm_unregister_target) = 0xe573fa0d
Available: kernel-debug-3.10.0-862.9.1.el7.x86_64 (updates)
kernel(dm_unregister_target) = 0xe573fa0d
Available: kernel-debug-3.10.0-862.11.6.el7.x86_64 (updates)
kernel(dm_unregister_target) = 0xe573fa0d
Available: vzkernel-debug-3.10.0-862.9.1.vz7.63.3.x86_64 (openvz-os)
kernel(dm_unregister_target) = 0x854b76de
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

Fix:

yum --disablerepo=* --enablerepo=base install vdo kmod-kvdo