Skip to content

Conversation

@achilleas-k
Copy link
Member

@achilleas-k achilleas-k commented Jan 19, 2026

The --force option of the groupadd command makes it possible to run with a group name or GID that already exists without failing. This is very useful for letting users define groups in their configs without worrying about the group existing in the base system or being created from a package, which isn't always predictable.

@achilleas-k

This comment was marked as outdated.

@achilleas-k achilleas-k marked this pull request as ready for review January 19, 2026 14:33
@achilleas-k achilleas-k requested a review from a team as a code owner January 19, 2026 14:33
@achilleas-k achilleas-k requested review from bcl, lzap and thozza January 19, 2026 14:33
achilleas-k added a commit to osbuild/osbuild.github.io that referenced this pull request Jan 19, 2026
@achilleas-k
Copy link
Member Author

Cross-arch qemu based image build/boot smoke test will be fixed by #2145

func TestNewGroupsStageOptions(t *testing.T) {
type testCase struct {
groups []users.Group
expOptions *GroupsStageOptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't initially parse this as meaning expected options :) I see we've used both expOptions and expectedOptions in various places so it might be nice to just use the long form.

@thozza thozza force-pushed the stages/groups/force branch from ba4f47e to 2d14832 Compare January 19, 2026 18:20
Copy link
Contributor

@bcl bcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I don't feel too strongly about the naming of expOptions :)

@achilleas-k
Copy link
Member Author

I don't feel too strongly about the naming of expOptions :)

hah, funny you should mention it, I felt it was a bit too lazy to call it that, paused for a second, thought I shouldn't spend much time thinking hard about a variable name in a tiny test, and moved on.

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, LGTM.

I've added a few comments. I think that the behavior of the --force option with two groups with the same GIDs is worth addressing, but could be in a follow up or as a documentation.

// groups in their configs without worrying about the group existing in
// the base system or being created from a package, which isn't
// predictable. Enable it unconditionally for all builds
Force: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: After reading the man page, it also When used with -g, and the specified GID already exists, another (unique) GID is chosen (i.e. -g is turned off).. This means that if a user specifies two different groups with the same GID in the BP, one of them will get a different GID and the build will pass. This behavior should be probably called out explicitly, or we should have an option validation to catch it and don't generate such manifest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. We can't control for conflicts between the blueprint and the packages/system, but we should make things more predictable by keeping the blueprint sane at least and error on duplicates, even though it would technically work. I think that wouldn't be surprising or unusual behaviour.

That might be more appropriate for validation in the blueprint itself though.

The note I added to the blueprint reference covers the GID behaviour too, though maybe that's not entirely clear either: https://github.com/osbuild/osbuild.github.io/pull/188/changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Documentation and validation on the BP level sound good to me!

This version introduced the 'force' option in org.osbuild.groups.
It's also the current latest release.
The --force option of the groupadd command makes it possible to run with
a group name or GID that already exists without failing.  This is very
useful for letting users define groups in their configs without worrying
about the group existing in the base system or being created from a
package, which isn't always predictable.
The wheel group is created by the setup package on all systems by
default.  Before our use of the force option, this would fail.  This new
config now tests that the build doesn't fail since we enable the force
option unconditionally.
@supakeen supakeen added this pull request to the merge queue Jan 20, 2026
Merged via the queue into osbuild:main with commit 273037a Jan 20, 2026
25 checks passed
@achilleas-k achilleas-k deleted the stages/groups/force branch January 21, 2026 10:18
@achilleas-k
Copy link
Member Author

Here we go: osbuild/blueprint#43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants