]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysctl: increase log severity on failed write
authorChristian Göttsche <cgzones@googlemail.com>
Mon, 13 Jun 2022 14:01:04 +0000 (16:01 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Jun 2022 00:29:37 +0000 (09:29 +0900)
Increase the log severity in case of writing to a non existent sysctl
parameter as this can either be caused by a misspelling or a kernel mis-
configuration, e.g. in case YAMA does not get loaded due to a incomplete
lsm= override:

    systemd-sysctl[354]: Couldn't write '1' to 'kernel/yama/ptrace_scope', ignoring: No such file or directory

src/sysctl/sysctl.c

index 24c8baab03f266b556aa442173b78effc7d6ea29..2b854a73709b42aa4333947ced1d6b7ec40fda6b 100644 (file)
@@ -107,7 +107,7 @@ static int sysctl_write_or_warn(const char *key, const char *value, bool ignore_
                 if (ignore_failure || r == -EROFS || ERRNO_IS_PRIVILEGE(r))
                         log_debug_errno(r, "Couldn't write '%s' to '%s', ignoring: %m", value, key);
                 else if (r == -ENOENT)
-                        log_info_errno(r, "Couldn't write '%s' to '%s', ignoring: %m", value, key);
+                        log_warning_errno(r, "Couldn't write '%s' to '%s', ignoring: %m", value, key);
                 else
                         return log_error_errno(r, "Couldn't write '%s' to '%s': %m", value, key);
         }