Lost in… migration…

VPS import in the VMmanagerOVZ 5.64.1 works without errors, as it shows in panel status and in the log files.
BUT! You can face the problems in the feature because there can be wrong file permissions inside the imported VPS.

I’ve found this issue after in the imported VPS the MySQL server can’t start. This happens because of wrong permissions for the whole mysql data directory:

# ls -la /var/lib/mysql/mysql/user*
-rw-rw---- 1 sshd postfix 10466 Feb 25  2014 /var/lib/mysql/mysql/user.frm
-rw-rw---- 1 sshd postfix   292 Feb 25  2014 /var/lib/mysql/mysql/user.MYD
-rw-rw---- 1 sshd postfix  2048 Feb 25  2014 /var/lib/mysql/mysql/user.MYI

this is because of the bug in the VMmanagerOVZ:

Aug 10 02:01:31 [23156:1] libmgr INFO id=4430c2 Run ssh command 'ssh -i /usr/local/mgr5/etc/ssh_id_rsa -o UserKnownHostsFile=/usr/local/mgr5/etc/vemgr_known_hosts [email protected] 'cd /vz/private/105 && tar czpf - *' | tar xzpf - -C /var/lib/vz/private/113' on root@yyy.yy.yy.yyy 
Aug 10 02:14:03 [23156:1] libmgr INFO id=4430c2 Ssh command finished with status 0

it uses tar command on the host machine without –numeric-owner option – in this case tar saves user/group names from the host machine.

The temporary solution for this issue:

# mv /bin/tar{,.orig}
`/bin/tar' -> `/bin/tar.orig'
# vim /bin/tar
# chmod a+x /bin/tar
# ls -la /bin/tar*
-rwxr-xr-x 1 root root    132 2016-08-13 14:21 /bin/tar
-rwxr-xr-x 1 root root 340584 2010-03-11 03:21 /bin/tar.orig
# cat /bin/tar
#!/bin/bash
if [ "${1}" = "czpf" -a "${2}" = "-" ]; then
  /bin/tar.orig --numeric-owner -czf - ${@:3}
else
  /bin/tar.orig ${@}
fi
#

Leave a Reply

Your email address will not be published. Required fields are marked *