对注册克隆的客户端时出现的问题进行查错

如果您使用 SUSE Manager 来管理虚拟机,您可能发现创建 VM 的克隆版本会很有用。克隆版本是使用主磁盘(与现有磁盘完全相同的副本)的 VM。

虽然克隆 VM 可以节省大量时间,但磁盘上复制的标识信息有时会导致问题。

如果您有一个已注册的客户端,并创建了该客户端的克隆版本,在尝试注册该克隆版本时,您可能希望 SUSE Manager 将原始客户端和克隆版本注册为两个不同的客户端。但是,如果原始客户端和克隆版本中的计算机 ID 相同,则 SUSE Manager 会将这两个客户端注册为一个系统,并且现有客户端数据将由克隆版本的数据重写。

可以通过更改克隆版本的计算机 ID 来解决此问题,以便 SUSE Manager 将它们识别为两个不同的客户端。

此过程的每个步骤都在克隆的客户端上执行。此过程不会对原始客户端进行操作,原始客户端仍保持注册到 SUSE Manager。

过程:解决克隆的 Salt 客户端中的重复计算机 ID
  1. 系统细节  配置

    1. 在克隆的计算机上,更改主机名和 IP 地址。 确保 /etc/hosts 包含您所做的更改和正确的主机项。

  2. 解决重复计算机标识问题

    1. For distributions that support systemd:

      1. If your machines have the same machine ID, as root, delete the files on each duplicated client and re-create it:

        rm /etc/machine-id
        rm /var/lib/dbus/machine-id
        rm /var/lib/zypp/AnonymousUniqueId
        dbus-uuidgen --ensure
        systemd-machine-id-setup
      2. If the cloned machine also has a folder in /var/log/journal/ it needs to be renamed accordingly to the new machine ID. If names do not match, journalctl could not retrieve any log and podman logs would not show anything.

        mv /var/log/journal/* /var/log/journal/$(cat /etc/machine-id)
    2. For distributions that do not support systemd:

      1. As root, generate a machine ID from dbus:

      rm /var/lib/dbus/machine-id
      rm /var/lib/zypp/AnonymousUniqueId
      dbus-uuidgen --ensure
    • 如果您计划克隆一台 Red Hat Enterprise Linux 8.10 服务器,之后再将其迁移至 SUSE Liberty Linux 系统,则必须执行额外步骤修复内核配置文件。

    Red Hat Enterprise Linux 系统会利用计算机标识在 /boot/loader/entries 下生成内核条目。如果跳过这些步骤,系统迁移后将同时存在新旧内核条目,因为 SUSE Liberty Linux 系统的内核会生成新条目,而非替换原有条目。

    • 在更改计算机标识后、执行系统迁移前,请依次运行以下命令:

      sudo rm -rf /boot/loader/entries/
      sudo for ver in $(rpm -q kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n'); do echo "Reinstalling kernel $ver..."; sudo kernel-install add $ver /lib/modules/$ver; done
      sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
    • For more information and example on liberating Red Hat Enterprise Linux 8.10 server, see Liberate Red Hat Enterprise Linux 8.10 with secureboot.

  3. 重新配置 Salt 客户端

    1. If your clients still have the same Salt client ID, delete the minion_id file on each client (FQDN is used when it is regenerated on client restart).

      1. For Salt Minion clients:

        rm /etc/salt/minion_id
        rm -rf /etc/salt/pki
      2. 对于 Salt 捆绑包客户端:

        rm /etc/venv-salt-minion/minion_id
        rm -rf /etc/venv-salt-minion/pki
    2. Delete accepted keys from the onboarding page and the system profile from SUSE Manager, and restart the client with.

      1. For Salt Minion clients:

        service salt-minion restart
      2. 对于 Salt 捆绑包客户端:

      service venv-salt-minion restart
    3. 重新注册客户端。每个客户端现在都有一个不同的 /etc/machine-id,并且应会正确显示在系统概览页面上。