From 25639cec427415a0e26d9ffcdc028edea1f11817 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 29 Oct 2020 21:20:40 +0100 Subject: [PATCH] netns: fix error msg when starting netns Previously, the failing initial `netns delete` resulted in a "Cannot remove namespace file ..." error visible in the journal and status output. --- modules/netns-isolation.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/netns-isolation.nix b/modules/netns-isolation.nix index 752d8e9..5c5fbb3 100644 --- a/modules/netns-isolation.nix +++ b/modules/netns-isolation.nix @@ -151,6 +151,7 @@ in { requiredBy = bindsTo; before = bindsTo; script = '' + ${ip} netns delete ${netnsName} 2> /dev/null || true ${ip} netns add ${netnsName} ${ipNetns} link set lo up ${ip} link add ${veth} type veth peer name ${peer} @@ -179,7 +180,6 @@ in { serviceConfig = { Type = "oneshot"; RemainAfterExit = "yes"; - ExecStartPre = "-${ip} netns delete ${netnsName}"; }; }; };