Administration toolsUbuntu

How to Generate sosreport on Ubuntu 18.04

Sosreport generates an archive of configuration and diagnostic information from the running system. The archive may be stored locally or centrally for recording or tracking purposes or may be sent to technical support representatives, developers or system administrators to assist with technical fault-finding and debugging.
Sos is modular in design and is able to collect data from a wide range of subsystems and packages that may be installed. An XML or HTML report summarizing the collected information is optionally generated and stored within the archive.
This reports contains bunch of information about the system such as boot information, filesystem, memory, hostname, installed rpms, system IP, networking details, OS version, installed kernel, loaded kernel modules, list of open files, list of PCI devices, mount point and it’s details, running process information, process tree output, system routing, all the configuration files which is located in /etc folder, and all the log files which is located in /var folder.
SOS tool is available for most of the Linux distributions (RHEL, CentOS, Ubuntu, Debian & SUSE). In this tutorial we will discuss how to generate SOS report on Ubuntu 18.04 / Ubuntu 18.10.
[box type=”note” align=”” class=”” width=””]Note: By default, SOS package is the part of default installation of Ubuntu 18.04 and Debian 9 Server.[/box]

Generating sosreport on Ubuntu 18.04 / Ubuntu 18.10 Server

Login to your server and execute the command sosreport.

sudo sosreport

You will be asked to enter some details of your system, such as system name, case id etc. Type the details accordingly, and press ENTER key to generate the report. If you don’t want to change anything and want to use the default values, simply press ENTER.
Sample output from my Ubuntu 18.04 server:

rasho@srv:~$ sudo sosreport
[sudo] password for rasho: 

sosreport (version 3.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system. An archive containing the collected
information will be generated in /tmp/sos.7iuo4j8z.

For more information on Ubuntu visit:

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 [srv]:      
Please enter the case id that you are generating this report for []: 

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

  Running 56/56: xfs...                 
Creating compressed archive...

Your sosreport has been generated and saved in:

The checksum is: bee79278800f15f6e6561b8a22255170

Please send this file to your support representative.

If you don’t want to be prompted for entering such details, simply use batch mode like below.

sudo sosreport --batch

Above command will take couple of minutes to generate the report and that report will be compressed as xz format. Apart from this, /tmp folder is the default location where sosreport is stored.
While generating the report you can also specify the CASE ID for server fault and your first name and last name.

Save sosreport to an alternate path or folder

Let’s assume you server has separate /tmp folder and which doesn’t have enough free space in that case you can instruct sosreport command to save the report to other folders using option –tmp-dir, example is shown below.

sudo sosreport --tmp-dir /mnt

Generating sosreport in different compression type

Sosreport is archived and compressed using the different compression techniques like gzip, bzip2, xz.
Default compression for sosreport is xz, if you want to use other compression techniques while generating the sosreport, then specify the options –compression-type, example is shown below:

sudo sosreport --compression-type bzip2

List all plugins for sosreport

If you are interested which plugins are available for sosreport, run the following command

sudo sosreport -l

Generate the sosreport by skipping specific plugins

While generating the sosreport, if you want to skip the data of specific plugin or modules then use -n option in sosreport command followed by plugin name
Let’s assume I am want to generate the sosreport but I want to skip udev information in that report, use the following command:

sudo sosreport -n udev --batch

Generating sosreport only for specific plugins or modules

There can be some scenarios where we are required to generate the sosreport of your server only for specific plugins, this can easily be achieved using -o option followed by the plugin name.

Sosreport for memory only

sudo sosreport -o memory --batch

Sosreport for memory and kernel plugins

sudo sosreport -o memory,kernel --batch

Additional Options

Visit help page to view all available options for sosreport.

$ sudo sosreport --help
Usage: sosreport [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
  --experimental        enable experimental plugins
                        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
  --log-size=LOG_SIZE   set a limit on the size of collected logs (in MiB)
  -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
  -v, --verbose         increase verbosity
  --verify              perform data verification during collection
  --quiet               only print fatal errors
  --debug               enable interactive debugging using the python debugger
                        specify ticket number
  --case-id=CASE_ID     specify case identifier
  -p PROFILES, --profile=PROFILES
                        enable plugins selected by the given profiles
  --list-profiles       display a list of available profiles and plugins that
                        they include
  --name=CUSTOMER_NAME  specify report name
                        specify alternate configuration file
  --tmp-dir=TMP_DIR     specify alternate temporary directory
  --no-report           disable HTML/XML reporting
  -s SYSROOT, --sysroot=SYSROOT
                        system root directory path (default='/')
  -c CHROOT, --chroot=CHROOT
                        chroot executed commands to SYSROOT [auto, always,
                        never] (default=auto)
                        compression technology to use [auto, gzip, bzip2, xz]

Some examples:

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

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

That’s all from this article, If you want to read more on sosreport command options refer is man page.

man sosreport

In case if you find this article informative then please do share your feedback and comments.

Related Articles

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button