diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 4e15112addf..459caa7c58a 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -5644,7 +5644,7 @@ static int run_container( r = wait_for_container(TAKE_PID(*pid), &container_status); /* Tell machined that we are gone. */ - if (bus) + if (arg_register && bus) (void) unregister_machine(bus, arg_machine); if (r < 0)