]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nsresource: print nicer error message when trying to acquire an unpriv user ns range...
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Nov 2024 13:19:09 +0000 (14:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Dec 2024 14:35:23 +0000 (15:35 +0100)
src/shared/nsresource.c

index 24ea2e2be5680f6dd7c3a8f0419b7d701671d20f..2475315315a294711f1732033ce2fe51b417b286 100644 (file)
@@ -87,6 +87,8 @@ int nsresource_allocate_userns(const char *name, uint64_t size) {
                         SD_JSON_BUILD_PAIR("userNamespaceFileDescriptor", SD_JSON_BUILD_UNSIGNED(userns_fd_idx)));
         if (r < 0)
                 return log_debug_errno(r, "Failed to call AllocateUserRange() varlink call: %m");
+        if (streq_ptr(error_id, "io.systemd.NamespaceResource.UserNamespaceInterfaceNotSupported"))
+                return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Unprivileged user namespace delegation is not supported on this system.");
         if (error_id)
                 return log_debug_errno(sd_varlink_error_to_errno(error_id, reply), "Failed to allocate user namespace with %" PRIu64 " users: %s", size, error_id);