This topic describes the cause of the "Command 'yum -y distro-sync' returned non-zero" error message that is reported when you use Server Migration Center (SMC) to migrate a Linux operating system. This topic also describes how to resolve the error.
Problem description
The "Command 'yum -y distro-sync' returned non-zero" error message is reported when a Linux operating system is being migrated by using SMC.
Cause
When you migrate a CentOS operating system to Anolis OS, the yum distro-sync command is used to reinstall the software packages on the source CentOS operating system to align with the software packages that are available in Anolis OS. The reinstallation process includes the following stages: dependency parsing for software packages, software package download, and software package installation. This command is time-consuming. If the execution of this command is interrupted due to exceptions, an error may be reported when you run the command again. In this case, the migration fails.
Solution
Troubleshoot the error based on the stage in which the execution is interrupted.
The execution is interrupted before software package installation.
If the execution is interrupted before software package installation, you can directly run the
yum distro-synccommand again. For example, if the execution is interrupted during dependency parsing or software package download, run the command again.The execution is interrupted during software package installation.
In this case, a software package conflict occurs, and an error is reported if you run the
yum distro-synccommand again. The software packages that cause conflicts vary based on the time when the execution of theyum distro-synccommand is interrupted. The following figure shows an example of the error message that is reported due to a conflict caused by the NGINX software package.
Run the following command to check the installation status of the NGINX software package for which the error is reported:
rpm -q nginxThe command output indicates that the conflict occurs because an incompatible NGINX software package from a third-party repository is installed.
Run the following command to uninstall the incompatible NGINX software package:
rpm -e nginx*If the NGINX software package fails to be uninstalled due to dependencies, uninstall the dependencies of the software package.
Run the
yum distro-synccommand to check whether an error is reported.If no error is reported, run one of the following commands to continue the migration:
Operating system migration to Anolis OS:
python3 /usr/sbin/centos2anolis.py -cOperating system migration to Alibaba Cloud Linux:
python3 /usr/sbin/centos2alinux.py -c
If an error is reported, troubleshoot the error.
After the error is resolved, run the
./go2aliyun_client --rerun --skipgrubcommand in the SMC client to retry the migration job. For more information, see View and run the SMC client.