summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/manager.c12
-rw-r--r--src/unit.c6
-rw-r--r--src/unit.h3
3 files changed, 17 insertions, 4 deletions
diff --git a/src/manager.c b/src/manager.c
index 9684efac8b..3e742f791e 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1392,9 +1392,15 @@ static int transaction_add_job_and_dependencies(
assert(type < _JOB_TYPE_MAX);
assert(unit);
- if (type != JOB_STOP &&
- unit->meta.load_state != UNIT_LOADED) {
- dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load. See logs for details.", unit->meta.id);
+ if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_FAILED) {
+ dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id);
+ return -EINVAL;
+ }
+
+ if (type != JOB_STOP && unit->meta.load_state == UNIT_FAILED) {
+ dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. You might find more information in the logs.",
+ unit->meta.id,
+ strerror(-unit->meta.load_error));
return -EINVAL;
}
diff --git a/src/unit.c b/src/unit.c
index 59776c33e4..e00425010a 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -672,6 +672,9 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
fprintf(f,
"%s\tMerged into: %s\n",
prefix, u->meta.merged_into->meta.id);
+ else if (u->meta.load_state == UNIT_FAILED)
+ fprintf(f, "%s\tLoad Error Code: %s\n", prefix, strerror(-u->meta.load_error));
+
if (u->meta.job)
job_dump(u->meta.job, f, prefix2);
@@ -756,9 +759,10 @@ int unit_load(Unit *u) {
fail:
u->meta.load_state = UNIT_FAILED;
+ u->meta.load_error = r;
unit_add_to_dbus_queue(u);
- log_notice("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
+ log_debug("Failed to load configuration for %s: %s", u->meta.id, strerror(-r));
return r;
}
diff --git a/src/unit.h b/src/unit.h
index a99d33ef07..8bd81a26d4 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -184,6 +184,9 @@ struct Meta {
* unit here, if there was a job scheduled */
int deserialized_job; /* This is actually of type JobType */
+ /* Error code when we didn't manage to load the unit (negative) */
+ int load_error;
+
/* If we go down, pull down everything that depends on us, too */
bool recursive_stop;