How to Generate sosreport on Ubuntu 18.04 / Debian 9 Server

SOS is a tool which is used to collect all the system configuration, logs and diagnostic information and archive it into a single file. Sosreport is generally required for technical support engineers and developers to identify fault and sometimes it is also used for debugging purpose.

Generate-sosreport-ubuntu-debian-server

Following are the scenarios where we are required to generate sosreport:

  • Server got crashed and to find the RCA for crash
  • Server performance got degraded
  • Application performance degraded

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 and Debian 9 Sever,

Note: By default, SOS package is the part of default installation of Ubuntu 18.04 and Debian 9 Server.

Generating sosreport on Ubuntu 18.04 Server & Debian 9

Login to your server and execute the command “sosreport“.

linuxtechi@ubuntu-server:~$ sudo sosreport

sosreport-command-ubuntu18

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.

Generating sosreport in non-interactive mode

To generate the sosreport in non-interactive run the sosreport command followed by “–batch” option

linuxtechi@ubuntu-server:~$ sudo sosreport --batch

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,

linuxtechi@ubuntu-server:~$ 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

linuxtechi@ubuntu-server:~$ sudo sosreport --compression-type bzip2

List all plugins for sosreport

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

linuxtechi@ubuntu-server:~$ 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,

linuxtechi@ubuntu-server:~$ 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,

linuxtechi@ubuntu-server:~$ sudo sosreport -o memory --batch

sosreport for memory and kernel plugins,

linuxtechi@ubuntu-server:~$ sudo sosreport -o memory,kernel --batch

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.

Leave a Comment