How do I make sosreport write to an alternative location?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 4.6 and later
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • sosreport

Issue

  • Is there a way to force sosreport to use a different directory than /tmp?
  • sosreport fails because there is not enough space in /tmp.

Resolution

NOTE: The solution depends on the "sos" package version.

  • To verify the sos package version, run:

    # rpm -qa sos
    

For Red Hat Enterprise Linux 5.7 and above:

  • If the sosreport version is sos-1.7-9.54.el5 or above, typically:

    • Red Hat Enterprise Linux 5.7 and later.
  • Use the --tmp-dir option of sosreport to temporarily change the destination:

    # mkdir /root/sos
    # sosreport --tmp-dir /root/sos
    
  • The example above will generate the sosreport under /root/sos instead of /tmp.

For Red Hat Enterprise Linux between RHEL 4.6 and RHEL 5.6

  • If the sosreport version is sos-1.7-9.49.el5 or below, typically:

    • Red Hat Enterprise Linux 4.6 and later.
    • Red Hat Enterprise Linux 5.6 and earlier.
  • Use the $TMP environment variable to temporarily change the destination:

    # mkdir /root/sos
    # env TMP=/root/sos/ sosreport
    
  • The example above will generate the sosreport under /root/sos instead of /tmp.

Root Cause

  • The --tmp-dir option was not introduced until sos-1.7-9.54.el5.

  • Note that a system's sos version is not tied to a specific release; however:

    • sos-1.7-9.49.el5 was available in RHEL 5.6 (no --tmp-dir option)
    • sos-1.7-9.54.el5 was first available in RHEL 5.7 (--tmp-dir available)
    • sysreport was used prior to introduction of sosreport in RHEL 4.6

Diagnostic Steps

  • The sosreport command is provided by the sos package:

    # rpm -qf $(which sosreport)
    sos-1.7-9.74.el5_11
    
  • Newer sos versions provide the --tmp-dir option:

    # sosreport --help | grep tmp
      --tmp-dir=TMPDIR      specify alternate temporary directory
    
  • Note that in RHEL 7 that sosreport will use /var/tmp instead of /tmp, yet --tmp-dir can still be used when needed.

SBR
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.