diff --git a/lib/src/kargs.rs b/lib/src/kargs.rs index 5051886d2..4591ca0fc 100644 --- a/lib/src/kargs.rs +++ b/lib/src/kargs.rs @@ -2,6 +2,7 @@ use anyhow::Ok; use anyhow::Result; use crate::deploy::ImageState; +use crate::journal; use ostree::gio; use ostree_ext::ostree; use ostree_ext::ostree::Deployment; @@ -37,16 +38,26 @@ pub(crate) fn get_kargs( let mut options: Vec = options.into_iter().map(|s| s.to_string()).collect(); kargs.append(&mut options); } + tracing::debug!("Current base kargs: {kargs:?}"); }; // Get the kargs in kargs.d of the booted system + let mut source_kargs_files = Vec::new(); let mut existing_kargs: Vec = vec![]; let fragments = liboverdrop::scan(&["/usr/lib"], "bootc/kargs.d", &["toml"], true); - for (_name, path) in fragments { + for (name, path) in fragments { + let name = name + .to_str() + .ok_or_else(|| anyhow::anyhow!("Invalid utf8: {name:?}"))?; + source_kargs_files.push(name.to_owned()); let s = std::fs::read_to_string(&path)?; let mut parsed_kargs = parse_file(s.clone(), sys_arch.clone())?; existing_kargs.append(&mut parsed_kargs); } + journal::journal_print( + libsystemd::logging::Priority::Info, + &format!("Source kargs from: {source_kargs_files:?}"), + ); // Get the kargs in kargs.d of the pending image let mut remote_kargs: Vec = vec![]; @@ -58,11 +69,13 @@ pub(crate) fn get_kargs( if !fetched_tree.query_exists(cancellable) { // if the kargs.d directory does not exist in the fetched image, return the existing kargs kargs.append(&mut existing_kargs); + tracing::debug!("No kargs.d in staged image"); return Ok(kargs); } let queryattrs = "standard::name,standard::type"; let queryflags = gio::FileQueryInfoFlags::NOFOLLOW_SYMLINKS; let fetched_iter = fetched_tree.enumerate_children(queryattrs, queryflags, cancellable)?; + let mut applied_kargs_files = Vec::new(); while let Some(fetched_info) = fetched_iter.next_file(cancellable)? { // only read and parse the file if it is a toml file let name = fetched_info.name(); @@ -82,6 +95,7 @@ pub(crate) fn get_kargs( let s = std::io::read_to_string(&mut reader)?; let mut parsed_kargs = parse_file(s.clone(), sys_arch.clone())?; remote_kargs.append(&mut parsed_kargs); + applied_kargs_files.push(name.to_owned()); } } } @@ -98,6 +112,10 @@ pub(crate) fn get_kargs( .filter(|item| !remote_kargs.contains(item)) .collect(); + journal::journal_print( + libsystemd::logging::Priority::Info, + &format!("Applied kargs from: {applied_kargs_files:?}"), + ); tracing::debug!( "kargs: added={:?} removed={:?}", &added_kargs,