Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

Red Hat Enterprise Linux 中的订阅管理器故障排除

Red Hat Subscription Management 2023

根据 Red Hat Subscription Manager 的问题

Customer Content Services

摘要

对 Red Hat Enterprise Linux 中的 subscription-manager 工具进行故障排除。

1. Red Hat Enterprise Linux 8

1.1. 无法注册到 Red Hat Subscription Management

注册可能会失败,并显示错误 "HTTP error (401 - Unauthorized): Invalid user credentials" in Kickstart 设置和 Red Hat Subscription Manager,即使您的凭证仍与客户门户网站一起使用。这有时会与包含特殊字符(如短划线)的密码发生。

在继续操作前,请确定您使用:

  • 客户门户网站的正确凭证,这些凭证会授予您机构级别访问权限
  • 客户门户网站的登录 ID 而不是您的电子邮件

但是,如果您的所有信息都正确,但仍然无法正常工作,您可以在客户门户网站中创建激活码,并在 subscription-manager 命令行界面中使用该激活码。

1.1.1. 在客户门户网站中创建激活码

流程

  1. 从客户门户网站中,单击 Activation Keys
  2. 单击 New
  3. 输入 密钥 的唯一名称。稍后您将需要这个值。
  4. 选择 Service LevelAuto Attach 首选项。
  5. 选择您要添加到激活码中的订阅。您可以使用搜索栏过滤结果而不退出页面。
  6. Create

成功后,客户门户网站会显示一个横幅,表示已创建了激活码。机构 ID 也显示在横幅下方。

创建激活码后,您现在可以注册您的系统,即使 Subscription Manager 启动了有效的客户门户网站 ID。

1.1.2. 在客户门户网站中注册激活码

先决条件

  • 机构 ID
  • 激活码名称

流程

  1. 打开终端窗口。
  2. 输入以下命令,其中 <activation_key_name> 是您要使用的激活码的名称,<organization_ID> 是您的机构 ID:

    # subscription-manager register --activationkey=<activation_key_name> --org=<organization_ID>

如果成功,subscription-manager 会显示输出:

The system has been registered with ID: 00000000-0000-0000-000000000000
The registered system name is: system-name
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status: Not Subscribed

注册后,请务必使用 attach 命令附加订阅。

1.2. subscription-manager 报告无效的订阅

在使用 subscription-manager 状态检查系统状态时,根据 Subscription Manager 刷新并重新注册系统可能会帮助解决 "invalid subscription" 问题。

流程

  1. 首先,刷新订阅:

    # subscription-manager refresh
    # subscription-manager attach --auto
    # subscription-manager status
  2. 如果订阅仍无效,请从系统中取消注册并重新注册它。要取消注册,请输入以下命令:

    # subscription-manager remove --all
    # subscription-manager unregister
    # subscription-manager clean
  3. 要重新注册系统,请输入以下命令:

    # subscription-manager register
    # subscription-manager attach --auto

2. Red Hat Enterprise Linux 7

2.1. 因为证书问题而无法注册

如果 'subscription-manager' 生成错误 "CA certificate for subscription service has not installed",则系统上的证书与 subscription-manager 的证书不匹配。要解决这个错误,您需要配置防火墙以允许传出网络防火墙上的以下主机名和端口启用 yum 和 subscription-manager 访问红帽订阅服务和 Content Delivery Network (CDN):

  • subscription.rhn.redhat.com:443 [https] AND subscription.rhsm.redhat.com:443 [https]
  • cdn.redhat.com:443 [https]
  • *.akamaiedge.net:443 [https] OR *.akamaitechnologies.com:443 [https]
注意

不建议使用特定的 IP 地址,因为它们可能会改变。但是,有一个 运行的公共 CIDR 列表列表,用于 Red Hat Subscription Management

3. Red Hat Enterprise Linux 6

3.1. yum update 无法建立通信

红帽使用内容交付网络(CDN)通过 yum 发布更新。如果您在通过 yum 进行故障排除时遇到问题,您可能会看到 "[Errno 14] 问题进行 ssl 连接"。通信没有正确与正确的证书建立。要排除错误:

流程

  1. 验证代理没有更改 SSL 证书。有时,代理被配置为重新签名 SSL 通信。
  2. 验证系统的 UUID 是否与客户门户网站中看到的内容匹配。要检查系统的 UUID,请输入:

    # openssl x509 -in /etc/pki/consumer/cert.pem -noout -text| grep 'Subject: CN'
  3. 如果 UUID 不匹配,请从系统中刷新订阅数据:

    # subscription-manager refresh --force
    # subscription-manager attach --auto
  4. 如果您在 Red Hat Subscription Manager 中使用 HTTP 代理,则代理设置需要记录在 ''/etc/rhsm/rhsm.conf' 中(而不是 '/etc/yum.conf')。
  5. 检查系统是否使用来自红帽的标准 curl 软件包。

3.2. 手动设置首选操作系统版本

从 Red Hat Enterprise Linux 6.3 开始,红帽订阅管理器可以设置一个首选的操作系统版本来限制系统的自动更新。这是多个首选项之一,可用于自动附加订阅。但是,无法在旧版本的 Red Hat Enterprise Linux 上通过 Red Hat Subscription Manager 设置首选的操作系统。

通过编辑 yum 配置,可以将系统限制为 Red Hat Enterprise Linux 6.2 上的某个操作系统版本。例如,将 yum 更新限制为 6.2-version 软件包:

[root@server ~]# echo 6.2 > /etc/yum/vars/releasever

4. Red Hat Enterprise Linux 5

4.1. 客户机事实显示 UUID Unknown

对于虚拟客户机,Subscription Manager 守护进程使用 dmidecode 来读取系统管理 BIOS (SMBIOS)值,用于检索客户机 UUID。在 64 位 Intel 构架中,SMBIOS 信息由 Intel 固件控制,并存储在只读二进制条目中。因此,无法检索 UUID 或设置新的可读的 UUID。

由于客户机 UUID 是不可读的,因此在客户机系统上运行 fact 命令在系统的 virt.facts 文件中显示 Unknown 值(virt.uuid: Unknown)。这意味着客户机没有与主机机器关联的,因此不会继承一些订阅。

Subscription Manager 使用的事实可以手动编辑以添加 UUID。

流程

  1. 获取客户机名称或客户机 ID。
  2. 在虚拟主机上,使用 virsh 检索客户机 UUID。例如,对于名为 'rhel5server_virt1' 的客户机:

    virsh domuuid rhel5server_virt1
  3. 在客户机中,手动创建事实文件:

    vim /etc/rhsm/facts/virt.facts
  4. 添加包含给定 UUID 的行:

    {
       "virt.uuid": "$VIRSH_UUID"
           }

法律通告

Copyright © 2023 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.