nspawn: downgrade log level when unregistering and machine is already gone

nspawn started logging at notice level when exiting a container:

root@sid-arm64:~# exit
logout
Container sid-arm64 exited successfully.
Failed to unregister machine in system context, ignoring: No such device or address

Looks like it's racing with machined which already noticed it was
gone and remove it. Downgrade to debug on ENXIO.

Follow-up for 1e084aad7d
This commit is contained in:
Luca Boccassi
2026-05-24 21:18:58 +02:00
committed by Daan De Meyer
parent a7ecad77cb
commit ef8c5548ca
+6 -5
View File
@@ -286,11 +286,12 @@ void unregister_machine_with_fallback_and_log(
}
if (r < 0)
log_notice_errno(r, "Failed to unregister machine in %s context, ignoring: %m",
machine_registration_scope_string(
ctx->registered_system && ctx->registered_user ? _RUNTIME_SCOPE_INVALID :
ctx->registered_system ? RUNTIME_SCOPE_SYSTEM : RUNTIME_SCOPE_USER,
!failed_system, !failed_user));
log_full_errno(r == -ENXIO ? LOG_DEBUG : LOG_INFO, /* Might have already been noticed and unregistered by machined itself */
r, "Failed to unregister machine in %s context, ignoring: %m",
machine_registration_scope_string(
ctx->registered_system && ctx->registered_user ? _RUNTIME_SCOPE_INVALID :
ctx->registered_system ? RUNTIME_SCOPE_SYSTEM : RUNTIME_SCOPE_USER,
!failed_system, !failed_user));
}
int unregister_machine(sd_bus *bus, const char *machine_name, RuntimeScope scope) {