From ad8ed452fdf0c8cb6c8924b37f54eab58487e638 Mon Sep 17 00:00:00 2001 From: damocles Date: Fri, 26 Jun 2026 17:13:41 +0200 Subject: [PATCH] fix(#2002): mkdir container /etc before writing bridge-DNS marker (fresh install) --- hive-priv/src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hive-priv/src/main.rs b/hive-priv/src/main.rs index a03c747d..ca227aea 100644 --- a/hive-priv/src/main.rs +++ b/hive-priv/src/main.rs @@ -1420,6 +1420,16 @@ fn write_bridge_dns_marker(container: &str, isolation: Option<&NetworkIsolation> let path = bridge_dns_marker_path(container); match isolation { Some(iso) => { + // On a fresh install the container's `/etc` may not exist yet + // (rootfs not fully materialised before the first start), so + // `write` would fail with ENOENT. Create the parent dir first + // — it's the container's own `/etc`, which nixos-container + // populates on start; a pre-created dir + our marker persist. + if let Some(parent) = std::path::Path::new(&path).parent() { + std::fs::create_dir_all(parent).with_context(|| { + format!("create bridge-DNS marker dir {}", parent.display()) + })?; + } std::fs::write(&path, format!("{}\n", iso.gateway_ip)) .with_context(|| format!("write bridge-DNS marker {path}"))?; }