Tag Archives: create a sosreport

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.