]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: log allocation failure at debug level in Varlink service mode
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 16 Jul 2026 11:45:23 +0000 (13:45 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Thu, 16 Jul 2026 11:59:18 +0000 (13:59 +0200)
When systemd-sysinstall probes whether an installation would fit by
calling io.systemd.Repart.Run() in dry-run mode, systemd-repart runs as
a child process sharing sysinstall's stderr. When the requested
partitions didn't fit, context_ponder() logged its failure at LOG_ERR
before vl_method_run() converted it into a structured Varlink error
(InsufficientFreeSpace or DiskTooSmall), which the client then reports
to the user in its own words. The internal message hence appeared
interleaved with the user-facing report:

    Can't fit requested partitions into available free space (1.9G), refusing.
    The selected disk is not large enough for an OS installation.
    The size of the selected disk is 0B, but a minimal size of 15.7G is required.

Log at LOG_DEBUG when running as a Varlink service, and keep LOG_ERR
for CLI invocations, where this message is the primary error report
shown to the user.

src/repart/repart.c

index fdca12a847e51c6bf2a2bfeedb3a921e7a636dff..7a6c542c692a4265dad020341eaf3c0752d489f1 100644 (file)
@@ -11402,10 +11402,13 @@ static int context_ponder(Context *context) {
                 if (context_drop_or_foreignize_one_priority(context))
                         continue; /* Still no luck. Let's drop a priority and try again. */
 
-                /* No more priorities left to drop. This configuration just doesn't fit on this disk... */
-                return log_error_errno(SYNTHETIC_ERRNO(ENOSPC),
-                                       "Can't fit requested partitions into available free space (%s), refusing.",
-                                       FORMAT_BYTES(largest_free_area));
+                /* No more priorities left to drop. This configuration just doesn't fit on this disk...
+                 * In Varlink service mode the failure is reported to the client as a structured error,
+                 * hence only log at debug level here. */
+                return log_full_errno(arg_varlink ? LOG_DEBUG : LOG_ERR,
+                                      SYNTHETIC_ERRNO(ENOSPC),
+                                      "Can't fit requested partitions into available free space (%s), refusing.",
+                                      FORMAT_BYTES(largest_free_area));
         }
 
         LIST_FOREACH(partitions, p, context->partitions) {