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

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

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

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

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

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

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

    1. 在克隆的计算机上,更改主机名和 IP 地址。 Make sure /etc/hosts contains the changes you made and the correct host entries.

  2. 解决重复计算机 ID 问题

    1. 对于支持 systemd 的发行套件:

      1. 如果您的计算机具有相同的计算机 ID,请以 root 身份删除每个重复客户端上的文件,然后重新创建这些文件:

        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. 对于不支持 systemd 的发行套件:

      1. 以 root 身份从 dbus 生成计算机 ID:

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

    Red Hat Enterprise Linux uses the machine ID to generate kernel entries in /boot/loader/entries. Not performing these steps will result in a mix of old and new kernel entries after the liberation, as SUSE Liberty Linux kernels will create new entries instead of replacing the old ones.

    • 在更改计算机 ID 后、执行系统适配迁移前,请运行以下命令:

      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
    • 有关释放 Red Hat Enterprise Linux 8.10 服务器的详细信息及示例,请参见 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. 对于 Salt 受控端客户端:

        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. 从初始配置页面中删除接受的密钥,并从 SUSE Multi-Linux Manager 中删除系统配置文件,然后使用以下命令重启客户端。

      1. 对于 Salt 受控端客户端:

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

      service venv-salt-minion restart
    3. Re-register the clients. Each client now has a different /etc/machine-id and should be correctly displayed on the System Overview page.