Error message: “Command 'yum -y distro-sync' returned non-zero”

更新时间:
复制 MD 格式

This topic describes the issue description, root cause, and solution when you receive the error message “Command 'yum -y distro-sync' returned non-zero” during Linux operating system migration.

Issue description

During SMC operating system migration, the migration task fails with the error message “Command 'yum -y distro-sync' returned non-zero”.

Root cause

Migrating to Anolis OS uses the yum distro-sync mechanism. This command reinstalls all CentOS-provided packages on your current system with packages from the Anolis OS repository. The process involves parsing package dependencies, downloading packages, and installing them. It takes a long time to complete. If this command is interrupted unexpectedly, running it again will immediately fail and stop the migration.

Solution

  1. If yum distro-sync is interrupted unexpectedly, examine the issue based on the stage at which the command was running.

    • Interrupted before the upgrade process starts

      If the interruption occurs during dependency parsing or package downloading—but before package installation begins—you can run yum distro-sync again, and it will work normally.

    • Interrupted during package installation

      Package conflicts may occur. Running yum distro-sync again will show an error. The specific error and affected packages depend on when the command was interrupted. This example uses the following error message.

      image

      1. Run the following command to check how the nginx package is installed on your system.

        rpm -q nginx

        The query shows that nginx from a third-party repository is installed, causing incompatibility and conflict.

      2. Run the following command to uninstall the incompatible nginx packages from the third-party repository.

        rpm -e nginx*

        If uninstallation fails due to dependencies, uninstall those dependencies as well.

      3. Run yum distro-sync to check for errors.

        • If the command runs successfully, continue the migration by running one of the following commands.

          • When migrating to Anolis OS

            python3 /usr/sbin/centos2anolis.py -c
          • When migrating to Alibaba Cloud Linux

            python3 /usr/sbin/centos2alinux.py -c
        • If the error persists, continue troubleshooting the reported issue.

  2. After resolving the issue, see Manage SMC client and run the SMC client command ./go2aliyun_client --rerun --skipgrub to retry.