What is sosreport and How to Create sosreport in RHEL/CentOS/OL?

What is sosreport

The sosreport command is a tool that collects configuration information, system information, and diagnostic information from the system running on the RHEL, CentOS, and Oracle Linux in particular.

This enables the technical support engineer to analyze the system in several aspects.

This reports contain the following information about the system.

  • Boot Information
  • File System Information
  • Memory Details
  • Host Name
  • List of Installed RPMs
  • System IP
  • Network Details
  • OS Version
  • Installed Kernel
  • List of loaded Kernel modules
  • List of open files
  • List of PCI devices
  • Mounted devices and it’s details
  • Running Process Information
  • Process tree output
  • System routing

These files are usually located in the /etc directory and in the /var/log directory.

Typically the Linux directory structure contains configuration files under the /etc directory and the log files are located under the /var/log directory.

It may take some time to create a sosport, which depends on your system package installation and configuration.

When finished, it will create a compressed archive file under the /tmp directory.

Whenever you create a case with them for initial analysis you need to attach the sosreport to the Red Hat and Oracle Linux support portal.

This enables the support engineer to perform first level troubleshooting to identify if something is wrong with the system.

How to Install sosreport on RHEL/CentOS/OL Systems

sosreport installation is not a big deal, run the following command to install it as this package is available in the distribution official repository.

For RHEL/CentOS/OL system, use YUM Command to install sosreport.

# yum install sos

For Fedora/RHEL 8/CentOS 8/OL 8 system, use DNF Command to install sosreport.

# dnf install sos

How to Generate sosreport on RHEL/CentOS/OL Systems

Run the sosreport command with no option to create sosreport.

By default it does not show much information when creating a sosreport and only shows how many reports are generated.

If you would like to see more detailed information, add the -v option when creating sosreport.

This will prompt you to enter your name and support case information when you run the sosreport command.

# sosreport

sosreport (version 3.2)

This command will collect diagnostic and configuration information from this Oracle Linux system and installed applications.

An archive containing the collected information will be generated in /tmp/sos.3pt1yJ and may be provided to a Oracle USA support representative.

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

  http://linux.oracle.com/

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 [oracle.2daygeek.com]: 2daygeek
Please enter the case id that you are generating this report for []: 3-16619296812

Setting up archive ...
Setting up plugins ...
dbname must be supplied to dump a database.
Running plugins. Please wait ...

  Running 86/86: yum...
[plugin:kvm] could not unmount /sys/kernel/debug
Creating compressed archive...

Your sosreport has been generated and saved in:

  /tmp/sosreport-2daygeek.3-16619296812-20180307124921.tar.xz
  
The checksum is: 4e80226ae175bm185c0o2d7u2yoac52o

Please send this file to your support representative.

What Kind of Details are in the Archive File?

I’m curious to know what kind of details are in the archive file. To understand this, I’m gonna to extract this archive file on my system.

Use the below tar command to extract the tar archive file.

# tar -xf /tmp/sosreport-2daygeek.3-16619296812-20180307124921.tar.xz

To see what information is captured by sosreport, go to the file extracted directory and view them.

# ls -lh sosreport-2daygeek.3-16619296812-20180307124921

total 60K
dr-xr-xr-x  4 root root 4.0K Sep 30 10:56 boot
lrwxrwxrwx  1 root root   37 Oct 20 07:25 chkconfig -> sos_commands/startup/chkconfig_--list
lrwxrwxrwx  1 root root   25 Oct 20 07:25 date -> sos_commands/general/date
lrwxrwxrwx  1 root root   27 Oct 20 07:25 df -> sos_commands/filesys/df_-al
lrwxrwxrwx  1 root root   31 Oct 20 07:25 dmidecode -> sos_commands/hardware/dmidecode
drwxr-xr-x 43 root root 4.0K Oct 20 07:21 etc
lrwxrwxrwx  1 root root   24 Oct 20 07:25 free -> sos_commands/memory/free
lrwxrwxrwx  1 root root   29 Oct 20 07:25 hostname -> sos_commands/general/hostname
lrwxrwxrwx  1 root root  130 Oct 20 07:25 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   34 Oct 20 07:25 ip_addr -> sos_commands/networking/ip_-o_addr
lrwxrwxrwx  1 root root   45 Oct 20 07:25 java -> sos_commands/java/alternatives_--display_java
drwxr-xr-x  4 root root 4.0K Sep 30 10:56 lib
lrwxrwxrwx  1 root root   35 Oct 20 07:25 lsb-release -> sos_commands/lsbrelease/lsb_release
lrwxrwxrwx  1 root root   25 Oct 20 07:25 lsmod -> sos_commands/kernel/lsmod
lrwxrwxrwx  1 root root   36 Oct 20 07:25 lsof -> sos_commands/process/lsof_-b_M_-n_-l
lrwxrwxrwx  1 root root   22 Oct 20 07:25 lspci -> sos_commands/pci/lspci
lrwxrwxrwx  1 root root   29 Oct 20 07:25 mount -> sos_commands/filesys/mount_-l
lrwxrwxrwx  1 root root   38 Oct 20 07:25 netstat -> sos_commands/networking/netstat_-neopa
drwxr-xr-x  3 root root 4.0K Oct 19 16:16 opt
dr-xr-xr-x 10 root root 4.0K Jun 23  2017 proc
lrwxrwxrwx  1 root root   30 Oct 20 07:25 ps -> sos_commands/process/ps_auxwww
lrwxrwxrwx  1 root root   27 Oct 20 07:25 pstree -> sos_commands/process/pstree
dr-xr-x---  2 root root 4.0K Oct 17 12:09 root
lrwxrwxrwx  1 root root   32 Oct 20 07:25 route -> sos_commands/networking/route_-n
dr-xr-xr-x  2 root root 4.0K Sep 30 10:55 sbin
drwx------ 54 root root 4.0K Oct 20 07:21 sos_commands
drwx------  2 root root 4.0K Oct 20 07:21 sos_logs
drwx------  2 root root 4.0K Oct 20 07:21 sos_reports
dr-xr-xr-x  6 root root 4.0K Jun 23  2017 sys
lrwxrwxrwx  1 root root   28 Oct 20 07:25 uname -> sos_commands/kernel/uname_-a
lrwxrwxrwx  1 root root   27 Oct 20 07:25 uptime -> sos_commands/general/uptime
drwxr-xr-x  6 root root 4.0K Sep 25  2014 var
-rw-------  1 root root 1.7K Oct 20 07:21 version.txt
lrwxrwxrwx  1 root root   62 Oct 20 07:25 vgdisplay -> sos_commands/lvm2/vgdisplay_-vv_--config_global_locking_type_0

To confirm exactly what sosreport captured, I’m gonna look at the uname output file captured by sosreport in the above step.

# more uname_-a
Linux oracle.2daygeek.com 2.6.32-042stab127.2 #1 SMP Thu Jan 4 16:41:44 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux

For Additional Options

Visit the sosreport Man page to see all the options available to sosreport.

# sosreport --help

Usage: sosreport [options]

Options:
  -h, --help            show this help message and exit
  -l, --list-plugins    list plugins and available plugin options
  -n NOPLUGINS, --skip-plugins=NOPLUGINS
                        disable these plugins
  -e ENABLEPLUGINS, --enable-plugins=ENABLEPLUGINS
                        enable these plugins
  -o ONLYPLUGINS, --only-plugins=ONLYPLUGINS
                        enable these plugins only
  -k PLUGOPTS, --plugin-option=PLUGOPTS
                        plugin options in plugname.option=value format (see
                        -l)
  --log-size=LOG_SIZE   set a limit on the size of collected logs
  -a, --alloptions      enable all options for loaded plugins
  --all-logs            collect all available logs regardless of size
  --batch               batch mode - do not prompt interactively
  --build               preserve the temporary directory and do not package
                        results
  -v, --verbose         increase verbosity
  --verify              perform data verification during collection
  --quiet               only print fatal errors
  --debug               enable interactive debugging using the python debugger
  --ticket-number=CASE_ID
                        specify ticket number
  --case-id=CASE_ID     specify case identifier
  -p PROFILES, --profile=PROFILES
                        enable plugins selected by the given profiles
  --list-profiles
  --name=CUSTOMER_NAME  specify report name
  --config-file=CONFIG_FILE
                        specify alternate configuration file
  --tmp-dir=TMP_DIR     specify alternate temporary directory
  --no-report           Disable HTML/XML reporting
  -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE
                        compression technology to use [auto, gzip, bzip2, xz]
                        (default=auto)

Some examples:

 enable cluster plugin only and collect dlm lockdumps:
   # sosreport -o cluster -k cluster.lockdump

 disable memory and samba plugins, turn off rpm -Va collection:
   # sosreport -n memory,samba -k rpm.rpmva=off

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *