排查 Azure Linux 虚拟机中的 SLES 迁移问题

适用于:✔️ Linux VM

本文讨论在 SUSE Linux Enterprise 服务器 (SLES) 迁移期间发生的问题,并为其提供解决方案。

注意

遵循本文中的过程会导致数据平面与 虚拟机(VM)的控制平面 断开连接。 Azure 功能(如自动来宾修补自动 OS 映像升级热修补Azure 更新管理器)不可用。 若要利用这些功能,建议使用首选操作系统创建新的 VM,而不是执行就地升级。

先决条件

检查 VM 的代系版本

可以使用以下方法之一检查生成版本:

  • 在 SLES 终端中运行以下命令:

    sudo dmidecode | grep -i hyper
    

    如果是第 1 代 VM,则不返回任何输出。

    如果是第 2 代 VM,可以看到如下所示的输出:

    Version: Hyper-V UEFI Release v4.1
    Version: Hyper-V UEFI Release v4.1
    Version: Hyper-V UEFI Release v4.1
    Version: Hyper-V UEFI Release v4.1
    
  • Azure 门户中,转到 VM 属性,然后检查 VM 生成字段,如下所示:

    显示“VM 生成”属性的屏幕截图。

方案 1:从 SLES 12 迁移到 SLES 15 成功,但从 SLES 15 SP1 升级到 SP2 失败

执行 sudo zypper migration 命令时,迁移会失败,并得到以下输出:

Can't get available migrations from server: SUSE::Connect::ApiError: The requested products 'HPC Module 12 x86_64' are not activated on the system.

Can't get available migrations from server: SUSE::Connect::ApiError: Invalid combination of  products registered.

还可以在 /var/log/messages/var/log/distro-migration.log 文件中找到输出。

原因

SLES 12 和 SLES 15 之间的一个主要变化是高性能计算(HPC)成为独立的产品。 因此,HPC 模块不再可用于注册为 SLES 的系统。 此更改导致迁移目标找不到目标,迁移过程失败。

解决方法

若要解决此问题,请在开始迁移之前通过运行以下命令删除 HPC 模块:

sudo zypper rm sle-module-hpc-release-POOL sle-module-hpc-release

解决方法

若要解决此问题,请从/etc/products.d/目录移动到sle-module-hpc.prod临时位置,然后重试迁移。 为此,请运行以下 命令:

cd /etc/products.d
sudo mv sle-module-hpc.prod /tmp/
sudo zypper migration

有关详细信息,请参阅 公有云 中的主要发行版,以及 Azure 中的 zypper 迁移失败。

方案 2:安装“suse-migration-sles15-activation”包失败

安装 suse-migration-sles15-activation 包时,迁移会失败,并得到以下输出:

'suse-migration-sle15-activation' not found in package names. Trying capabilities. No provider of 'suse-migration-sle15-activation' found.

还可以在 /var/log/messages/var/log/distro-migration.log 文件中找到此输出。

原因

默认情况下,SLES 12 公有云模块未启用。

解决方法

若要解决此问题,请执行以下步骤:

  1. 启用公有云模块,然后再次尝试安装包:

    sudo SUSEConnect -p sle-module-public-cloud/12/x86_64
    

    注意

    在 SAP 实例的 SLES 上,不应存在两个包: sle-ha-releasesle-ha-release-POOL。 在这种情况下,在开始分发迁移之前,请通过运行以下命令 sudo zypper remove sle-ha-release sle-ha-release-POOL 删除这些包。

  2. 对系统执行清理,然后重新注册:

    sudo SUSEConnect --cleanup
    
    sudo rm /etc/zypp/{credentials,services,repos}.d/*
    
    sudo rm --force --recursive /var/cache/zypp/*
    
    sudo rm /var/lib/cloudregister/*
    
    sudo registercloudguest --force-new
    
  3. 验证 VM 注册状态:

    sudo SUSEConnect --status
    
  4. 继续迁移:

    sudo zypper migration
    

有关详细信息,请参阅 公有云 中的主要发行版和 在公有云中升级 SUSE Linux Enterprise。

方案 3:从 SLE 15 SP1 升级到 SLE 15 SP2 后,第 2 代 VM 在停止后无法启动

将第 2 代 VM 从 SLES 15 SP1 升级到 SLES 15 SP2 后,VM 在从Azure 门户停止或通过运行init 0shutdown -h命令停止后不会启动。 以下输出显示在串行控制台日志或 boot.log 目录下 /var/log/

Loading Linux 5.3.18-24.49-default ...  
error: symbol grub_file_filters' not found                                                 
Loading initial ramdisk ...  
error: symbol grub_file_filters' not found
Press any key to continue.

Loading Linux 5.3.18-24.49-default ...  
error: symbol grub_verify string' not found                                                 
Loading initial ramdisk ...  
error: symbol grub_verify string' not found
Press any key to continue...

原因

重启、停止或解除分配第 2 代 VM 后,Azure 环境中的 Hyper-V 不会保留其启动条目。 在这种情况下,SUSE Linux VM 无法启动。

解决方法

若要解决此问题,请执行以下步骤:

  1. 根据 Linux 救援 VM 中的 Chroot 环境中所述,在救援 VM 上从受影响的 VM OS 快照磁盘设置 chroot 环境。

  2. 重新安装 GRUB 启动加载程序:

    sudo /usr/sbin/shim-install --config-file=/boot/grub2/grub.cfg
    
  3. 将快照磁盘交换回有问题的 VM,如 Linux 救援 VM 中的 Chroot 环境中所述。

有关详细信息,请参阅 grub2 错误:找不到符号“grub_file_filters”。

方案 4:从 SLES 15 迁移到 SLES 15 SP3 失败

从 SLES 15 迁移到 SLES 15 SP3 失败,并得到以下输出:

Can't get available migrations from server: SUSE::Connect::ApiError: The requested products 'SUSE Linux Enterprise High Availability Extension 15 SP1 x86_64, Basesystem Module 15 SP1 x86_64, SUSE Cloud Application Platform Tools Module 15 SP1 x86_64, Containers Module 15 SP1 x86_64, Desktop Applications Module 15 SP1 x86_64, Development Tools Module 15 SP1 x86_64, Legacy Module 15 SP1 x86_64, Public Cloud Module 15 SP1 x86_64, Python 2 Module 15 SP1 x86_64, SAP Applications Module 15 SP1 x86_64, Server Applications Module 15 SP1 x86_64, Web and Scripting Module 15 SP1 x86_64, Transactional Server Module 15 SP1 x86_64' are not activated on the system.
/usr/lib/zypper/commands/zypper-migration' exited with status 1

还可以在 /var/log/messages/var/log/distro-migration.log 文件中找到它。

原因

发生此错误的原因是 SLES 15 到更高版本的 SLES 迁移中断、停止或意外终止,从而导致系统中包更新不完整。

解决方法

若要解决此问题,请将所有包回滚到与 SLES 15 兼容的版本,然后重试迁移:

  1. 检查系统中的重复包:

    sudo zypper dup
    
  2. 回滚更改:

    sudo zypper rollback
    
  3. 再次执行迁移:

    sudo zypper migration
    

方案 6:迁移后,SUSE 无法启动并出现注册失败的最新内核

迁移后,VM 无法使用最新的内核启动。 此外,存储库不起作用,并且收到一个错误,指出未定义存储库。

原因

/etc/credentials.d 目录具有不正确的权限或此目录中文件的内容不正确或已损坏。

解决方法

若要解决此问题,请执行以下步骤:

  1. 清理注册:

    sudo rm /var/cache/cloudregister/
    
    sudo rm /etc/zypp/credentials.d/
    
    sudo chmod 0755 /etc/zypp/credentials.d*
    
    sudo registercloudguest --force-new
    
  2. 注册成功完成后,修补并重新启动 VM:

    sudo zypper update
    
    
    sudo reboot
    

方案 7:由于 regionService 目录问题,从 SLES 12 SP5 迁移到 SLES 15 SP1 失败

从 SLES 12 SP5 迁移到 SLES 15 SP1 失败,并获取以下输出:

Skipping repository 'SLE-Module-Containers12-Updates' because of the above error.
Error retrieving metadata for 'SLE-Module-HPC12-Pool':
Not ready to read within timeout.
Skipping repository 'SLE-Module-HPC12-Pool' because of the above error.
Error retrieving metadata for 'SLE-Module-HPC12-Updates' :
Not ready to read within timeout.
Skipping repository 'SLE-Module-HPC12-Updates' because of the above error.
Error retrieving metadata for 'SLE-Module-Legacy12-Pool' :
Not ready to read within timeout.
Skipping repository 'SLE-Module-Legacy12-Pool' because of the above err Error retrieving metadata for 'SLE-Module-Legacy12-Updates' :
Not ready to read within timeout.
Skipping repository 'SLE-Module-Legacy12-Updates' because of the above Error retrieving metadata for 'SLE-Module-Public-Cloud12-Pool' :
Not ready to read within timeout.
Skipping repository 'SLE-Module-Public-Cloud12-Pool' because of the abo Error retrieving metadata for 'SLE-Module-Public-Cloud12-Updates' :
Not ready to read within timeout.
Skipping repository 'SLE-Module-Public-Cloud12-Updates' because of the

还可以在 /var/log/messages/var/log/distro-migration.log 文件中找到输出。

原因

目录regionService将移入/var/lib/usr/lib目录,但 DMS 脚本仅在设置绑定装载到 ISO 运行时环境时查找certs/var/lib目录。

解决方法

若要解决此问题,请执行以下步骤:

  1. 创建以前使用的目录 /var/lib/regionService/certs

    sudo mkdir -p /var/lib/regionService/certs
    
  2. 将证书文件复制到 /var/lib/regionService/certs

    sudo cp -a /usr/lib/regionService/certs/* /var/lib/regionService/certs/
    
  3. /etc/regionserverclnt.cfg修改文件,并将参数设置为certLocation以前使用的路径/var/lib/regionService/certs

    sudo vi /etc/regionserverclnt.cfg
    
  4. 检查修改的文件:

    sudo cat /etc/regionserverclnt.cfg
    
    [server]
    api = regionInfo
    #certLocation = /usr/lib/regionService/certs
    certLocation = /var/lib/regionService/certs
    regionsrv = 23.100.36.229,40.121.202.140,52.187.53.250,104.45.31.195,191.237.254.253
    [instance]
    dataProvider = /usr/bin/azuremetadata --api latest --subscriptionId --billingTag --attestedData --signature --xml
    instanceArgs = msftazure
    httpsOnly = true
    
  5. 安装最新的 SLES15-Migration 包:

    sudo zypper in SLES15-Migration
    
  6. 再次执行迁移:

    sudo zypper migration
    

有关详细信息,请参阅 SLES 12 SP5 分发迁移系统(DMS)失败

方案 8:由于 /etc/pki/trust/anchors 目录中的未知文件夹,迁移失败

从 SLES 12 SP5 迁移到 SLES 15 SP1 失败,并在文件中显示 /var/log/distro_migration.log 以下错误消息:

Mar 11 13:39:15 localhost suse-migration-prepare[1510]: IsADirectoryError: [Errno 21] Is a directory: '/system-root/etc/pki/trust/anchors/temp'
Mar 11 13:39:15 localhost systemd[1]: suse-migration-prepare.service: Main process exited, code=exited, status=1/FAILURE
Mar 11 13:39:15 localhost systemd[1]: Failed to start Prepare For Migration.
Mar 11 13:39:15 localhost systemd[1]: suse-migration-prepare.service: Unit entered failed state.
Mar 11 13:39:15 localhost systemd[1]: suse-migration-prepare.service: Failed with result 'exit-code'.

解决方法

若要解决此问题,请执行以下步骤:

  1. temp 目录中的文件夹 /etc/pki/trust/anchors 移动到 /backuplocation/ 目录:

    sudo mv /etc/pki/trust/anchors/temp /backuplocation/temp
    
  2. 安装迁移包:

    sudo zypper install suse-migration-sle15-activation
    
  3. 再次执行迁移:

    sudo zypper migration
    

方案 9:迁移后 SUSE 注册和存储库不起作用

在 OS 从 SLES 15 SP3 迁移到 SLES 15 SP4 期间,该过程成功完成。 但是,从 SLES 15 SP4 迁移到 SLES 15 SP5 时,迁移和更新无法按预期工作,并得到以下输出:

         sle-module-desktop-applications/15.3/x86_64 Desktop Applications Module
         sle-module-development-tools/15.3/x86_64 Development Tools Module
         sle-ha/15.3/x86_64          SUSE Linux Enterprise High Availability Extension 15 SP3
         sle-module-sap-applications/15.3/x86 64  SAP Applications Module
         sle-module-live-patching/15.3/x86_64   SUSE Linux Enterprise Live Patching
         PackageHub/15.3/x86 64   SUSE Package Hub 15
         sle-module-certifications/15.3/x86_64   Certifications Module
 Unavailable migrations (product is not mirrored):
         SUSE Linux Enterprise Server for SAP Applications 15 SP6 x86_64 (not available) Basesystem Module 15 SP6 x86_64 (not available) Certifications Module 15 SP6 x86_64 (not available) Containers Module 15 SP6 x86_64 (not available)
         Desktop Applications Module 15 SP6 x86_64 (not available)
         Server Applications Module 15 SP6 x86_64 (not available)
         SUSE Linux Enterprise Live Patching 15 SP6 x86_64 (not available)
         SUSE Package Hub 15 SP6 x86_64 (not available)
         Development Tools Module 15 SP6 x86_64 (not available)
         Legacy Module 15 SP6 x86_64 (not available)
         Public Cloud Module 15 SP6 x86_64 (not available)
         SUSE Linux Enterprise High Availability Extension 15 SP6 x86 64 (not available) Web and Scripting Module 15 SP6 x86_64 (not available)
         SAP Applications Module 15 SP6 x86_64 (not available)
No migration available.
'/usr/lib/zypper/commands/zypper-migration' exited with status 1

解决方法

若要解决此问题,请执行以下步骤:

  1. 在迁移之前,请激活并停用以下模块。

    1. 激活以下模块:

      sudo SUSEConnect -p sle-module-web-scripting/15.3/x86_64
      sudo SUSEConnect -p sle-module-public-cloud/15.3/x86_64
      sudo SUSEConnect -p sle-module-containers/15.3/x86_64
      sudo SUSEConnect -p sle-module-live-patching/15.3/x86_64
      
    2. 停用以下模块:

      sudo SUSEConnect -d -p sle-module-legacy/15.3/x86_64
      sudo SUSEConnect -d -p sle-module-python2/15.3/x86_64
      sudo SUSEConnect -d -p PackageHub/15.3/x86_64
      
  2. 对系统执行清理,然后重新注册:

    sudo SUSEConnect --cleanup
    
    sudo rm /etc/zypp/{credentials,services,repos}.d/*
    
    sudo rm --force --recursive /var/cache/zypp/*
    
    sudo rm /var/lib/cloudregister/*
    
    sudo registercloudguest --force-new
    
  3. 验证 VM 注册状态:

    sudo SUSEConnect --status
    

方案 10:SLES 15 迁移从 SP3 到 SP4 失败,凭据和存储库错误无效

SLES 15 从 SP3 迁移到 SP4 失败,并得到以下输出:

sudo SUSEConnect -S
Error: Invalid system credentials, probably because the registered system was deleted in SUSE Customer Center. Check https://scc.suse.com whether your system appears there. If it does not, please call SUSEConnect --cleanup and re-register this system.
sudo zypper migration
Executing '/usr/bin/zypper patch-check-updatestack-only'
Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed. Reading installed packages...
O patches needed (0 security patches)
Executing '/usr/bin/zypper ref'
Warning: There are no enabled repositories defined.
Use 'zypper addrepo' or 'zypper modifyrepo' commands to add or enable repositories.
repository refresh failed, exiting
'/usr/lib/zypper/commands/zypper-migration' exited with status 1

还可以在 /var/log/messages/var/log/distro-migration.log 文件中找到输出。

原因

迁移失败,因为存在认证模块。

解决方法

若要解决此问题,请运行以下命令以在更新之前禁用认证模块,然后重试迁移:

sudo SUSEConnect -d -p sle-module-certifications/15.3/x86_64

方案 11:由于第三方模块和安全工具,迁移失败

VM 迁移过程中会出现一些问题,例如 VM 进入挂起状态、启动失败或 zypper 模块存储库中的长时间进程。

原因

  • 安全工具可以通过阻止操作或修改系统文件来中断迁移,从而导致不稳定。
  • 第三方存储库可能会引入与官方 SUSE 包冲突的包,这可能会导致升级过程中进一步复杂。

解决方法

在继续 SUSE 迁移之前,建议在系统上禁用任何第三方存储库和安全工具。 在迁移期间禁用它们对于防止依赖项冲突、确保系统稳定性、保持与官方包的一致性、简化故障排除以及提供更流畅的升级过程至关重要。

后续步骤

如果问题未解决, 请创建支持请求。 提交请求时,请附加文件的副本 /var/log/distromigration.log 以进行故障排除。

第三方信息免责声明

本文中提到的第三方产品由 Microsoft 以外的其他公司提供。 Microsoft 不对这些产品的性能或可靠性提供任何明示或暗示性担保。

联系我们寻求帮助

如果你有任何疑问或需要帮助,请创建支持请求联系 Azure 社区支持。 你还可以将产品反馈提交到 Azure 反馈社区