[PATCH] systemd: Stop supporting sysvinit compatibility

Richard Purdie
2026-02-13T17:56:24Z

Systemd has worked with sysvinit compatibility but upstream plans to remove
this and hence we will no longer be able to support it. We need to remove this
before the LTS since the support will certainly not be there for the lifetime
of the LTS.

This patch disables that usage mode and removes some of the compatibility logic.
There is more that can be removed, this is meant just to signal to people it is
no longer supported and start that process. Further cleanup can be made over time
in later commits.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes-recipe/systemd.bbclass | 14 +++-------
.../distro/include/init-manager-systemd.inc | 2 +-
meta/conf/distro/include/maintainers.inc | 1 -
.../systemd/systemd-compat-units.bb | 27 -------------------
meta/recipes-core/systemd/systemd_258.1.bb | 18 +++++--------
5 files changed, 12 insertions(+), 50 deletions(-)
delete mode 100644 meta/recipes-core/systemd/systemd-compat-units.bb

diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass
index 562e71fb56e..26eaaf1922f 100644
--- a/meta/classes-recipe/systemd.bbclass
+++ b/meta/classes-recipe/systemd.bbclass
@@ -18,14 +18,12 @@ SYSTEMD_AUTO_ENABLE ??= "enable"
# even if systemd is not in DISTRO_FEATURES. As such don't make any changes
# directly but check the DISTRO_FEATURES first.
python __anonymous() {
- # If the distro features have systemd but not sysvinit, inhibit update-rcd
- # from doing any work so that pure-systemd images don't have redundant init
- # files.
+ # Inhibit update-rcd from doing any work so that systemd images don't have
+ # redundant init files.
if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
d.appendVar("DEPENDS", " systemd-systemctl-native")
d.appendVar("PACKAGE_WRITE_DEPS", " systemd-systemctl-native")
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
}

systemd_postinst() {
@@ -295,9 +293,5 @@ rm_sysvinit_initddir() {
}

do_install[postfuncs] += "${RMINITDIR}"
-RMINITDIR = " \
- ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'rm_systemd_unitdir', d)} \
- ${@'rm_sysvinit_initddir' if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \
- not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) else ''} \
-"
+RMINITDIR = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'rm_sysvinit_initddir', 'rm_systemd_unitdir', d)}"
RMINITDIR:class-native = ""
diff --git a/meta/conf/distro/include/init-manager-systemd.inc b/meta/conf/distro/include/init-manager-systemd.inc
index 0a76647459b..1e64b8ad226 100644
--- a/meta/conf/distro/include/init-manager-systemd.inc
+++ b/meta/conf/distro/include/init-manager-systemd.inc
@@ -2,7 +2,7 @@
DISTRO_FEATURES:append = " systemd usrmerge"
DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit"
VIRTUAL-RUNTIME_init_manager ??= "systemd"
-VIRTUAL-RUNTIME_initscripts ??= "systemd-compat-units"
+VIRTUAL-RUNTIME_initscripts ??= ""
VIRTUAL-RUNTIME_login_manager ??= "shadow-base"
VIRTUAL-RUNTIME_dev_manager ??= "systemd"
# systemd hardcodes /root in its source codes, other values are not offically supported
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index f7728f3fad9..37d22df2f43 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -826,7 +826,6 @@ RECIPE_MAINTAINER:pn-systemd-bootchart = "Chen Qi <Qi.Chen@windriver.com>"
RECIPE_MAINTAINER:pn-systemd-bootconf = "Chen Qi <Qi.Chen@windriver.com>"
RECIPE_MAINTAINER:pn-systemd-boot-native = "Viswanath Kraleti <quic_vkraleti@quicinc.com>"
RECIPE_MAINTAINER:pn-systemd-conf = "Chen Qi <Qi.Chen@windriver.com>"
-RECIPE_MAINTAINER:pn-systemd-compat-units = "Chen Qi <Qi.Chen@windriver.com>"
RECIPE_MAINTAINER:pn-systemd-machine-units = "Chen Qi <Qi.Chen@windriver.com>"
RECIPE_MAINTAINER:pn-systemd-serialgetty = "Chen Qi <Qi.Chen@windriver.com>"
RECIPE_MAINTAINER:pn-systemd-systemctl-native = "Chen Qi <Qi.Chen@windriver.com>"
diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
deleted file mode 100644
index 68391010371..00000000000
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ /dev/null
@@ -1,27 +0,0 @@
-SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
-HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
-LICENSE = "MIT"
-
-DEPENDS = "systemd-systemctl-native"
-INHIBIT_DEFAULT_DEPS = "1"
-
-S = "${UNPACKDIR}"
-
-inherit features_check
-
-REQUIRED_DISTRO_FEATURES = "systemd"
-
-SYSTEMD_DISABLED_SYSV_SERVICES = " \
- busybox-udhcpc \
- hwclock \
- networking \
- nfsserver \
- nfscommon \
- syslog.busybox \
-"
-
-do_install() {
- for unit in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
- systemctl --root ${D} mask $unit
- done
-}
diff --git a/meta/recipes-core/systemd/systemd_258.1.bb b/meta/recipes-core/systemd/systemd_258.1.bb
index bd8a01f645d..3847b985476 100644
--- a/meta/recipes-core/systemd/systemd_258.1.bb
+++ b/meta/recipes-core/systemd/systemd_258.1.bb
@@ -18,6 +18,10 @@ REQUIRED_DISTRO_FEATURES += "usrmerge"
# that we don't build both udev and systemd in world builds.
REQUIRED_DISTRO_FEATURES += "systemd"

+# Systemd used to work with sysvinit compatibility but upstream plans to remove
+# this and hence we can no longer support it
+CONFLICT_DISTRO_FEATURES += "sysvinit"
+
SRC_URI += " \
file://touchscreen.rules \
file://00-create-volatile.conf \
@@ -62,7 +66,7 @@ PACKAGECONFIG ??= " \
${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit', 'link-udev-shared', d)} \
+ link-udev-shared \
backlight \
binfmt \
gshadow \
@@ -300,13 +304,6 @@ do_install() {

install -m 0644 ${UNPACKDIR}/00-create-volatile.conf ${D}${nonarch_libdir}/tmpfiles.d/

- if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${UNPACKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
- sed -i s%@UDEVD@%${nonarch_libdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
- install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
- fi
-
if ${@bb.utils.contains('FILESYSTEM_PERMS_TABLES', 'files/fs-perms-volatile-log.txt', 'true', 'false', d)}; then
# base-files recipe provides /var/log which is a symlink to /var/volatile/log
rm -rf ${D}${localstatedir}/log
@@ -841,10 +838,9 @@ INITSCRIPT_PACKAGES = "udev"
INITSCRIPT_NAME:udev = "systemd-udevd"
INITSCRIPT_PARAMS:udev = "start 03 S ."

-python __anonymous() {
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+INHIBIT_UPDATERCD_BBCLASS = "1"

+python __anonymous() {
if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d):
bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]")