salt icon indicating copy to clipboard operation
salt copied to clipboard

pkg/debian/salt-common.preinst: Use groupadd rather than addgroup

Open rmounce opened this issue 5 months ago • 1 comments

What does this PR do?

What is says on the tin. Use groupadd rather than addgroup.

What issues does this PR fix or reference?

Fixes installation of salt-common in a minimal Ubuntu 24.04 noble Docker container.

Dockerfile

FROM ubuntu:noble

# allow-insecure for more concise bug repro Dockerfile
RUN echo 'deb [allow-insecure=yes] https://packages.broadcom.com/artifactory/saltproject-deb stable main' > /etc/apt/sources.list.d/salt.list

ARG SALT_REL=3007.4
COPY <<EOF /etc/apt/preferences.d/salt-pin-1001
Package: salt-*
Pin: version ${SALT_REL}
Pin-Priority: 1001'
EOF

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        salt-common
    && \
    rm -rf /var/lib/apt/lists/*

Previous Behavior

With Docker

$ docker build .
21.89 Selecting previously unselected package salt-common.
(Reading database ... 4881 files and directories currently installed.)
21.91 Preparing to unpack .../salt-common_3007.4_amd64.deb ...
21.95 Adding group salt....done
21.96 Adding system user salt....done
21.97 usermod: group 'salt' does not exist
21.97 dpkg: error processing archive /var/cache/apt/archives/salt-common_3007.4_amd64.deb (--unpack):
21.97  new salt-common package pre-installation script subprocess returned error exit status 6

Directly running the script

$ ./salt-common.preinst install
Adding group salt....done
Adding system user salt....done
usermod: group 'salt' does not exist
$ echo $?
6

New Behavior

Directly running the script

$ ./salt-common.preinst install
Adding group salt....done
Adding system user salt....done
$ echo $?
0

(Docker build untested, I have been working around it with RUN apt install adduser)

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

  • N/A? Docs
  • [X] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
  • N/A? Tests written/updated

Commits signed with GPG?

No

rmounce avatar Jun 13 '25 06:06 rmounce

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

welcome[bot] avatar Jun 13 '25 06:06 welcome[bot]

Congratulations on your first PR being merged! :tada:

welcome[bot] avatar Jun 24 '25 04:06 welcome[bot]