Skip to content

/tmp/ might cause problems with the thin-tgz of salt-ssh #32771

Closed

Description

@guettli

Description of Issue/Question

We randomly see messages like this when calling salt-ssh

    stderr:
        'test.opts_pkg' is not available.

Up to now we remove /tmp/.root_????_salt/ by hand, and the next call of salt-ssh will succeed.

We noticed that systemd cleans tempfiles regularly and we guess that files in above directory get deleted. On our system (SuSE) the relevant service is /usr/lib/systemd/system/systemd-tmpfiles-clean.timer

The files in the thin-tgz have different timestamps:

remote-host:~ # ls -ltr /tmp/.root_dcdf8c_salt/
total 176
-rw-r--r--  1 root root    40 Okt 12  2015 ext_version
-rw-r--r--  1 root root  8292 Dez  7 09:58 singledispatch.py
-rw-r--r--  1 root root  5228 Dez  7 09:58 singledispatch_helpers.py
-rw-r--r--  1 root root  5277 Dez  7 09:58 backports_abc.py
-rw-r--r--  1 root root 29911 Dez  7 13:46 six.py
-rw-r--r--  1 root root    79 Dez  7 15:27 salt-call
...

We guess this is the cause why randomly calling salt-ssh files with messages like 'test.opts_pkg' is not available..

Potential solution 1

Our suggestion is to use different location where files are not supposed to be deleted automatically.

https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

Potential solution 2

If you update the timestamp for every file in the tmp directory, then all files get deleted at once. I hope that salt will detect this an reinstall the code.

Versions Report

salt:/srv # salt --versions-report
Salt Version:
           Salt: 2015.8.3

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: 0.22
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.1.0
         Python: 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC]
           RAET: Not Installed
        Tornado: 4.3
            ZMQ: 4.1.2
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 2.1
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: 0.21.2
   python-gnupg: Not Installed
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: SuSE 12.3 x86_64
        machine: x86_64
        release: 3.7.10-1.40-desktop
         system: openSUSE  12.3 x86_64

Activity

  1. added
    bug
    severity-medium
    Core
    P3
    on Apr 22, 2016
  2. added this to the Approved milestone on Apr 22, 2016
  3. jfindlay commented on Apr 22, 2016

    @jfindlay
    Contributor

    @guettli, thanks for reporting. I think either (or both) of your solutions are good.

  4. guettli commented on May 9, 2016

    @guettli
    ContributorAuthor

    Is there a work-around for this issue?

    Is there a way to untar/unzip the python code on the remote host in a different location? I think /var/tmp/ would be good.

  5. jfindlay commented on May 9, 2016

    @jfindlay
    Contributor

    @guettli, personally I think /var/tmp would be a better location according to FHS because of the situation you've encountered. I don't think there is a way to override the temp dir, but you can use salt-ssh --wipe as another workaround.

  6. thatch45 commented on May 9, 2016

    @thatch45
    Contributor

    Yes, lets move this to /var/tmp. I think this is a much better place for the thin to be unraveled.

  7. added a commit that references this issue on May 9, 2016
    2a7fa23
  8. cachedout commented on May 9, 2016

    @cachedout
    Contributor

    This will be moved in 2016.3 per #33130. Closing. Thanks @guettli . This was a great catch by you!

  9. added 2 commits that reference this issue on May 10, 2016
    a1f286f
    457d9dd
  10. guettli commented on May 17, 2016

    @guettli
    ContributorAuthor

    I looked at the changeset:

    -DEFAULT_THIN_DIR = '/tmp/.%%USER%%_%%FQDNUUID%%_salt'
    +DEFAULT_THIN_DIR = '/var/tmp/.%%USER%%_%%FQDNUUID%%_salt'
    

    Is there a way to make this directory configurable?

  11. fcrozat commented on Oct 27, 2016

    @fcrozat
    Contributor

    yes, please, having DEFAULT_THIN_DIR configurable would help for deployment on restricted systems with very small /var/tmp directory.

  12. shallot commented on Mar 8, 2017

    @shallot

    @fcrozat looks like thin_dir is a configurable roster setting which could be useful for this

  13. guettli commented on Mar 8, 2017

    @guettli
    ContributorAuthor

    My issue is solved (use of /var/tmp, not /tmp). If you want this to be configurable, please open a new issue.

  14. fcrozat commented on Mar 15, 2017

    @fcrozat
    Contributor

    @shallot Thanks, using thin_dir should do the trick !

  15. guettli commented on Mar 16, 2017

    @guettli
    ContributorAuthor

    Since /var/tmp gets used now, at least me (the issue creator) is happy. I don't have the need to configure the location today. Maybe in the future. If it will be needed in the future, it can be done in the future, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreP3Salt-SSHbugseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions