How do I make sosreport write to an alternative location?
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
sosreportto use a different directory than/tmp? sosreportfails because there is not enough space in/tmp.
Resolution
NOTE: The solution depends on the "sos" package version.
-
To verify the
sospackage version, run:# rpm -qa sos
For Red Hat Enterprise Linux 5.7 and above:
-
If the
sosreportversion issos-1.7-9.54.el5or above, typically:- Red Hat Enterprise Linux 5.7 and later.
-
Use the
--tmp-diroption ofsosreportto temporarily change the destination:# mkdir /root/sos # sosreport --tmp-dir /root/sos -
The example above will generate the sosreport under
/root/sosinstead of/tmp.
For Red Hat Enterprise Linux between RHEL 4.6 and RHEL 5.6
-
If the
sosreportversion issos-1.7-9.49.el5or below, typically:- Red Hat Enterprise Linux 4.6 and later.
- Red Hat Enterprise Linux 5.6 and earlier.
-
Use the
$TMPenvironment variable to temporarily change the destination:# mkdir /root/sos # env TMP=/root/sos/ sosreport -
The example above will generate the sosreport under
/root/sosinstead of/tmp.
Root Cause
-
The
--tmp-diroption was not introduced untilsos-1.7-9.54.el5. -
Note that a system's
sosversion is not tied to a specific release; however:sos-1.7-9.49.el5was available in RHEL 5.6 (no--tmp-diroption)sos-1.7-9.54.el5was first available in RHEL 5.7 (--tmp-diravailable)sysreportwas used prior to introduction ofsosreportin RHEL 4.6
Diagnostic Steps
-
The
sosreportcommand is provided by thesospackage:# rpm -qf $(which sosreport) sos-1.7-9.74.el5_11 -
Newer
sosversions provide the--tmp-diroption:# sosreport --help | grep tmp --tmp-dir=TMPDIR specify alternate temporary directory -
Note that in RHEL 7 that
sosreportwill use/var/tmpinstead of/tmp, yet--tmp-dircan still be used when needed.
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.