Skip to content

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

@Sxderp

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

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