Tag Archives: how to read sosreport

xsos: a tool to read sosreport in RHEL/CentOS

Learn how to use xsos tool to read sosreport in RHEL/CentOS. xsos is a very helpful tool for Linux sysadmins. Different options and their examples included in the article.

xsos tool to read sosreport

an xsos tool is a tool coded to read a sosreport on Linux systems. sosreport is a tool from RedHat which collects system information which helps vendors to troubleshoot issues. sosreport creates the tarball which contains all the system information but you can not read it directly. For simplicity, Ryan Sawhill created a tool named xsos which will help you to read sosreport in a much easier way in your terminal itself. In this article, we will walk you through how to read sosreport on the Linux terminal.

xsos installation

xsos rpm is available on Ryan’s page on redhat.com. One can simply use the URL as below to install his yum repo and then install the xsos package.

yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm &

yum install xsos

Refer below outputs for your reference.

root@kerneltalks # yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
latest-rsawaroha-release.rpm                             |  24 kB     00:00
Examining /var/tmp/yum-root-b0cGf5/latest-rsawaroha-release.rpm: rsawaroha-release-1-1.noarch
Marking /var/tmp/yum-root-b0cGf5/latest-rsawaroha-release.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rsawaroha-release.noarch 0:1-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch       Version   Repository                     Size
================================================================================
Installing:
 rsawaroha-release     noarch     1-1       /latest-rsawaroha-release      27 k

Transaction Summary
================================================================================
Install  1 Package

Total size: 27 k
Installed size: 27 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : rsawaroha-release-1-1.noarch                                 1/1
  Verifying  : rsawaroha-release-1-1.noarch                                 1/1

Installed:
  rsawaroha-release.noarch 0:1-1

Complete!


root@kerneltalks # yum install xsos
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
rsawaroha                                                | 2.9 kB     00:00
rsawaroha/primary_db                                       |  11 kB   00:00
Resolving Dependencies
--> Running transaction check
---> Package xsos.noarch 0:0.7.13-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch             Version              Repository           Size
================================================================================
Installing:
 xsos           noarch           0.7.13-1             rsawaroha            54 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 54 k
Installed size: 137 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/rsawaroha/packages/latest-xsos.rpm: Header V4 RSA/SHA256 Signature, key ID 4c4ffd02: NOKEY
Public key for latest-xsos.rpm is not installed
latest-xsos.rpm                                            |  54 kB   00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rsaw.aroha
Importing GPG key 0x4C4FFD02:
 Userid     : "Ryan Sawhill Aroha <rsaw@redhat.com>"
 Fingerprint: bac2 74b8 9f6b 5907 b3d0 e467 fba4 72a7 4c4f fd02
 Package    : rsawaroha-release-1-1.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-rsaw.aroha
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : xsos-0.7.13-1.noarch                                         1/1
  Verifying  : xsos-0.7.13-1.noarch                                         1/1

Installed:
  xsos.noarch 0:0.7.13-1

Complete!

Now xsos utility is installed on your system. Lets check it out.

Using xsos

Without any argument, running xsos command will give you current system information in a summarized format.

root@kerneltalks # xsos
OS
  Hostname: kerneltalks
  Distro:   [redhat-release] Red Hat Enterprise Linux Server release 7.4 (Maipo)
            [os-release] Red Hat Enterprise Linux Server 7.4 (Maipo) 7.4 (Maipo)
  RHN:      serverURL = https://enter.your.server.url.here/XMLRPC
            enableProxy = 0
  RHSM:     hostname = subscription.rhsm.redhat.com
            proxy_hostname =
  YUM:      4 enabled plugins: amazon-id, langpacks, rhui-lb, search-disabled-repos
  Runlevel: N 3  (default multi-user)
  SELinux:  enforcing  (default enforcing)
  Arch:     mach=x86_64  cpu=x86_64  platform=x86_64
  Kernel:
    Booted kernel:  3.10.0-693.11.6.el7.x86_64
    GRUB default:   3.10.0-693.11.6.el7.x86_64
    Build version:
      Linux version 3.10.0-693.11.6.el7.x86_64 (mockbuild@x86-041.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Thu Dec 28
      14:23:39 EST 2017
    Booted kernel cmdline:
      root=UUID=3e11801e-5277-4d87-be4c-0a9a61fbc3da ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 crashkernel=auto LANG=en_US.UTF-8
    GRUB default kernel cmdline:
      ro root=UUID=3e11801e-5277-4d87-be4c-0a9a61fbc3da console=hvc0 LANG=en_US.UTF-8
    Taint-check: 0  (kernel untainted)
    - - - - - - - - - - - - - - - - - - -
  Sys time:  Mon Jan  8 18:13:30 UTC 2018
  Boot time: Mon Jan  8 18:05:57 UTC 2018  (epoch: 1515434757)
  Uptime:    7 min,  1 user
  LoadAvg:   [1 CPU] 0.00 (0%), 0.01 (1%), 0.01 (1%)
  /proc/stat:
    procs_running: 2   procs_blocked: 0    processes [Since boot]: 1132
    cpu [Utilization since boot]:
      us 1%, ni 0%, sys 2%, idle 94%, iowait 0%, irq 0%, sftirq 0%, steal 3%

It shows system info like hostname, distro details, kernel details, arch details, yum config, date & time, and load information.

Now there are different switches you can use with xsos command and get the required details. Frequently used switches given below –

 -a     show everything
 -b     show info from dmidecode
 -o     show hostname, distro, SELinux, kernel info, uptime, etc
 -k     inspect kdump configuration
 -c     show info from /proc/cpuinfo
 -m     show info from /proc/meminfo
 -d     show info from /proc/partitions
 -t     show info from dm-multipath
 -i     show info from ip addr

Above is a snippet from help. Full list of switches can be obtained by running help using xsos -h

Reading sosreport using xsos

To read sosreport using xsos tool, you need to first extract sosreport tarball and use the extracted directory path as a source for the xsos tool. The command format is –

xsos –<switch> <sosreport_dir_path>

For example, lets see CPU information read from sosreport.

root@kerneltalks # xsos -c /var/tmp/sosreport-kerneltalks-20180108180100
CPU
  1 logical processors
  1 Intel Xeon CPU E5-2676 v3 @ 2.40GHz (flags: aes,constant_tsc,ht,lm,nx,pae,rdrand)

Here, -c instructs xsos command to read CPU information from sosreport which is saved in /var/tmp/sosreport-kerneltalks-20180108180100 directory.

Another example below which reads IP information from sosreport.

root@kerneltalks # xsos -i /var/tmp/sosreport-kerneltalks-20180108180100
IP4
  Interface  Master IF  MAC Address        MTU     State  IPv4 Address
  =========  =========  =================  ======  =====  ==================
  lo         -          -                  65536   up     127.0.0.1/8
  eth0       -          02:e5:4c:f8:86:0e  9001    up     172.31.29.189/20

IP6
  Interface  Master IF  MAC Address        MTU     State  IPv6 Address                                 Scope
  =========  =========  =================  ======  =====  ===========================================  =====
  lo         -          -                  65536   up     ::1/128                                      host
  eth0       -          02:e5:4c:f8:86:0e  9001    up     fe80::e5:4cff:fef8:860e/64                   link

you can see IP information fetched from stored sosreport and displayed for your understanding.

You can use different switches to fetch different information as per your requirement from the sosreport. This way you need not go through each and every logfile or log directory extracted in the sosreport directory to get the information. Just use a relevant switch with xsos utility and it will scan the sosreport directory and present your data!

All you need to know about sosreport tool

Understand sosreport in detail. Learn how to generate sosreport and how to read sosreport in this article.

sosreport

sosreport is not a new term for RedHat lovers! Its a tool on RedHat Linux which helps you grab system information in a single tarball which can be shared with the vendor for troubleshooting issues.

Whenever you log a case with RedHat for RHEL, the first thing first they ask is for sosreport. In this article, we will see how to generate a sosreport and how to read sosreport.

If sosreport package is not installed on your system you will see below error –

root@kerneltalks # sosreport
-bash: sosreport: command not found

Install sos package using yum. You can follow the installation steps explained here. Below are the installation logs for your reference.

root@kerneltalks # yum install sos
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package sos.noarch 0:3.4-6.el7 will be installed
--> Processing Dependency: bzip2 for package: sos-3.4-6.el7.noarch
--> Running transaction check
---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                        Arch                            Version                                 Repository                                                 Size
========================================================================================================================================================================
Installing:
 sos                            noarch                          3.4-6.el7                               rhui-REGION-rhel-server-releases                          381 k
Installing for dependencies:
 bzip2                          x86_64                          1.0.6-13.el7                            rhui-REGION-rhel-server-releases                           52 k

Transaction Summary
========================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 433 k
Installed size: 1.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): sos-3.4-6.el7.noarch.rpm                                                                                                                  | 381 kB  00:00:00
(2/2): bzip2-1.0.6-13.el7.x86_64.rpm                                                                                                             |  52 kB  00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   610 kB/s | 433 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : bzip2-1.0.6-13.el7.x86_64                                                                                                                            1/2
  Installing : sos-3.4-6.el7.noarch                                                                                                                                 2/2
  Verifying  : sos-3.4-6.el7.noarch                                                                                                                                 1/2
  Verifying  : bzip2-1.0.6-13.el7.x86_64                                                                                                                            2/2

Installed:
  sos.noarch 0:3.4-6.el7

Dependency Installed:
  bzip2.x86_64 0:1.0.6-13.el7

Complete!

How to generate sosreport

To generate a sosreport you just need to run sosreport command. It saves the report in /var/tmp by default so make sure you have enough breathing space in /var mount point.

Output file follows naming conventions as sosreport-name.caseID-yyyymmddhhmmss.tar.xz where –

  1. name is Name you provide or hostname by default
  2. caseID if you provide or blank
  3. Date in yyyymmdd format
  4. Time in hhmmss

Its a tarball with compression. After running the command it will ask you name and case ID and then start executing its modules which collects all system information and save it into a tarball.

root@kerneltalks # sosreport

sosreport (version 3.4)

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.iNadXY and may be provided to a Red Hat support
representative.

Any information provided to Red Hat will be treated in accordance with
the published support policies at:

  https://access.redhat.com/support/

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 changes will be made to system configuration.

Press ENTER to continue, or CTRL-C to quit.

Please enter your first initial and last name [kerneltalks]: Shrikant Lavhate
Please enter the case id that you are generating this report for []: 12345678

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Running 74/74: yum...            er...
Creating compressed archive...

Your sosreport has been generated and saved in:
  /var/tmp/sosreport-ShrikantLavhate.12345678-20171105171210.tar.xz

The checksum is: 502b698f6052964ca1c2d348ea7e67a4

Please send this file to your support representative.

Command also shows you checksum of the output file. This will be helpful in checking the integrity of the file when it reaches destination party like vendor etc.

root@kerneltalks # ll /var/tmp/sosreport-ShrikantLavhate.12345678-20171105171210.tar.xz
-rw-------. 1 root root 8519732 Nov  5 17:12 /var/tmp/sosreport-ShrikantLavhate.12345678-20171105171210.tar.xz

How to read sosreport

The output report generated above is the tarball file. You can un-tar it and read it on your own as well.

root@kerneltalks # tar xvf /var/tmp/sosreport-ShrikantLavhate.12345678-20171105171210.tar.xz

After extracting tarball you can see directory created with tarball name. Under which you can file many files and directories.

root@kerneltalks # ls -lrt sosreport-ShrikantLavhate.12345678-20171105171210
total 16
drwxr-xr-x.  5 root root   42 Jul 11 15:57 usr
dr-xr-xr-x.  3 root root   19 Jul 11 16:07 boot
dr-xr-xr-x. 10 root root 4096 Nov  5 12:19 proc
dr-xr-xr-x. 10 root root  112 Nov  5 12:19 sys
drwxr-xr-x.  4 root root   28 Nov  5 12:19 var
drwxr-xr-x.  2 root root   18 Nov  5 12:19 dev
dr-xr-xr-x.  7 root root   78 Nov  5 12:24 lib
dr-xr-x---.  2 root root   29 Nov  5 16:23 root
drwxr-xr-x. 34 root root 4096 Nov  5 17:08 etc
lrwxrwxrwx.  1 root root   29 Nov  5 17:12 mount -> sos_commands/filesys/mount_-l
lrwxrwxrwx.  1 root root   27 Nov  5 17:12 df -> sos_commands/filesys/df_-al
lrwxrwxrwx.  1 root root   27 Nov  5 17:12 uptime -> sos_commands/general/uptime
lrwxrwxrwx.  1 root root   28 Nov  5 17:12 uname -> sos_commands/kernel/uname_-a
drwx------.  3 root root   18 Nov  5 17:12 sos_strings
lrwxrwxrwx.  1 root root   25 Nov  5 17:12 lsmod -> sos_commands/kernel/lsmod
lrwxrwxrwx.  1 root root   45 Nov  5 17:12 java -> sos_commands/java/alternatives_--display_java
lrwxrwxrwx.  1 root root   29 Nov  5 17:12 hostname -> sos_commands/general/hostname
lrwxrwxrwx.  1 root root   31 Nov  5 17:12 dmidecode -> sos_commands/hardware/dmidecode
lrwxrwxrwx.  1 root root   25 Nov  5 17:12 date -> sos_commands/general/date
lrwxrwxrwx.  1 root root   32 Nov  5 17:12 route -> sos_commands/networking/route_-n
lrwxrwxrwx.  1 root root   30 Nov  5 17:12 ps -> sos_commands/process/ps_auxwww
lrwxrwxrwx.  1 root root   41 Nov  5 17:12 netstat -> sos_commands/networking/netstat_-W_-neopa
lrwxrwxrwx.  1 root root   22 Nov  5 17:12 last -> sos_commands/last/last
lrwxrwxrwx.  1 root root   34 Nov  5 17:12 ip_addr -> sos_commands/networking/ip_-o_addr
lrwxrwxrwx.  1 root root   24 Nov  5 17:12 free -> sos_commands/memory/free
lrwxrwxrwx.  1 root root  130 Nov  5 17:12 installed-rpms -> sos_commands/rpm/sh_-c_rpm_--nodigest_-qa_--qf_NAME_-_VERSION_-_RELEASE_._ARCH_INSTALLTIME_date_awk_-F_printf_-59s_s_n_1_2_sort_-f
lrwxrwxrwx.  1 root root   38 Nov  5 17:12 chkconfig -> sos_commands/services/chkconfig_--list
-rw-r--r--.  1 root root 1481 Nov  5 17:12 version.txt
drwx------.  2 root root   37 Nov  5 17:12 sos_reports
drwx------.  2 root root   35 Nov  5 17:12 sos_logs
drwx------. 43 root root 4096 Nov  5 17:12 sos_commands
drwxr-xr-x.  3 root root   19 Nov  5 17:12 run

Navigate to sos_reports directory within which you will find sos.txtsos.html file.

In sos.txt file you can see all the plugins loaded, the command executed, files copied by sosreport. In sos.html file, all these things are hyperlinked to their original content within the directory. So you can directly view command output or files which are copied by script.

If there are any alerts detected by sosreport it will highlight those at the very beginning of these files.

This information is for sosreport version 3.4. If you are running different version there might be small differences in information.