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
16 changes: 10 additions & 6 deletions rust/agama-network/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use crate::error::NetworkStateError;
use crate::types::*;

use agama_utils::{actor::Error, openapi::schemas};
use agama_utils::openapi::schemas;
use macaddr::MacAddr6;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, skip_serializing_none, DisplayFromStr};
Expand Down Expand Up @@ -192,20 +192,24 @@ impl NetworkState {
let to = PathBuf::from(self.target_dir()).join(CONNECTIONS_PATH.trim_start_matches('/'));

self.copy_connections(&from, &to)?;
self.enable_service("/").await
self.enable_service(self.target_dir()).await
}

pub async fn enable_service(&self, path: &str) -> Result<(), NetworkStateError> {
let mut command = process::Command::new("chroot");
command.args([path, "systemctl", "enable", "NetworkManager.service"]);

if let Some(output) = command.output().await.ok() {
if output.status.success() {
return Ok(());
match command.output().await {
Ok(output) => {
if !output.status.success() {
tracing::error!("Failed to enable the NetworkManager service: {output:?}")
}
}
Err(error) => {
tracing::error!("Failed to run the command to enable the NetworkManager service command: {error}");
}
}

tracing::error!("Error enabling NetworkManager service");
Ok(())
}

Expand Down
6 changes: 6 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 21 10:59:15 UTC 2026 - Knut Anderssen <kanderssen@suse.com>

- Fix enabling NetworkManager service in the target system
(gh#agama-project/agama#3056).

-------------------------------------------------------------------
Mon Jan 19 20:31:26 UTC 2026 - Josef Reidinger <jreidinger@suse.com>

Expand Down
Loading