From 9881776da496f2f60470248cb3e8eafaa49975c8 Mon Sep 17 00:00:00 2001 From: Michal Filka Date: Mon, 2 Mar 2026 13:18:09 +0100 Subject: [PATCH 1/5] Append user to wheel group only on best efford basis. --- rust/agama-users/src/model.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/rust/agama-users/src/model.rs b/rust/agama-users/src/model.rs index ea9ced7e7d..b7a6049453 100644 --- a/rust/agama-users/src/model.rs +++ b/rust/agama-users/src/model.rs @@ -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() { @@ -128,8 +128,9 @@ impl Model { ))); } + self.set_user_group(user_name); self.set_user_password(user_name, user_password)?; - self.update_user_fullname(user) + self.update_user_fullname(user); } /// Reads root's data from given config and updates root setup accordingly @@ -189,6 +190,24 @@ impl Model { Ok(()) } + /// Add user into the wheel group on best efford basis. + /// If the group doesn't exist, ignore it. + fn set_user_group(&self, user_name: &str) -> Result<()> { + let usermod = ChrootCommand::new(self.install_dir.clone())? + .cmd("usermod") + .args(["-a", "-G", "wheel", user_name]); + + if !usermod.status.success() { + tracing::warning!( + "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; From f28eaf91f2f8cc811250e6d91ff16fd0e99fa664 Mon Sep 17 00:00:00 2001 From: Michal Filka Date: Mon, 2 Mar 2026 13:21:54 +0100 Subject: [PATCH 2/5] Updated changelog --- rust/package/agama.changes | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/package/agama.changes b/rust/package/agama.changes index 2414debaea..d8a6f5fc49 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Mar 2 12:20:15 UTC 2026 - Michal Filka + +- bsc#1258416 + - when user cannot be added into wheel group after creation + ignore that and do not end with an error + ------------------------------------------------------------------- Thu Feb 26 16:44:32 UTC 2026 - David Diaz From e789672d441041baa884b1eaf1f7aa78704b6734 Mon Sep 17 00:00:00 2001 From: Michal Filka Date: Mon, 2 Mar 2026 13:31:05 +0100 Subject: [PATCH 3/5] Fixed copy-paste issue --- rust/agama-users/src/model.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rust/agama-users/src/model.rs b/rust/agama-users/src/model.rs index b7a6049453..e96a41128d 100644 --- a/rust/agama-users/src/model.rs +++ b/rust/agama-users/src/model.rs @@ -130,7 +130,7 @@ impl Model { self.set_user_group(user_name); self.set_user_password(user_name, user_password)?; - self.update_user_fullname(user); + self.update_user_fullname(user) } /// Reads root's data from given config and updates root setup accordingly @@ -192,13 +192,14 @@ impl Model { /// Add user into the wheel group on best efford basis. /// If the group doesn't exist, ignore it. - fn set_user_group(&self, user_name: &str) -> Result<()> { + 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]); + .args(["-a", "-G", "wheel", user_name]) + .output()?; if !usermod.status.success() { - tracing::warning!( + tracing::warn!( "Adding user {} into the \"wheel\" group failed, code={}", user_name, usermod.status From 2b442d7d1b343c09bc3ee4e551421e0b6f87c47b Mon Sep 17 00:00:00 2001 From: Michal Filka Date: Mon, 2 Mar 2026 14:01:40 +0100 Subject: [PATCH 4/5] Modified changelog --- rust/package/agama.changes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/package/agama.changes b/rust/package/agama.changes index d8a6f5fc49..8c4c49eaaa 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -3,7 +3,8 @@ Mon Mar 2 12:20:15 UTC 2026 - Michal Filka - bsc#1258416 - when user cannot be added into wheel group after creation - ignore that and do not end with an error + ignore that so the rest of user configuration, e.g. setting + password is done. ------------------------------------------------------------------- Thu Feb 26 16:44:32 UTC 2026 - David Diaz From 08fc75cdd25bf11af9edb39832f535d360b929a9 Mon Sep 17 00:00:00 2001 From: Michal Filka Date: Mon, 2 Mar 2026 16:26:34 +0100 Subject: [PATCH 5/5] Minor fixes --- rust/agama-users/src/model.rs | 4 ++-- rust/package/agama.changes | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/agama-users/src/model.rs b/rust/agama-users/src/model.rs index e96a41128d..dfa417ef0e 100644 --- a/rust/agama-users/src/model.rs +++ b/rust/agama-users/src/model.rs @@ -190,8 +190,8 @@ impl Model { Ok(()) } - /// Add user into the wheel group on best efford basis. - /// If the group doesn't exist, ignore it. + /// 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") diff --git a/rust/package/agama.changes b/rust/package/agama.changes index 8c4c49eaaa..cdf3ac23dd 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -3,8 +3,8 @@ Mon Mar 2 12:20:15 UTC 2026 - Michal Filka - bsc#1258416 - when user cannot be added into wheel group after creation - ignore that so the rest of user configuration, e.g. setting - password is done. + just log the error so the rest of user configuration, e.g. + setting password is done. ------------------------------------------------------------------- Thu Feb 26 16:44:32 UTC 2026 - David Diaz