summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-06-27 18:46:28 +0200
committerLennart Poettering <lennart@poettering.net>2023-06-27 23:21:03 +0200
commitf4d4ca6e2be114d906db147d0cf224f13a8b29b2 (patch)
tree57d4743139b5c9fa27b834799151b994036d1dfb
parentjournalctl: read env vars that override compiled catalog database and source ... (diff)
downloadsystemd-f4d4ca6e2be114d906db147d0cf224f13a8b29b2.tar.xz
systemd-f4d4ca6e2be114d906db147d0cf224f13a8b29b2.zip
sysv-generator: make sysv deprecation message a bit "louder"
Let's add a catalog entry, make the log record structured, and most importantly, let's add warning emojis. Just to underline that this stuff should really go away.
-rw-r--r--catalog/systemd.catalog.in20
-rw-r--r--src/systemd/sd-messages.h3
-rw-r--r--src/sysv-generator/sysv-generator.c15
3 files changed, 35 insertions, 3 deletions
diff --git a/catalog/systemd.catalog.in b/catalog/systemd.catalog.in
index 913d4987ac..8ca0b4d227 100644
--- a/catalog/systemd.catalog.in
+++ b/catalog/systemd.catalog.in
@@ -564,3 +564,23 @@ the OS.
@TRIMMED_BYTES@ of memory were returned to the OS, which took @TRIMMED_USEC@
micro-seconds (μs).
+
+-- a8fa8dacdb1d443e9503b8be367a6adb
+Subject: SysV Service Found
+Defined-By: systemd
+Support: %SUPPORT_URL%
+
+A System V service script @SYSVSCRIPT@ has been found on the system that lacks
+a native systemd unit. An automatic unit file @UNIT@ has been generated for
+compatibility.
+
+Note that these automatically generated compatibility unit files cannot replace
+native unit files as they generally slow down the system (by creating
+unnecessary, additional synchronization points), are less robust (as SysV services
+cannot properly be life-cycle tracked or automatically restarted) and less
+secure (as no sandboxing restrictions can be enforced).
+
+Compatibility support for System V services in systemd is deprecated. Please
+make sure to update the package in question to provide proper, native systemd
+unit files. Contact vendor if necesssary. Compatibility support for System V
+services is deprecated and will be removed soon.
diff --git a/src/systemd/sd-messages.h b/src/systemd/sd-messages.h
index 39f56240fe..3bb83ecb4e 100644
--- a/src/systemd/sd-messages.h
+++ b/src/systemd/sd-messages.h
@@ -198,6 +198,9 @@ _SD_BEGIN_DECLARATIONS;
#define SD_MESSAGE_MEMORY_TRIM SD_ID128_MAKE(f9,b0,be,46,5a,d5,40,d0,85,0a,d3,21,72,d5,7c,21)
#define SD_MESSAGE_MEMORY_TRIM_STR SD_ID128_MAKE_STR(f9,b0,be,46,5a,d5,40,d0,85,0a,d3,21,72,d5,7c,21)
+#define SD_MESSAGE_SYSV_GENERATOR_DEPRECATED SD_ID128_MAKE(a8,fa,8d,ac,db,1d,44,3e,95,03,b8,be,36,7a,6a,db)
+#define SD_MESSAGE_SYSV_GENERATOR_DEPRECATED_STR SD_ID128_MAKE_STR(a8,fa,8d,ac,db,1d,44,3e,95,03,b8,be,36,7a,6a,db)
+
_SD_END_DECLARATIONS;
#endif
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 42aa123de6..ea5f47321c 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -4,6 +4,8 @@
#include <stdio.h>
#include <unistd.h>
+#include "sd-messages.h"
+
#include "alloc-util.h"
#include "dirent-util.h"
#include "exit-status.h"
@@ -758,9 +760,16 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
if (!fpath)
return log_oom();
- log_warning("SysV service '%s' lacks a native systemd unit file. "
- "Automatically generating a unit file for compatibility. "
- "Please update package to include a native systemd unit file, in order to make it more safe and robust.", fpath);
+ log_struct(LOG_WARNING,
+ LOG_MESSAGE("SysV service '%s' lacks a native systemd unit file. "
+ "%s Automatically generating a unit file for compatibility. Please update package to include a native systemd unit file, in order to make it safe, robust and future-proof. "
+ "%s This compatibility logic is deprecated, expect removal soon. %s",
+ fpath,
+ special_glyph(SPECIAL_GLYPH_RECYCLING),
+ special_glyph(SPECIAL_GLYPH_WARNING_SIGN), special_glyph(SPECIAL_GLYPH_WARNING_SIGN)),
+ "MESSAGE_ID=" SD_MESSAGE_SYSV_GENERATOR_DEPRECATED_STR,
+ "SYSVSCRIPT=%s", fpath,
+ "UNIT=%s", name);
service = new(SysvStub, 1);
if (!service)