Creating a sosreport with tmp-dir on an nfs filesystem fails on RHEL

Solution Verified - Updated -


  • Red Hat Enterprise Linux 7

    • sos-3.2-35.el7_2.3.noarch and later
    • nfs
  • Red Hat Enterprise Linux 6

    • sos-3.2-28.el6_7.2.noarch and later
    • nfs


When creating a sosreport with --tmp-dir stored on an NFS mount sosreport crashes with

[root@rhel7 ~]# echo |/usr/sbin/sosreport --name $(hostname) --tmp-dir  /nfs_sos/


  Running 76/80: vhostmd...        
  Running 77/80: x11...        
  Running 78/80: xen...        
  Running 79/80: xfs...        
  Running 80/80: yum...        

Creating compressed archive...

Your sosreport has been generated and saved in:

The checksum is: 18cfb89b2187f13dbf9a061ea6d375c3

Please send this file to your support representative.

Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 25, in <module>
  File "/usr/lib/python2.7/site-packages/sos/", line 1593, in main
  File "/usr/lib/python2.7/site-packages/sos/", line 1579, in execute
  File "/usr/lib/python2.7/site-packages/sos/", line 238, in cleanup
  File "/usr/lib64/python2.7/", line 239, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib64/python2.7/", line 237, in rmtree
    names = os.listdir(path)
OSError: [Errno 2] No such file or directory: '/nfs_sos/sos.Lw2AuX/sosreport-rhel7.localdomain.localdomain-20161221012432'


Note: The error occurs after the sosreport has been successfully generated, it can still be provided to Red Hat support and the temporary directory removed manually.

Root Cause

Sosreport is creating its log file within the temporary directory on the NFS mount.
When sosreport completes it removes its temporary directory, however the log file is still open at this time.

Unlike local filesystems NFS is unable to remove a directory containing a deleted, open file.

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.