Bug#923559: systemd-udevd: writes to kernel log

Thorsten Glaser tg at debian.org
Sun Mar 3 22:27:59 GMT 2019


tags 923559 + patch
thanks

On Sat, 2 Mar 2019, Michael Biebl wrote:

> The only other option you have is to disable logging in udevd completely.

How about the attached patch? I’ve verified it, as since recently
(re)starting udev always produces an uninteresting/tautologic warning:

Mar  3 23:20:49 tglase vmunix: [8820159.381621] systemd-udevd[14028]: Network interface NamePolicy= disabled on kernel command line, ignoring.
Mar  3 23:20:54 tglase sudo:   tglase : TTY=pts/3 ; PWD=/var/cache/pbuilder/result-dpo ; USER=root ; COMMAND=/usr/bin/dpkg -i udev_241-1.1_x32.deb
Mar  3 23:20:54 tglase sudo: pam_unix(sudo:session): session opened for user root by tglase(uid=0)
Mar  3 23:21:00 tglase systemd-udevd[14168]: Network interface NamePolicy= disabled on kernel command line, ignoring.

(Before this I hacked /var/lib/dpkg/status to set all versions from 241-1
to 241-1.1 so this dpkg command could succeed.)

> >>> This is expected behaviour. udevd uses the journal for logging and falls
> >>> back to log to the kernel ring buffer if the journal is not available.
> >
> > Make it fall back to syslog first, then, please.

> We won't develop and maintain a downstream patch for that and I'm pretty
> sure upstream is not interested in that either since they have a
> perfectly working solution for that.

Could you please, at least, forward the attached patch upstream,
if you’re not willing to maintain it downstream? It turns out
that the fix was really trivial. (I think it goes without saying
that it’s better if I don’t interact directly with upstream.)

Thanks,
//mirabilos
-- 
[17:15:07] Lukas Degener: Kleines Asterix-Latinum für Softwaretechniker:
	   veni, vidi, fixi(t) ;-)
-------------- next part --------------
diff -Nru systemd-241/debian/changelog systemd-241/debian/changelog
--- systemd-241/debian/changelog	2019-02-22 00:10:15.000000000 +0100
+++ systemd-241/debian/changelog	2019-03-03 23:00:57.000000000 +0100
@@ -1,3 +1,10 @@
+systemd (241-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch to prefer syslog over kmsg for auto logging. (Closes: #923559)
+
+ -- Thorsten Glaser <tg at mirbsd.de>  Sun, 03 Mar 2019 23:00:57 +0100
+
 systemd (241-1) unstable; urgency=medium
 
   [ Adam Borowski ]
diff -Nru systemd-241/debian/patches/debian/Use-syslog-for-AUTO-logging-before-klog.patch systemd-241/debian/patches/debian/Use-syslog-for-AUTO-logging-before-klog.patch
--- systemd-241/debian/patches/debian/Use-syslog-for-AUTO-logging-before-klog.patch	1970-01-01 01:00:00.000000000 +0100
+++ systemd-241/debian/patches/debian/Use-syslog-for-AUTO-logging-before-klog.patch	2019-03-03 23:00:54.000000000 +0100
@@ -0,0 +1,32 @@
+# DP: make LOG_TARGET_AUTO fall back to syslog before kernel message buffer
+# DP: fixes #923559
+
+--- a/src/basic/log.c
++++ b/src/basic/log.c
+@@ -257,6 +257,7 @@ int log_open(void) {
+ 
+                 if (!prohibit_ipc &&
+                     IN_SET(log_target, LOG_TARGET_SYSLOG_OR_KMSG,
++                                       LOG_TARGET_AUTO,
+                                        LOG_TARGET_SYSLOG)) {
+                         r = log_open_syslog();
+                         if (r >= 0) {
+@@ -603,6 +604,7 @@ int log_dispatch_internal(
+                 }
+ 
+                 if (IN_SET(log_target, LOG_TARGET_SYSLOG_OR_KMSG,
++                                       LOG_TARGET_AUTO,
+                                        LOG_TARGET_SYSLOG)) {
+ 
+                         k = write_to_syslog(level, error, file, line, func, buffer);
+--- a/src/basic/log.h
++++ b/src/basic/log.h
+@@ -30,7 +30,7 @@ typedef enum LogTarget{
+         LOG_TARGET_JOURNAL_OR_KMSG,
+         LOG_TARGET_SYSLOG,
+         LOG_TARGET_SYSLOG_OR_KMSG,
+-        LOG_TARGET_AUTO, /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */
++        LOG_TARGET_AUTO, /* console if stderr is tty, journal or syslog or kmsg otherwise */
+         LOG_TARGET_NULL,
+         _LOG_TARGET_MAX,
+         _LOG_TARGET_INVALID = -1
diff -Nru systemd-241/debian/patches/series systemd-241/debian/patches/series
--- systemd-241/debian/patches/series	2019-02-22 00:10:15.000000000 +0100
+++ systemd-241/debian/patches/series	2019-03-03 22:58:11.000000000 +0100
@@ -21,3 +21,4 @@
 debian/Add-env-variable-for-machine-ID-path.patch
 debian/Revert-udev-rules-Permission-changes-for-dev-dri-renderD.patch
 debian/Drop-seccomp-system-call-filter-for-udev.patch
+debian/Use-syslog-for-AUTO-logging-before-klog.patch


More information about the Pkg-systemd-maintainers mailing list