出错提示“failed to leapp preupgrade”

更新时间:
复制 MD 格式

本文主要介绍在Linux操作系统迁移时,迁移任务出错提示“failed to leapp preupgrade”信息时的问题描述、问题原因及其解决方案。

问题描述

在使用SMC操作系统时,迁移任务出错提示“failed to leapp preupgrade”信息。

问题原因

可能原因如下:

  • 软件包依赖关系检查失败

  • YUM源无法访问

  • /etc/fstab挂载配置检查失败

  • /etc/vsftpd/vsftpd.conf FTP配置检查失败

  • /根目录检查失败

  • target_userspace_creator创建目标用户空间失败

解决方案

软件包依赖关系检查失败

  1. 远程连接源服务器。具体操作,请参见连接实例。

  2. 执行以下命令,在SMC客户端目录下的日志目录查看报错信息。

    查看SMC客户端目录的具体操作,请参见查看SMC客户端。示例命令如下:

    cat /smc/go2aliyun_client2.7.6_linux_x86_64/Logs/osm_prepare.log

    其中:2.7.6是SMC客户端的版本号,您需要根据实际替换。

    执行以下命令,日志存在以下报错信息。

    cat /var/log/leapp/leapp-preupgrade.log
    2024-02-21 21:29:16.543 DEBUG    PID: 31683 leapp.workflow.TargetTransactionCheck.dnf_transaction_check: Transaction check:
    2024-02-21 21:29:16.551 DEBUG    PID: 31683 leapp.workflow.TargetTransactionCheck.dnf_transaction_check:
    2024-02-21 21:29:16.559 DEBUG    PID: 31683 leapp.workflow.TargetTransactionCheck.dnf_transaction_check:  Problem: problem with installed package lynx-2.8.8-0.3.dev15.1.al7.x86_64
    2024-02-21 21:29:16.566 DEBUG    PID: 31683 leapp.workflow.TargetTransactionCheck.dnf_transaction_check:   - cannot install the best update candidate for package lynx-2.8.8-0.3.dev15.1.al7.x86_64
    2024-02-21 21:29:16.575 DEBUG    PID: 31683 leapp.workflow.TargetTransactionCheck.dnf_transaction_check:   - lynx-2.8.8-0.3.dev15.1.al7.x86_64 does not belong to a distupgrade repository
    2024-02-21 21:29:16.582 DEBUG    PID: 31683 leapp.workflow.TargetTransactionCheck.dnf_transaction_check:   - nothing provides anolis-indexhtml needed by lynx-2.8.9-4.0.1.al8.x86_64

    上述报错信息表明,更新软件包时,dnf_transaction_check阶段检查依赖关系失败。可能是仓库中缺少依赖的软件包,也可能是依赖的软件包之间存在冲突。如上述lynx包更新时仓库中找不到依赖包anolis-indexhtml。

  3. 分析报错信息中的依赖关系,卸载导致问题的软件包。例如出现上述报错后,执行以下命令,卸载lynx。

    yum remove lynx-2.8.8-0.3.dev15.1.al7.x86_64
  4. 问题排查解决后,运行SMC客户端再试。具体操作,请参见管理SMC客户端。

YUM源无法访问

  1. 远程连接源服务器。具体操作,请参见连接实例。

  2. 执行以下命令,在SMC客户端目录下的日志目录查看报错信息。

    查看SMC客户端目录的具体操作,请参见查看SMC客户端。示例命令如下:

    cat /smc/go2aliyun_client2.7.6_linux_x86_64/Logs/osm_prepare.log

    其中:2.7.6是SMC客户端的版本号,您需要根据实际情况进行替换。

    执行以下命令,日志存在以下报错信息。

    cat /var/log/leapp/leapp-preupgrade.log

    报错信息如下:

    Errors during downloading metadata for repository 'docker-ce-stable-migrate':
     - Curl error (28): Timeout was reached for https://mirrors.aliyun.com/docker-ce/linux/centos/8/x86_64/stable/repodata/repomd.xml [Connection timed out after 30000 milliseconds]
    Error: Failed to download metadata for repo 'docker-ce-stable-migrate': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
    
    Errors during downloading metadata for repository 'zabbix-migrate':
     - Curl error (28): Timeout was reached for http://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/repodata/repomd.xml [Connection timed out after 30000 milliseconds]
    Error: Failed to download metadata for repo 'zabbix-migrate': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

    上述报错信息表明,迁移过程中用到的YUM源配置文件为/etc/leapp/files/leapp_upgrade_repositories.repo,其中https://rpm.nodesource.com/pub_18.x/el/8/$basearch、http://repo.zabbix.com/zabbix/5.0/rhel/8/$basearch/、https://mirrors.aliyun.com/docker-ce/linux/centos/8/$basearch/stable

    nodejs、zabbix和docker-ce的repo仓库配置了公网地址,但是部分ECS实例无法访问公网。

  3. 根据需求,解决问题。

    • 如果ECS实例无法访问公网

      把配置文件 /etc/leapp/files/leapp_upgrade_repositories.repo 中使用的公网访问地址http://mirrors.aliyun.com/更换为VPC网络访问地址http://mirrors.cloud.aliyuncs.com/或者将无法访问的公网repo仓库配置的enabled=1修改为enabled=0。

    • 如果ECS实例无法访问VPC网络

      迁移过程中需要确保机器能够通过VPC网络访问yum源地址http://mirrors.cloud.aliyuncs.com/检查源服务器是否只有经典网络,检查DNS配置文件/etc/resolv.conf是否正常。

  4. 问题排查解决后,运行SMC客户端再试。具体操作,请参见管理SMC客户端。

/etc/fstab挂载配置检查失败

  1. 远程连接源服务器。具体操作,请参见连接实例。

  2. 执行以下命令,在SMC客户端目录下的日志目录查看报错信息。

    查看SMC客户端目录的具体操作,请参见查看SMC客户端。示例命令如下:

    cat /smc/go2aliyun_client2.7.6_linux_x86_64/Logs/osm_prepare.log

    其中:2.7.6是SMC客户端的版本号,您需要根据实际情况进行替换。

  3. 根据报错信息,检查/etc/fstab挂载配置。

    • 每个文件系统挂载项写在一行之内,不要因为参数过多而换行。

    • 每个文件系统挂载项确保是可挂载的,可通过mount -a命令测试挂载。

    • 配置文件中不要出现中文。

  4. 问题排查解决后,运行SMC客户端再试。具体操作,请参见管理SMC客户端。

/etc/vsftpd/vsftpd.conf FTP配置检查失败

  1. 远程连接源服务器。具体操作,请参见连接实例。

  2. 执行以下命令,在SMC客户端目录下的日志目录查看报错信息。

    查看SMC客户端目录的具体操作,请参见查看SMC客户端。示例命令如下:

    cat /smc/go2aliyun_client2.7.6_linux_x86_64/Logs/osm_prepare.log

    其中:2.7.6是SMC客户端的版本号,您需要根据实际情况进行替换。

    vsftpd_config_read阶段报错退出,检查/etc/vsftpd/vsftpd.conf FTP配置文件内容如下:

    # When "listen" directive is enabled, vsftpd runs in standalone mode and
    # listens on IPv4 sockets. This directive cannot be used in conjunction
    # with the listen_ipv6 directive.
    listen=NO
    #
    # This directive enables listening on IPv6 sockets. By default, listening
    # on the IPv6 "any" address (::) will accept connections from both IPv6
    # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
    # sockets. If you want that (perhaps because you want to listen on specific
    # addresses) then you must run two copies of vsftpd with two configuration
    # files.
    # Make sure, that one of the listen options is commented !!
    listen_ipv6=YES
    
    pam_service_name=vsftpd
    userlist_enable=YES
    tcp_wrappers=YES
    
    chroot_local_user=YES
    allow_writeable_chroot=YES
    
    guest_enable=YES
    guest_username=www
    virtual_use_local_privs=YES
    user_config_dir=/etc/vsftpd/vconf
    
    #被动模式
    pasv_enable=YES
    pasv_min_port=30000
    pasv_max_port=30050
    
    ssl_enable=YES
    allow_anon_ssl=YES
    force_anon_data_ssl=YES
    force_anon_logins_ssl=YES
    force_local_data_ssl=YES
    force_local_logins_ssl=YES
    ssl_tlsv1=YES
    rsa_cert_file=/etc/vsftpd/vsftpd.pem
    
    listen_port=21
  3. /etc/vsftpd/vsftpd.conf FTP配置文件中不要出现中文,删除中文。

  4. 问题排查解决后,运行SMC客户端再试。具体操作,请参见管理SMC客户端。

/根目录检查失败

  1. 远程连接源服务器。具体操作,请参见连接实例。

  2. 执行以下命令,在SMC客户端目录下的日志目录查看报错信息。

    查看SMC客户端目录的具体操作,请参见查看SMC客户端。示例命令如下:

    cat /smc/go2aliyun_client2.7.6_linux_x86_64/Logs/osm_prepare.log

    其中:2.7.6是SMC客户端的版本号,您需要根据实际情况进行替换。

    root_scanner阶段报错退出,检查/根目录下内容如下:

    [root@pro-3 /]# ll
    总用量  9488
    -rw-r--r--    1 root root 9046177 3月  18 2022 ~
    lrwxrwxrwx.   1 root root       7 7月  11 2019 bin -> usr/bin
    dr-xr-xr-x.   5 root root    4096 5月   9 2023 boot
    -rw-r--r--    1 root root  571772 5月  12 2022 check2.txt
    drwxr-xr-x    4 root root    4096 9月  14 2022 data
    drwxr-xr-x   19 root root    2960 1月  18 19:08 dev
    drwxr-xr-x.  92 root root   12288 1月  18 19:55 etc
    drwxr-xr-x    3 root root    4096 2月  25 2023 hbr
    drwxr-xr-x.   6 root root    4096 3月  11 2022 home
    lrwxrwxrwx.   1 root root       7 7月  11 2019 lib -> usr/lib
    lrwxrwxrwx.   1 root root       9 7月  11 2019 lib64 -> usr/lib64
    -rwxr-xr-x    1 root root    3956 2月  21 2022 linux_check.sh
    drwx------.   2 root root   16384 2月  21 2022 lost+found
    drwxr-xr-x.   2 root root    4096 4月  11 2018 media
    drwxr-xr-x    3 root root    4096 8月  21 2020 mnt
    drwxr-xr-x.   3 root root    4096 6月  23 2022 opt
    dr-xr-xr-x  167 root root       0 8月   9 08:39 proc
    drwxr-xr-x   31 root root    1120 1月  18 19:56 run
    lrwxrwxrwx.   1 root root       8 7月  11 2019 sbin -> usr/sbin
    drwxr-xr-x    3 root root    4096 1月  18 19:08 smc
    drwxr-xr-x.   2 root root    4096 4月  11 2018 srv
    dr-xr-xr-x   13 root root       0 8月   9 08:59 sys
    drwxr-xr-x    4 root root    4096 1月  19 10:13 test
    drwxrwxrwt.  13 root root   12288 1月  19 10:04 tmp
    -rw-r--r--    1 root root       0 10月  30 2022 UQ?J?
    drwxr-xr-x.  13 root root    4096 7月  11 2019 usr
    drwxr-xr-x.  19 root root    4096 7月  11 2019 var
    [root@pro-3 /]#
    [root@pro-3 /]#
    [root@pro-3 /]#
  3. 修改/根目录下文件名或路径名,不要出现utf-8不能解码的特殊符号。

  4. 问题排查解决后,运行SMC客户端再试。具体操作,请参见管理SMC客户端。

target_userspace_creator创建目标用户空间失败

  1. 远程连接源服务器。具体操作,请参见连接实例。

  2. 执行以下命令,在SMC客户端目录下的日志目录查看报错信息。

    查看SMC客户端目录的具体操作,请参见查看SMC客户端。示例命令如下:

    cat /smc/go2aliyun_client2.7.6_linux_x86_64/Logs/osm_prepare.log

    其中:2.7.6是SMC客户端的版本号,您需要根据实际情况进行替换。

    执行以下命令,日志中存在以下报错信息。

    cat /var/log/leapp/leapp-preupgrade.log
    2024-02-26 19:15:22.357 INFO     PID: 22700 leapp.workflow.TargetTransactionFactsCollection: Executing actor target_userspace_creator
    2024-02-26 19:15:22.454 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Creating source overlay in /var/lib/leapp/scratch with mounts in /var/lib/leapp/scratch/mounts
    2024-02-26 19:15:22.459 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Creating mount directories.
    2024-02-26 19:15:22.463 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Done creating mount directories.
    2024-02-26 19:15:22.463 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has started: ['rm', '-rf', '/var/lib/leapp/scratch/mounts/root_/upper']
    2024-02-26 19:15:22.481 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has finished: ['rm', '-rf', '/var/lib/leapp/scratch/mounts/root_/upper']
    2024-02-26 19:15:22.485 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has started: ['rm', '-rf', '/var/lib/leapp/scratch/mounts/root_/work']
    2024-02-26 19:15:22.499 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has finished: ['rm', '-rf', '/var/lib/leapp/scratch/mounts/root_/work']
    2024-02-26 19:15:22.502 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has started: ['rm', '-rf', '/var/lib/leapp/scratch/mounts/root_/system_overlay']
    2024-02-26 19:15:22.516 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has finished: ['rm', '-rf', '/var/lib/leapp/scratch/mounts/root_/system_overlay']
    2024-02-26 19:15:22.520 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has started: ['mount', '-t', 'overlay', 'overlay2', '-o', 'lowerdir=/,upperdir=/var/lib/leapp/scratch/mounts/root_/upper,workdir=/var/lib/leapp/scratch/mounts/root_/work', '/var/lib/leapp/scratch/mounts/root_/upper,workdir=/var/lib/leapp/scratch/mounts/root_upper,workdir=/var/lib/leapp/scratch/mounts/root_work', '/var/lib/leapp/scratch/mounts/root_/system_overlay']
    2024-02-26 19:15:22.532 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: mount: unknown filesystem type 'overlay'
    2024-02-26 19:15:22.536 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Command ['mount', '-t', 'overlay', 'overlay2', '-o', 'lowerdir=/,upperdir=/var/lib/leapp/scratch/mounts/root_/upper,workdir=/var/lib/leapp/scratch/mounts/root_/work', '/var/lib/leapp/scratch/mounts/root_/system_overlay'] failed with exit code 32.
    2024-02-26 19:15:22.547 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: External command has finished: ['mount', '-t', 'overlay', 'overlay2', '-o', 'lowerdir=/,upperdir=/var/lib/leapp/scratch/mounts/root_/upper,workdir=/var/lib/leapp/scratch/mounts/root_/work', '/var/lib/leapp/scratch/mounts/root_/system_overlay']
    2024-02-26 19:15:22.553 WARNING  PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Mounting /var/lib/leapp/scratch/mounts/root_/system_overlay failed with: Command ['mount', '-t', 'overlay', 'overlay2', '-o', 'lowerdir=/,upperdir=/var/lib/leapp/scratch/mounts/root_/upper,workdir=/var/lib/leapp/scratch/mounts/root_upper,workdir=/var/lib/leapp/scratch/mounts/root_work', '/var/lib/leapp/scratch/mounts/root_/system_overlay'] failed with exit code 32.
    Traceback (most recent call last):
      File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/mounting.py", line 328, in _create
        run(['mount'] + self._mount_options() + [self.target], split=False)
      File "/usr/lib/python2.7/site-packages/leapp/libraries/stdlib/__init__.py", line 188, in run
        result=result,
    CalledProcessError: Command ['mount', '-t', 'overlay', 'overlay2', '-o', 'lowerdir=/,upperdir=/var/lib/leapp/scratch/mounts/root_/upper,workdir=/var/lib/leapp/scratch/mounts/root_/work', '/var/lib/leapp/scratch/mounts/root_/system_overlay'] failed with exit code 32.
    2024-02-26 19:15:22.557 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Cleaning up mounts
    2024-02-26 19:15:22.562 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Recursively removing scratch directory /var/lib/leapp/scratch.
    2024-02-26 19:15:22.566 DEBUG    PID: 29331 leapp.workflow.TargetTransactionFactsCollection.target_userspace_creator: Recursively removed scratch directory /var/lib/leapp/scratch/
    2024-02-26 19:15:22.576 INFO     PID: 22700 leapp: Answerfile will be created at /var/log/leapp/answerfile

    上述报错信息表明,因为系统内核版本和软件包版本相对较低,而且没有加载相应的overlay驱动,导致mount报错。

  3. 执行以下命令,将系统小版本更新到CentOS 7.9,并更新内核和一些软件包版本。

    yum update
  4. 重启源服务器后,执行以下命令,检查已加载overlay驱动。

    lsmod |grep overlay
  5. 问题排查解决后,运行SMC客户端再试。具体操作,请参见管理SMC客户端。