diff --git a/man/sd_id128_get_machine.xml b/man/sd_id128_get_machine.xml
index 4f6926fd7d9..075caffb2bf 100644
--- a/man/sd_id128_get_machine.xml
+++ b/man/sd_id128_get_machine.xml
@@ -139,7 +139,8 @@
Returned by sd_id128_get_machine() and
sd_id128_get_machine_app_specific() when /etc/machine-id
- is empty or all zeros.
+ is empty or all zeros. Also returned by sd_id128_get_invocation() when the
+ invocation ID is all zeros.
diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c
index 9fac1bb3fc3..ec3a496dba5 100644
--- a/src/libsystemd/sd-id128/sd-id128.c
+++ b/src/libsystemd/sd-id128/sd-id128.c
@@ -284,6 +284,9 @@ _public_ int sd_id128_get_invocation(sd_id128_t *ret) {
r = get_invocation_from_keyring(&saved_invocation_id);
if (r < 0)
return r;
+
+ if (sd_id128_is_null(saved_invocation_id))
+ return -ENOMEDIUM;
}
if (ret)