为技术支持生成 sos 报告

Red Hat Enterprise Linux 8

使用 sos 程序从 RHEL 服务器收集故障排除信息

Red Hat Customer Content Services

摘要

使用 sos 实用程序收集配置、诊断和故障排除数据,并将这些文件提供给红帽技术支持。支持团队可以分析并调查这些数据,以解决您的支持问题单中报告的服务请求。

使开源包含更多

红帽承诺替换我们的代码、文档和网页属性中存在问题的语言。我们从这四个术语开始: master、slave、blacklist 和 whitelist。这些更改将在即将发行的几个发行本中逐渐实施。如需了解更多详细信息,请参阅 CTO Chris Wright 信息

对红帽文档提供反馈

我们感谢您对我们文档的反馈。让我们了解如何改进它。

通过 Jira 提交反馈(需要帐户)

  1. 登录到 Jira 网站。
  2. 单击顶部导航栏中的 Create
  3. Summary 字段中输入描述性标题。
  4. Description 字段中输入您的建议以改进。包括文档相关部分的链接。
  5. 点对话框底部的 Create

第 1 章 为技术支持生成 sos 报告

使用 sos 工具,您可以收集配置、诊断和故障排除数据,并将这些文件提供给红帽技术支持。

1.1. sos 工具的作用

在分析 RHEL 系统的服务请求时,sos 报告通常是红帽技术支持工程师的起点。sos 工具(也称为 sosreport)提供了一种标准化的方法,可以帮助红帽支持工程师在调查支持问题单中报告的问题时参考这些信息。使用 sos 程序有助于确保您不再重复要求数据输出。

sos 实用程序允许从一个或多个系统收集各种调试信息,选择清理敏感数据,并以报告的形式将其上传到红帽。更具体地说,三个 组件 确实如下:

  • 因此,报告 从一个 系统收集调试信息。

    注意

    这个程序最初被命名为 sosreport。使用相同参数运行 sosreport 仍可以正常工作,现在被称为 sos report

  • 因此,s collect 允许从指定的一组节点运行并收集各个 sos 报告。
  • 因此,清理 模糊处理可能存在的敏感信息,如用户名、主机名、IP 或 MAC 地址或其他用户指定的数据。

报告中收集的信息包括来自 RHEL 系统的配置详情、系统信息和诊断信息,例如:

  • 运行的内核版本。
  • 载入的内核模块。
  • 系统和服务配置文件。
  • 诊断命令输出。
  • 安装的软件包列表。

sos 程序将其收集的数据写入名为 sosreport- <host_name> - <support_case_number> - <YYYY-MM-DD> - &lt;unique_random_characters>.tar.xz 的归档。

该程序会在 /var/tmp/ 目录中保存存档及其 MD5 checksum:

[root@server1 ~]# ll /var/tmp/sosreport*
total 18704
-rw-------. 1 root root 19136596 Jan 25 07:42 sosreport-server1-12345678-2022-01-25-tgictvu.tar.xz
-rw-r--r--. 1 root root       33 Jan 25 07:42 sosreport-server1-12345678-2022-01-25-tgictvu.tar.xz.md5

其它资源

  • sosreport(1) man page

1.2. 从命令行安装 sos 软件包

要使用 sos 实用程序,请安装 sos 软件包。

先决条件

  • 您需要 root 权限。

流程

  • 安装 sos 软件包。

    [root@server ~]# yum install sos

验证步骤

  • 使用 rpm 实用程序验证是否安装了 sos 软件包。

    [root@server ~]# rpm -q sos
    sos-4.2-15.el8.noarch

1.3. 从命令行生成 sos 报告

使用 sos report 命令从 RHEL 服务器收集 sos 报告。

先决条件

  • 已安装 sos 软件包。
  • 您需要 root 权限。

流程

  1. 运行 sos report 命令并按照屏幕的说明进行操作。您可以添加 --upload 选项,以在生成后将 sos 报告立即转移到红帽。

    [user@server1 ~]$ sudo sos report
    [sudo] password for user:
    
    sos report (version 4.2)
    
    This command will collect diagnostic and configuration information from
    this Red Hat Enterprise Linux system and installed applications.
    
    An archive containing the collected information will be generated in
    /var/tmp/sos.qkn_b7by and may be provided to a Red Hat support
    representative.
    
    ...
    
    Press ENTER to continue, or CTRL-C to quit.
  2. (可选) 如果您已经向红帽创建了技术支持问题单,请输入问题单号将其嵌入到 sos 报告文件名称中,如果您指定了 --upload 选项,则会上传到该问题单。如果您没有问题单号,请将此字段留空。输入问题单号是可选的,不会影响 sos 实用程序的操作。

    Please enter the case id that you are generating this report for []: <8-digit_case_number>
  3. 记录下控制台输出末尾显示的 sos 报告文件名称。

    ...
    Finished running plugins
    Creating compressed archive...
    
    Your sos report has been generated and saved in:
    /var/tmp/sosreport-server1-12345678-2022-04-17-qmtnqng.tar.xz
    
    Size    16.51MiB
    Owner   root
    md5     bba955bbd9a434954e18da0c6778ba9a
    
    Please send this file to your support representative.
注意
  • 您可以使用 --batch 选项在不提示输入交互式输入的情况下生成 sos 报告。
[user@server1 ~]$ sudo sos report --batch --case-id <8-digit_case_number>
  • 您还可以使用 --clean 选项来模糊处理一个刚好的 sos 报告。
[user@server1 ~]$ sudo sos report --clean

验证步骤

  • 验证 sos 实用程序在 /var/tmp/ 中创建了与命令输出的描述匹配的存档。

    [user@server1 ~]$ sudo ls -l /var/tmp/sosreport*
    [sudo] password for user:
    -rw-------. 1 root root 17310544 Sep 17 19:11 /var/tmp/sosreport-server1-12345678-2022-04-17-qmtnqng.tar.xz

1.4. 同时在多个系统中生成和收集 sos 报告

您可以使用 sos 实用程序在多个系统上触发 sos 报告 命令。等待报告终止并收集所有生成的报告。

先决条件

  • 您知道 要运行的 机器类型或 节点列表
  • 您已在所有系统上安装 sos 软件包。
  • 您拥有所有系统中 root 帐户的 ssh 密钥,或者您可以通过 --password 选项提供 root 密码。

流程

  • 运行 sos collect 命令并按照屏幕的说明进行操作。

    注意

    默认情况下,s 会收集尝试识别其 运行的集群 类型,以自动识别要从中收集报告 的节点

    1. 您可以使用 --cluster--nodes 选项手动设置 clusternodes 类型。
    2. 您还可以使用 --master 选项将 sos 程序指向远程节点以确定 集群 类型和 节点列表。因此,您不必登录到其中一个集群节点来收集 sos 报告;您可以从您的工作站来做。
    3. 您可以添加 --upload 选项,在生成后立即将 sos 报告 传输到红帽。
    4. 可以进一步提供任何有效的 sos report 选项,它们会被传递到所有 sos 报告的执行。例如 --batch--clean 选项。
    [root@primary-rhel8 ~]# sos collect --nodes=sos-node1,sos-node2 -o process,apache --log-size=50
    
    sos-collector (version 4.2)
    
    This utility is used to collect sosreports from multiple nodes simultaneously.
    It uses OpenSSH's ControlPersist feature to connect to nodes and run commands remotely. If your system installation of OpenSSH is older than 5.6, please upgrade.
    
    An archive of sosreport tarballs collected from the nodes will be generated in /var/tmp/sos.o4l55n1s and may be provided to an appropriate support representative.
    
    The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party.
    
    No configuration changes will be made to the system running this utility or remote systems that it connects to.
    
    
    Press ENTER to continue, or CTRL-C to quit
    
    
    Please enter the case id you are collecting reports for: <8-digit_case_number>
    
    sos-collector ASSUMES that SSH keys are installed on all nodes unless the
    --password option is provided.
    
    The following is a list of nodes to collect from:
        primary-rhel8
        sos-node1
        sos-node2
    
    
    Press ENTER to continue with these nodes, or press CTRL-C to quit
    
    
    Connecting to nodes...
    
    Beginning collection of sosreports from 3 nodes, collecting a maximum of 4 concurrently
    
    primary-rhel8 : Generating sosreport...
    sos-node1  : Generating sosreport...
    sos-node2 : Generating sosreport...
    primary-rhel8 : Retrieving sosreport...
    sos-node1  : Retrieving sosreport...
    primary-rhel8  : Successfully collected sosreport
    sos-node1 : Successfully collected sosreport
    sos-node2 : Retrieving sosreport...
    sos-node2 : Successfully collected sosreport
    
    The following archive has been created. Please provide it to your support team.
        /var/tmp/sos-collector-2022-04-15-pafsr.tar.xz
    
    [root@primary-rhel8 ~]#

验证步骤

  • 验证 sos collect 命令在 /var/tmp/ 目录中创建了与命令输出中描述匹配的存档。

    [root@primary-rhel8 ~]# ls -l /var/tmp/sos-collector*
    -rw-------. 1 root root 160492 May 15 13:35 /var/tmp/sos-collector-2022-05-15-pafsr.tar.xz

其它资源

1.5. 清理 sos 报告

sos 实用程序提供了一个代码来混淆潜在的敏感数据,如用户名、主机名、IP 或 MAC 地址或其他用户指定的关键字。原始 sos 报告sos 收集 保持不变,新的 *-obfuscated.tar.xz 文件被生成并应该与第三方共享。

注意

您可以将清理功能附加到 sos 报告,或使用 --clean 选项 收集 命令:

[user@server1 ~]$ sudo sos report --clean

先决条件

  • 您已生成 sos 报告sos 收集 tarball。
  • (可选) 您可以在用户名、主机名和其他想要模糊处理以外的特定关键字列表中。

流程

  • 针对 sos reportsos collect tarball 运行 sos clean 命令,并按照屏幕上的说明进行操作。

    1. 您可以添加 --keywords 选项,以额外清理给定关键字列表。
    2. 您可以添加 --usernames 选项以模糊处理进一步敏感的用户名。

      对于通过 lastlog 文件报告的 UID 为 1000 及以上的用户,将自动运行自动用户名清理。这个选项用于可能未显示为实际登录的 LDAP 用户,但可能会在某些日志文件中发生。

      [user@server1 ~]$ sudo sos clean /var/tmp/sos-collector-2022-05-15-pafsr.tar.xz
      [sudo] password for user:
      
      sos clean (version 4.2)
      
      This command will attempt to obfuscate information that is generally considered to be potentially sensitive. Such information includes IP addresses, MAC addresses, domain names, and any user-provided keywords.
      
      Note that this utility provides a best-effort approach to data obfuscation, but it does not guarantee that such obfuscation provides complete coverage of all such data in the archive, or that any obfuscation is provided to data that does not fit the description above.
      
      Users should review any resulting data and/or archives generated or processed by this utility for remaining sensitive content before being passed to a third party.
      
      
      Press ENTER to continue, or CTRL-C to quit.
      
      Found 4 total reports to obfuscate, processing up to 4 concurrently
      
      sosreport-primary-rhel8-2022-05-15-nchbdmd :      Extracting...
      sosreport-sos-node1-2022-05-15-wmlomgu :      Extracting...
      sosreport-sos-node2-2022-05-15-obsudzc :      Extracting...
      sos-collector-2022-05-15-pafsr :                   Beginning obfuscation...
      sosreport-sos-node1-2022-05-15-wmlomgu :      Beginning obfuscation...
      sos-collector-2022-05-15-pafsr :                   Obfuscation completed
      sosreport-primary-rhel8-2022-05-15-nchbdmd :      Beginning obfuscation...
      sosreport-sos-node2-2022-05-15-obsudzc :      Beginning obfuscation...
      sosreport-primary-rhel8-2022-05-15-nchbdmd :      Re-compressing...
      sosreport-sos-node2-2022-05-15-obsudzc :      Re-compressing...
      sosreport-sos-node1-2022-05-15-wmlomgu :      Re-compressing...
      sosreport-primary-rhel8-2022-05-15-nchbdmd :      Obfuscation completed
      sosreport-sos-node2-2022-05-15-obsudzc :      Obfuscation completed
      sosreport-sos-node1-2022-05-15-wmlomgu :      Obfuscation completed
      
      Successfully obfuscated 4 report(s)
      
      A mapping of obfuscated elements is available at
          /var/tmp/sos-collector-2022-05-15-pafsr-private_map
      
      The obfuscated archive is available at
          /var/tmp/sos-collector-2022-05-15-pafsr-obfuscated.tar.xz
      
          Size    157.10KiB
          Owner    root
      
      Please send the obfuscated archive to your support representative and keep the mapping file private

验证步骤

  • 验证 sos clean 命令是否在与命令输出中描述匹配的 /var/tmp/ 目录中创建了模糊的存档和模糊的归档。

    [user@server1 ~]$ sudo ls -l /var/tmp/sos-collector-2022-05-15-pafsr-private_map /var/tmp/sos-collector-2022-05-15-pafsr-obfuscated.tar.xz
    [sudo] password for user:
    
    -rw-------. 1 root root 160868 May 15 16:10 /var/tmp/sos-collector-2022-05-15-pafsr-obfuscated.tar.xz
    -rw-------. 1 root root  96622 May 15 16:10 /var/tmp/sos-collector-2022-05-15-pafsr-private_map
  • 检查 *-private_map 文件中的 obfuscation 映射:

    [user@server1 ~]$ sudo cat /var/tmp/sos-collector-2022-05-15-pafsr-private_map
    [sudo] password for user:
    
    {
        "hostname_map": {
            "pmoravec-rhel8": "host0"
        },
        "ip_map": {
            "10.44.128.0/22": "100.0.0.0/22",
    ..
        "username_map": {
            "foobaruser": "obfuscateduser0",
            "jsmith": "obfuscateduser1",
            "johndoe": "obfuscateduser2"
        }
    }
重要

保持原始的 unobfuscated 归档和 *private_map 文件,因为红帽支持可能会引用您需要转换为原始值的模糊术语。

1.6. 生成 sos 报告并使用 GPG 密码短语加密进行保护

这个步骤描述了如何生成 sos 报告,并使用一个密码口令对报告的数据进行对称 GPG2 加密保护。您可能希望使用密码保护 sos 报告的内容,例如您需要通过公共网络将其传送到第三方时。

注意

确定您在创建加密的 sos 报告时有足够的空间,因为它会临时使用双倍磁盘空间:

  1. sos 工具会创建一个未加密的 sos 报告。
  2. 该工具将 sos 报告加密作为一个新文件。
  3. 然后,这个工具会删除未加密的报告。

先决条件

  • 已安装 sos 软件包。
  • 您需要 root 权限。

流程

  1. 运行 sos report 命令并使用 --encrypt-pass 选项指定密码短语。您可以添加 --upload 选项,以在生成后将 sos 报告立即转移到红帽。

    [user@server1 ~]$ sudo sos report --encrypt-pass my-passphrase
    [sudo] password for user:
    
    sosreport (version 4.2)
    
    This command will collect diagnostic and configuration information from
    this Red Hat Enterprise Linux system and installed applications.
    
    An archive containing the collected information will be generated in
    /var/tmp/sos.6lck0myd and may be provided to a Red Hat support
    representative.
    
    ...
    
    Press ENTER to continue, or CTRL-C to quit.
  2. (可选) 如果您已经向红帽创建了技术支持问题单,请输入问题单号将其嵌入到 sos 报告文件名称中,如果您指定了 --upload 选项,则会上传到该问题单。如果您没有问题单号,请将此字段留空。输入问题单号是可选的,不会影响 sos 实用程序的操作。

    Please enter the case id that you are generating this report for []: <8-digit_case_number>
  3. 记录下控制台输出末尾显示的 sos 报告文件名称。

    Finished running plugins
    Creating compressed archive...
    
    Your sosreport has been generated and saved in:
    /var/tmp/secured-sosreport-server1-12345678-2022-01-24-ueqijfm.tar.xz.gpg
    
    Size    17.53MiB
    Owner   root
    md5     32e2bdb23a9ce3d35d59e1fc4c91fe54
    
    Please send this file to your support representative.

验证步骤

  1. 验证 sos 工具是否创建了满足以下要求的归档:

    • 文件名称以 secured 开头。
    • 文件名称以 .gpg 扩展名结尾。
    • 位于 /var/tmp/ 目录中。

      [user@server1 ~]$ sudo ls -l /var/tmp/sosreport*
      [sudo] password for user:
      -rw-------. 1 root root 18381537 Jan 24 17:55 /var/tmp/secured-sosreport-server1-12345678-2022-01-24-ueqijfm.tar.xz.gpg
  2. 确定您可以使用您用来加密的同一密码短语解密存档。

    1. 使用 gpg 命令解密归档。

      [user@server1 ~]$ sudo gpg --output decrypted-sosreport.tar.gz --decrypt /var/tmp/secured-sosreport-server1-12345678-2022-01-24-ueqijfm.tar.xz.gpg
    2. 在提示时,输入用来加密归档的密码短语。

      ┌──────────────────────────────────────────────────────┐
      │ Enter passphrase                                     │
      │                                                      │
      │                                                      │
      │ Passphrase: <passphrase>                             │
      │                                                      │
      │       <OK>                              <Cancel>     │
      └──────────────────────────────────────────────────────┘
    3. 验证 gpg 工具是否生成带有 .tar.gz 文件扩展名的未加密归档。

      [user@server1 ~]$ sudo ls -l decrypted-sosreport.tar.gz
      [sudo] password for user:
      -rw-r--r--. 1 root root 18381537 Jan 24 17:59 decrypted-sosreport.tar.gz

1.7. 生成一个sos 报告,并使用基于一个密钥对的 GPG 加密对其进行保护

这个步骤描述了如何根据 GPG 密钥环中的密钥来生成 sos 报告并使用 GPG2 加密进行保护。您可以使用这种加密方式来保护 sos 报告的内容,例如您需要保护保存在一个服务器中的 sos 报告内容。

注意

确定您在创建加密的 sos 报告时有足够的空间,因为它会临时使用双倍磁盘空间:

  1. sos 工具会创建一个未加密的 sos 报告。
  2. 该工具将 sos 报告加密作为一个新文件。
  3. 然后,这个工具会删除未加密的报告。

先决条件

  • 已安装 sos 软件包。
  • 您需要 root 权限。
  • 您已创建了 GPG2 密钥。

流程

  1. 运行 sos report 命令并使用 --encrypt-key 选项指定拥有 GPG 密钥环的用户名。您可以添加 --upload 选项,以在生成后将 sos 报告立即转移到红帽。

    注意

    运行 sos report 命令的用户必须是拥有用于加密和解密 sos 报告的 GPG 密钥环的用户。如果用户使用 sudo 运行 sos 报告 命令,还必须使用 sudo 设置密钥环,或者用户必须具有对该帐户的直接 shell 访问权限。

    [user@server1 ~]$ sudo sos report --encrypt-key root
    [sudo] password for user:
    
    sosreport (version 4.2)
    
    This command will collect diagnostic and configuration information from
    this Red Hat Enterprise Linux system and installed applications.
    
    An archive containing the collected information will be generated in
    /var/tmp/sos.6ucjclgf and may be provided to a Red Hat support
    representative.
    
    ...
    
    Press ENTER to continue, or CTRL-C to quit.
  2. (可选) 如果您已经向红帽创建了技术支持问题单,请输入问题单号将其嵌入到 sos 报告文件名称中,如果您指定了 --upload 选项,则会上传到该问题单。如果您没有问题单号,请将此字段留空。输入问题单号是可选的,不会影响 sos 实用程序的操作。

    Please enter the case id that you are generating this report for []: <8-digit_case_number>
  3. 记录下控制台输出末尾显示的 sos 报告文件名称。

    ...
    Finished running plugins
    Creating compressed archive...
    
    Your sosreport has been generated and saved in:
    /var/tmp/secured-sosreport-server1-23456789-2022-02-27-zhdqhdi.tar.xz.gpg
    
    Size    15.44MiB
    Owner   root
    md5     ac62697e33f3271dbda92290583d1242
    
    Please send this file to your support representative.

验证步骤

  1. 验证 sos 工具是否创建了满足以下要求的归档:

    • 文件名称以 secured 开头。
    • 文件名称以 .gpg 扩展名结尾。
    • 位于 /var/tmp/ 目录中。

      [user@server1 ~]$ sudo ls -l /var/tmp/sosreport*
      [sudo] password for user:
      -rw-------. 1 root root 16190013 Jan 24 17:55 /var/tmp/secured-sosreport-server1-23456789-2022-01-27-zhdqhdi.tar.xz.gpg
  2. 确定您可以使用您用来加密的同一密钥解密存档。

    1. 使用 gpg 命令解密归档。

      [user@server1 ~]$ sudo gpg --output decrypted-sosreport.tar.gz --decrypt /var/tmp/secured-sosreport-server1-23456789-2022-01-27-zhdqhdi.tar.xz.gpg
    2. 提示时,请输入创建 GPG 密钥时使用的密码短语。

      ┌────────────────────────────────────────────────────────────────┐
      │ Please enter the passphrase to unlock the OpenPGP secret key:  │
      │ "GPG User (first key) <root@example.com>"                      │
      │ 2048-bit RSA key, ID BF28FFA302EF4557,                         │
      │ created 2020-01-13.                                            │
      │                                                                │
      │                                                                │
      │ Passphrase: <passphrase>                                       │
      │                                                                │
      │         <OK>                                    <Cancel>       │
      └────────────────────────────────────────────────────────────────┘
    3. 验证 gpg 工具是否生成带有 .tar.gz 文件扩展名的未加密归档。

      [user@server1 ~]$ sudo ll decrypted-sosreport.tar.gz
      [sudo] password for user:
      -rw-r--r--. 1 root root 16190013 Jan 27 17:47 decrypted-sosreport.tar.gz

1.8. 创建 GPG2 密钥

下面的步骤描述了如何生成使用加密工具的 GPG2 密钥。

先决条件

  • 您需要 root 权限。

流程

  1. 安装并配置 pinentry 工具。

    [root@server ~]# yum install pinentry
    [root@server ~]# mkdir ~/.gnupg -m 700
    [root@server ~]# echo "pinentry-program /usr/bin/pinentry-curses" >> ~/.gnupg/gpg-agent.conf
  2. 创建一个 key-input 文件来生成附带您想要的详细信息的 GPG 密钥对。例如:

    [root@server ~]# cat >key-input <<EOF
    %echo Generating a standard key
    Key-Type: RSA
    Key-Length: 2048
    Name-Real: GPG User
    Name-Comment: first key
    Name-Email: root@example.com
    Expire-Date: 0
    %commit
    %echo Finished creating standard key
    EOF
  3. (可选) 默认情况下,GPG2 在 ~/.gnupg 文件中保存其密钥环。要使用自定义的密钥环位置,请将 GNUPGHOME 环境变量设置为只可由根用户访问的目录。

    [root@server ~]# export GNUPGHOME=/root/backup
    
    [root@server ~]# mkdir -p $GNUPGHOME -m 700
  4. 根据 key-input 文件的内容生成一个新的 GPG2 密钥。

    [root@server ~]# gpg2 --batch --gen-key key-input
  5. 输入密码短语来保护 GPG2 密钥。您可以使用这个密码短语访问解密的私钥。

    ┌──────────────────────────────────────────────────────┐
    │ Please enter the passphrase to                       │
    │ protect your new key                                 │
    │                                                      │
    │ Passphrase: <passphrase>                             │
    │                                                      │
    │	 <OK>                             <Cancel>         │
    └──────────────────────────────────────────────────────┘
  6. 再输入一次来确认正确的密码短语。

    ┌──────────────────────────────────────────────────────┐
    │ Please re-enter this passphrase                      │
    │                                                      │
    │ Passphrase: <passphrase>                             │
    │                                                      │
    │	 <OK>                             <Cancel>         │
    └──────────────────────────────────────────────────────┘
  7. 验证新 GPG2 密钥是否已成功创建。

    gpg: keybox '/root/backup/pubring.kbx' created
    gpg: Generating a standard key
    gpg: /root/backup/trustdb.gpg: trustdb created
    gpg: key BF28FFA302EF4557 marked as ultimately trusted
    gpg: directory '/root/backup/openpgp-revocs.d' created
    gpg: revocation certificate stored as '/root/backup/openpgp-revocs.d/8F6FCF10C80359D5A05AED67BF28FFA302EF4557.rev'
    gpg: Finished creating standard key

验证步骤

  • 列出服务器中的 GPG 密钥。

    [root@server ~]# gpg2 --list-secret-keys
    gpg: checking the trustdb
    gpg: marginals needed: 3  completes needed: 1  trust model: pgp
    gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
    /root/backup/pubring.kbx
    ------------------------
    sec   rsa2048 2020-01-13 [SCEA]
          8F6FCF10C80359D5A05AED67BF28FFA302EF4557
    uid           [ultimate] GPG User (first key) <root@example.com>

其它资源

1.9. 从救援环境中生成 sos 报告

如果一个 Red Hat Enterprise Linux(RHEL)主机无法正确引导,您可以将主机引导至 救援环境 中来收集 sos 报告。

使用救援环境,您可以在 /mnt/sysimage 下挂载目标系统,访问其内容并运行 sos report 命令。

先决条件

  • 如果主机是裸机服务器,则需要对该机器进行的物理访问。
  • 如果主机是虚拟机,您需要访问虚拟机管理程序中的虚拟机设置。
  • RHEL 安装源,如 ISO 镜像文件、安装 DVD、netboot CD 或提供 RHEL 安装树的 Preboot Execution Environment(PXE)配置。

流程

  1. 从安装源引导主机。
  2. 在安装介质的引导菜单中,选择 Troubleshooting 选项。

    选择了 Troubleshooting 选项的 RHEL Anaconda 安装程序屏幕截图
  3. 在故障排除菜单中选择 Rescue a Red Hat Enterprise Linux system 选项。

    选择 Rescue 选项的故障排除页面截图
  4. 在 Rescue 菜单中,选择 1 并按 Enter 键继续,并在 /mnt/sysimage 目录下挂载系统。

    Rescue 屏幕提示您继续并将目标主机挂载到 /mnt/sysimage 的截图
  5. 提示时按 Enter 键进行一个 shell。

    Rescue 屏幕提示您按 Enter 键进入救援 shell 提示的截屏
  6. 使用 chroot 命令将救援会话的显式根目录改为 /mnt/sysimage

    使用 chroot 命令将识别的根目录改为 /mnt/sysimage 后的 Rescue 会话截图
  7. 可选: 您的网络将不能在初始救援环境中启动,因此请确保首先建立它。例如,如果网络需要静态 IP 地址,并且您希望通过网络传输 sos 报告,请配置网络:

    1. 确定您要使用的以太网设备:

      # ip link show
      …​
      2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
          link/ether 52:54:00:74:79:56 brd ff:ff:ff:ff:ff:ff
    2. 为网络接口分配一个 IP 地址,并设置默认网关。例如,如果您要将子网为 255.255.255.0 的 IP 地址 192.168.0.1(其 CIDR 为 24 )添加到设备 enp1s0,请输入:

      # ip address add <192.168.0.1/24> dev <enp1s0>
      # ip route add default via <192.168.0.254>
    3. /etc/resolv.conf 文件中添加一个 nameserver 条目,例如:

      # nameserver <192.168.0.5>
  8. 运行 sos report 命令并按照屏幕的说明进行操作。您可以添加 --upload 选项,以在生成后将 sos 报告立即转移到红帽。

    sos 实用程序提示您按 Enter 键继续运行 sos 报告的截图
  9. (可选) 如果您已经向红帽创建了技术支持问题单,请输入问题单号将其嵌入到 sos 报告文件名称中,如果您指定了 --upload 选项且您的主机已连接到互联网,则会上传到该问题单。如果您没有问题单号,请将此字段留空。输入问题单号是可选的,不会影响 sos 实用程序的操作。

    sos 实用程序提示您输入可选的红帽技术支持问题单号的截图
  10. 记录下控制台输出末尾显示的 sos 报告文件名称。

    sos 实用程序报告结果存档位置的截图
  11. 如果您的主机还没有连接到互联网,使用 scpsos 报告传送到网络中的另一台主机,然后将其上传到红帽技术支持问题单。

验证步骤

  • 验证 sos 工具是否在 /var/tmp/ 目录中创建了一个存档。

    终端窗口显示 /var/tmp/ 目录的文件列表结果的截图

其它资源

1.10. 向红帽技术支持提供 sos 报告的方法

您可以使用以下方法将 sos 报告上传到红帽技术支持。

使用 sos report 命令上传

您可以使用 --upload 选项,在生成后将 sos 报告立即转移到红帽。

  • 如果您在提示时提供了一个问题单号,或者使用了 --case-id--ticket-number 选项,sos 工具会在使用红帽客户门户网站帐户验证后将 sos 报告上传到您的问题单中。
  • 如果没有提供问题单号或者您没有验证,则工具会将 sos 报告上传到红帽公共 SFTP 网站。为红帽技术支持工程师提供 sos 报告归档的名称,以便可以访问它。

    [user@server1 ~]$ sudo sos report --upload
    [sudo] password for user:
    
    sosreport (version 4.2)
    
    This command will collect diagnostic and configuration information from
    this Red Hat Enterprise Linux system and installed applications.
    ...
    
    Please enter the case id that you are generating this report for []: <8-digit_case_number>
    Enter your Red Hat Customer Portal username (empty to use public dropbox): <Red_Hat_Customer_Portal_ID>
    Please provide the upload password for <user@domain.com>:
    ...
    
    Attempting upload to Red Hat Customer Portal
    Uploaded archive successfully
通过红帽客户门户网站上传文件

使用您的红帽用户帐户,您可以登录到红帽客户门户网站网页的支持问题单部分,并将 sos 报告上传到技术支持问题单中。

要登录,请访问支持问题单

使用红帽支持工具上传文件

通过红帽支持工具,您可以直接将文件从命令行上传到红帽技术支持问题单。问题单号是必需的。

[user@server1 ~]$ redhat-support-tool addattachment -c <8-digit_case_number> </var/tmp/sosreport_filename>

其它资源

第 2 章 使用 RHEL web 控制台生成和维护诊断报告

在 RHEL web 控制台中生成、下载和安装诊断报告。

2.1. 使用 RHEL web 控制台生成诊断报告

先决条件

  • 已安装 RHEL web 控制台。详情请参阅安装 Web 控制台
  • cockpit-storaged 软件包已安装在您的系统上。
  • 有管理员特权。

流程

  1. 登录到 RHEL web 控制台。详情请参阅 Web 控制台的日志记录
  2. 在左侧菜单中,选择 Tools >> Diagnostic reports
  3. 要生成新的诊断报告,请点击 Run report 按钮。

    运行报告屏幕的截图
  4. 输入您要创建的报告的标签。
  5. (可选) 自定义您的报告。

    1. 输入加密密码短语来加密您的报告。如果要跳过报告加密,请将该字段留空。
    2. 选中 Obfuscate network addresses, hostnames, and usernames 复选框,来混淆某些数据。
    3. 选中 Use verbose logging 复选框,以提高日志记录的详细程度。
  6. 单击 Run report 按钮,来生成报告并等待进程完成。您可以使用 Stop report 按钮停止生成报告。

2.2. 使用 RHEL web 控制台下载诊断报告

先决条件

  • 已安装 RHEL web 控制台。详情请参阅安装 Web 控制台
  • 有管理员特权。
  • 已生成一个或多个诊断报告。

流程

  1. 登录到 RHEL web 控制台。详情请参阅 Web 控制台的日志记录
  2. 在左侧菜单中,选择 Tools >> Diagnostic reports
  3. 点击您要下载的报告旁边的 Download 按钮。下载将自动启动。

后续步骤

有关如何向红帽技术支持提供您的诊断报告的方法,请参阅 向红帽技术支持提供 sos 报告的方法

2.3. 使用 RHEL web 控制台删除诊断报告

先决条件

  • 已安装 RHEL web 控制台。详情请参阅安装 Web 控制台
  • 有管理员特权。
  • 已生成一个或多个诊断报告。

流程

  1. 登录到 RHEL web 控制台。详情请参阅 Web 控制台的日志记录
  2. 在左侧菜单中,选择 Tools >> Diagnostic reports
  3. 点您要删除报告旁的 Download 按钮旁的垂直省略号,然后点 Delete 按钮。
  4. Delete report permanent? 窗口中,单击 Delete 按钮来删除报告。

法律通告

Copyright © 2024 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.