Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion rust/agama-users/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Model {

let useradd = ChrootCommand::new(self.install_dir.clone())?
.cmd("useradd")
.args(["-G", "wheel", user_name])
.args([user_name])
.output()?;

if !useradd.status.success() {
Expand All @@ -128,6 +128,7 @@ impl Model {
)));
}

self.set_user_group(user_name);
self.set_user_password(user_name, user_password)?;
self.update_user_fullname(user)
}
Expand Down Expand Up @@ -189,6 +190,25 @@ impl Model {
Ok(())
}

/// Add user into the wheel group on best effort basis.
/// If the group doesn't exist, log the error and continue.
fn set_user_group(&self, user_name: &str) -> Result<(), service::Error> {
let usermod = ChrootCommand::new(self.install_dir.clone())?
.cmd("usermod")
.args(["-a", "-G", "wheel", user_name])
.output()?;

if !usermod.status.success() {
tracing::warn!(
"Adding user {} into the \"wheel\" group failed, code={}",
user_name,
usermod.status
);
}

Ok(())
}

/// Updates root's authorized_keys file with SSH key
fn update_authorized_keys(&self, ssh_key: &str) -> Result<(), service::Error> {
let mode = 0o644;
Expand Down
8 changes: 8 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Mar 2 12:20:15 UTC 2026 - Michal Filka <mfilka@suse.com>

- bsc#1258416
- when user cannot be added into wheel group after creation
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The real change is that we do not stop the installation with an error (which is what it happend in the past, or am I wrong)? The error is still logged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok ... will rephrase

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To make it clear ... the installation finishes but actions which followed after (unsuccessful) attempt for adding user into the group, were not performed - e.g. setting the password and user was unable to login into installed system

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, I was wrong then :-)

just log the error so the rest of user configuration, e.g.
setting password is done.

-------------------------------------------------------------------
Fri Feb 27 11:39:31 UTC 2026 - Ladislav Slezák <lslezak@suse.com>

Expand Down
Loading