saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.11k stars 5.47k forks source link

[BUG] User creation never happens on Debian 11 Bullseye #62237

Open 2piix opened 2 years ago

2piix commented 2 years ago

Description I am using a user.present state to create a user, and requiring the user in several states. When I call sudo salt-call state.apply test=False, the user.present state does not create the user. The log for the state says

----------
          ID: foo
    Function: user.present
      Result: None
     Comment: User foo set to be added
     Changes:
----------

Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

Steps to Reproduce the behavior

  1. Install Saltstack 3004.2 on Debian Bullseye 64, using boot strap script
  2. create and apply a state like:
foo:
  user.present:
    - shell: /bin/bash
    - home: /home/foo
    - password: ...
    - optional_groups:
      - libvirt
      - salt
      - vagrant
  ssh_auth:
    - present
    - user: foo
    - source: salt://private/keys/foo.pub
    - require:
      - user: foo

Expected behavior The user foo is created

Relevant parts of log

[DEBUG   ] LazyLoaded ssh_auth.present
[DEBUG   ] LazyLoaded user.present
[DEBUG   ] LazyLoaded file.managed
[INFO    ] Running state [foo] at time 04:14:04.550460
[DEBUG   ] LazyLoaded group.info                                                                      
[DEBUG   ] Optional group "libvirt" for user "foo" is not present
[DEBUG   ] LazyLoaded shadow.info
[INFO    ] Running state [/home/foo/.bashrc] at time 04:14:04.566879
[INFO    ] Executing state file.managed for [/home/foo/.bashrc]
[DEBUG   ] LazyLoaded file.user_to_uid
[ERROR   ] User foo is not available
[INFO    ] Completed state [/home/foo/.bashrc] at time 04:14:04.571742 (duration_in_ms=4.863)         
[INFO    ] Running state [foo] at time 04:14:04.572454
[INFO    ] Executing state ssh_auth.present for [foo]                                                 
[DEBUG   ] LazyLoaded cp.get_url
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'devel.bar.lan', 'tcp://1$2.168.10.100:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.10.100:4506
[DEBUG   ] Trying to connect to: tcp://192.168.10.100:4506
[DEBUG   ] In saltenv 'devel', looking at rel_path 'private/keys/foo@bar.pub' to reso$ve 'salt://private/keys/foo@bar.pub'
[DEBUG   ] In saltenv 'devel', ** considering ** path '/var/cache/salt/minion/files/devel/private/key$/foo@bar.pub' to resolve 'salt://private/keys/foo@bar.pub'
[DEBUG   ] Fetching file from saltenv 'devel', ** attempting ** 'salt://private/keys/foo@bar.pub'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'devel', ** done ** 'private/keys/foo@bar.pub'
[DEBUG   ] In saltenv 'devel', looking at rel_path 'private/keys/foo@bar.pub' to reso$ve 'salt://private/keys/foo@bar.pub'
[DEBUG   ] In saltenv 'devel', ** considering ** path '/var/cache/salt/minion/files/devel/private/key$/foo@bar.pub' to resolve 'salt://private/keys/foo@bar.pub'
[DEBUG   ] LazyLoaded ssh.set_auth_key
[DEBUG   ] LazyLoaded test.ping
[ERROR   ] Failed to add the ssh key. Is the home directory available, and/or does the key file exist$
[INFO    ] Completed state [foo] at time 04:14:04.651674 (duration_in_ms=79.219)

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) salt-call --versions-report: ```yaml Salt Version: Salt: 3004.2 Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.3 libgit2: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.0 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: Not Installed pycrypto: Not Installed pycryptodome: 3.9.7 pygit2: Not Installed Python: 3.9.2 (default, Feb 28 2021, 17:03:44) python-gnupg: Not Installed PyYAML: 5.3.1 PyZMQ: 20.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: debian 11 bullseye locale: utf-8 machine: x86_64 release: 5.10.0-13-amd64 system: Linux version: Debian GNU/Linux 11 bullseye ```

Additional context

OrangeDog commented 2 years ago

Result: None Comment: User foo set to be added

Indicates that test is True.

Have you got some config elsewhere that is forcing test mode?

2piix commented 2 years ago

I don't believe so. My Salt Stack was working fine in Buster (though I've made a bunch of changes I don't want to back out of... none of them was to turn on testing).

Additionally, I ran salt-call config.option test on the master and the minion and got

local:
  False

Are there any candidate locations? I definitely don't have it in /etc/salt/minion or /etc/salt/master.

OrangeDog commented 2 years ago

Very strange. If you just omit the argument (sudo salt-call state.apply) what happens?

2piix commented 2 years ago

The same issue happens. That's how I tracked down the test=False option. I searched for 'User ____ is set to be created' and then I tried turning off testing explicitly.