saltstack / saltstack/salt

Unable to run rootless with custom directories

Open
#55,971 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug documentation severity-medium time-estimate-sprint
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

Trying to set up a container image running salt-master rootless (see setup below for Dockerfile), and while I specify all the directories (see master config below) I get the following error:

Failed to create directory path "/var/cache/salt/master/queues" - [Errno 13] Permission denied: '/var/cache/salt'

In the master config I've specified:

cachedir: /tmp/salt/cache

This seems to be ignored.
Yes, I'm aware of the root_dir option, I'm trying to define a custom directory structure.

Setup

Dockerfile (minimal reference):

FROM alpine:3
RUN apk add --no-cache salt-master && \
    adduser -DU -u 100 foo && \
    mkdir /data /config && \
    chown 100:100 /data /config
COPY --chown=100:100 /tmp/master /config/master
USER 100:100
CMD ["/usr/bin/salt-master", "--config-dir=/config"]

/tmp/master:

pki_dir: /data/pki
cachedir: /tmp/salt/cache
pidfile: /tmp/salt/master.pid
sock_dir: /tmp/salt/master
log_file: /data/logs/master
conf_file: /config/master

file_roots:
  base:
    - /data/states
pillar_roots:
  base:
    - /data/pillars
Steps to Reproduce Issue

See above files then run (as a normal user):

podman build -t saltmaster:latest .
podman run --rm saltmaster:latest
Versions Report
Salt Version:
           Salt: 2019.2.2

Dependency Versions:
           cffi: 1.13.2
       cherrypy: Not Installed
       dateutil: 2.8.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10.3
        libgit2: 0.28.4
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 1.0.0
         Python: 3.8.1 (default, Dec 30 2019, 15:43:37)
   python-gnupg: Not Installed
         PyYAML: 5.2
          PyZMQ: 18.1.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 6.0.3
            ZMQ: 4.3.2

System Versions:
           dist: alpine 3.11.3
         locale: utf-8
        machine: x86_64
        release: 5.4.10-200.fc31.x86_64
         system: Linux
        version: Alpine Linux 3.11.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Dockerfile and /tmp/master configuration, then reproduce the failure with the podman build and podman run commands. Trace why salt-master uses /var/cache/salt/master/queues instead of the configured cachedir; done means the rootless container starts with the custom directory settings without a permission error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.