From 23e5e79a51f92c1b0ab3812e0efe65055d5d3a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 3 Dec 2019 14:48:27 +0100 Subject: [PATCH] initrd: fix systemd.debug-shell & friends They would get assigned to an inactive target in the initramfs. --- src/debug-generator/debug-generator.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index bc8714c4c7..4e41eca352 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -126,7 +126,15 @@ static int generate_wants_symlinks(void) { STRV_FOREACH(u, arg_wants) { _cleanup_free_ char *p = NULL, *f = NULL; - const char *target = arg_default_unit ?: SPECIAL_DEFAULT_TARGET; + const char *target; + + /* This should match what do_queue_default_job() in core/main.c does. */ + if (arg_default_unit) + target = arg_default_unit; + else if (in_initrd()) + target = SPECIAL_INITRD_TARGET; + else + target = SPECIAL_DEFAULT_TARGET; p = strjoin(arg_dest, "/", target, ".wants/", *u); if (!p)