Skip to content

relenv attempts to create / extract files into the installation directory (no permission, not run as root) #252

Open

Description

@Sxderp

When starting the salt-master I get the following traceback.

Error processing line 1 of /opt/saltstack/salt/lib/python3.10/site-packages/relenv.pth:
  Traceback (most recent call last):
    File "/opt/saltstack/salt/lib/python3.10/site.py", line 195, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 1072, in bootstrap
      install_cargo_config()
    File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 851, in install_cargo_config
      toolchain = common().get_toolchain()
    File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/common.py", line 231, in get_toolchain
      os.makedirs(DATA_DIR, exist_ok=True)
    File "/opt/saltstack/salt/lib/python3.10/os.py", line 215, in makedirs
      makedirs(head, exist_ok=exist_ok)
    File "/opt/saltstack/salt/lib/python3.10/os.py", line 225, in makedirs
      mkdir(name, mode)
  PermissionError: [Errno 13] Permission denied: '/opt/saltstack/salt/.local'
Remainder of file ignored
Error processing line 1 of /opt/saltstack/salt/lib/python3.10/site-packages/relenv.pth:
  Traceback (most recent call last):
    File "/opt/saltstack/salt/lib/python3.10/site.py", line 195, in addpackage
      exec(line)
    File "<string>", line 1, in <module>
    File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 1072, in bootstrap
      install_cargo_config()
    File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 851, in install_cargo_config
      toolchain = common().get_toolchain()
    File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/common.py", line 231, in get_toolchain
      os.makedirs(DATA_DIR, exist_ok=True)
    File "/opt/saltstack/salt/lib/python3.10/os.py", line 215, in makedirs
      makedirs(head, exist_ok=exist_ok)
    File "/opt/saltstack/salt/lib/python3.10/os.py", line 225, in makedirs
      mkdir(name, mode)
  PermissionError: [Errno 13] Permission denied: '/opt/saltstack/salt/.local'
Remainder of file ignored

The process is run as non-root, so it does not have permissions to create directories. I am observing this behavior with Salt 3007.8 / relenv 20.6.

Salt Version:
          Salt: 3007.8
 
Python Version:
        Python: 3.10.18 (main, Sep  5 2025, 22:48:51) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
  cryptography: 42.0.5
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.20.6
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.4.2
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: rhel 9.6 Plow
        locale: utf-8
       machine: x86_64
       release: 5.14.0-570.41.1.el9_6.x86_64
        system: Linux
       version: Red Hat Enterprise Linux 9.6 Plow

Activity

  1. dwoz commented on Nov 13, 2025

    @dwoz
    Contributor

    I think this is more of a salt packaging issue. In the salt package we create the salt user with a home directory of /opt/saltstack/salt but that user doesn't have write permissions to the directory. I think we'd be better off making the salt user's home directory /var/cache/salt instead.

  2. Sxderp commented on Dec 1, 2025

    @Sxderp
    Author

    Is there a followup issue for this or do I need to create one?

  3. dwoz commented on Jan 17, 2026

    @dwoz
    Contributor

    @Sxderp can you create an issue in the salt repo for this please?

  4. dwoz commented on May 15, 2026

    @dwoz
    Contributor

    @Sxderp has this been fully resolved?

  5. Sxderp commented on May 18, 2026

    @Sxderp
    Author

    Well, I'm no longer getting permission denied for /opt/salltstack/salt/.local but I am getting a different error. I'm not sure if the new error is just masking the old one. This is on Salt 3007.13.

    Error processing line 1 of /opt/saltstack/salt/lib/python3.10/site-packages/relenv.pth:
      Traceback (most recent call last):
      Traceback (most recent call last):
        File "/opt/saltstack/salt/lib/python3.10/site.py", line 195, in addpackage
        File "/opt/saltstack/salt/lib/python3.10/site.py", line 195, in addpackage
          exec(line)
          exec(line)
        File "<string>", line 1, in <module>
        File "<string>", line 1, in <module>
        File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 1280, in bootstrap
        File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 1280, in bootstrap
          install_cargo_config()
          install_cargo_config()
        File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 1035, in install_cargo_config
        File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 1035, in install_cargo_config
          if not toolchain:
          if not toolchain:
      UnboundLocalError: local variable 'toolchain' referenced before assignment
      UnboundLocalError: local variable 'toolchain' referenced before assignment
    
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions