diff --git a/src/run/run.c b/src/run/run.c index c0553c7bd9..088c30edcd 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -65,6 +65,7 @@ #include "unit-def.h" #include "unit-name.h" #include "user-util.h" +#include "virt.h" static bool arg_ask_password = true; static bool arg_scope = false; @@ -3055,6 +3056,12 @@ static bool shall_make_executable_absolute(void) { return false; if (arg_transport != BUS_TRANSPORT_LOCAL) return false; + if (!empty_or_root(arg_root_directory)) + return false; + /* If we're running in a chroot, our view of the filesystem might be completely different from pid1's + * view of the filesystem, hence don't try to resolve the executable in that case. */ + if (!arg_root_directory && running_in_chroot() > 0) + return false; FOREACH_STRING(f, "RootDirectory=", "RootImage=", "ExecSearchPath=", "MountImages=", "ExtensionImages=") if (strv_find_startswith(arg_property, f))