]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rm-rf: downgrade root check log when directory doesn't exist
authorLuca Boccassi <luca.boccassi@gmail.com>
Wed, 22 Jul 2026 11:14:15 +0000 (12:14 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 Jul 2026 13:09:36 +0000 (15:09 +0200)
When a unit is stopped we try to destroy the credential mount point,
which might not exist. This logs at error level, which is noisy and
pointless. Downgrade to debug level on ENOENT.

systemd[1]: Failed to determine whether '/run/credentials/run-p119516-i119816.service' is the root file system: No such file or directory

Follow-up for 9dd2dab37e91ab4b000802d98aa7c4713836d53a

src/shared/rm-rf.c

index 203e075b9a928a2f6601e2c1cc1a16fcee665650..491d1edab8d528a5208552a0dd4f0b819dc1b636 100644 (file)
@@ -449,7 +449,11 @@ int rm_rf_at(int dir_fd, const char *path, RemoveFlags flags) {
         if (FLAGS_SET(flags, REMOVE_MISSING_OK) && r == -ENOENT)
                 return 0;
         if (r < 0)
-                return log_error_errno(r, "Failed to determine whether '%s' is the root file system: %m", path);
+                return log_full_errno(
+                                r == -ENOENT ? LOG_DEBUG : LOG_ERR,
+                                r,
+                                "Failed to determine whether '%s' is the root file system: %m",
+                                path);
         if (r > 0)
                 return log_error_errno(SYNTHETIC_ERRNO(EPERM),
                                        "Attempted to remove entire root file system, and we can't allow that.");