Skip to contentSkip to conversation

systemd: Stop supporting sysvinit compatibility

PATCH In review Richard Purdie 3 participants 6 messages Feb 13 – Feb 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd: Stop supporting sysvinit compatibility

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.

---
 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
meta/classes-recipe/systemd.bbclass +4 -10
index 562e71fb56e..26eaaf1922f 100644
@@ -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 = ""
meta/conf/distro/include/init-manager-systemd.inc +1 -1
index 0a76647459b..1e64b8ad226 100644
@@ -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
meta/conf/distro/include/maintainers.inc +0 -1
index f7728f3fad9..37d22df2f43 100644
@@ -826,7 +826,6 @@ RECIPE_MAINTAINER:pn-systemd-bootchart = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-bootconf = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-boot-native = "Viswanath Kraleti <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-conf = "Chen Qi <[email protected]>"
-RECIPE_MAINTAINER:pn-systemd-compat-units = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-machine-units = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-serialgetty = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-systemd-systemctl-native = "Chen Qi <[email protected]>"
meta/recipes-core/systemd/systemd-compat-units.bb deleted +0 -27
deleted file mode 100644
index 68391010371..00000000000
@@ -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
-}
meta/recipes-core/systemd/systemd_258.1.bb +7 -11
index bd8a01f645d..3847b985476 100644
@@ -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]")
 
#1 lore raw
Quoted 5 lines · Richard Purdie via lists.openembedded.org

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.

Quoted 7 lines

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.

---

Hi Richard,

I suspect we also want to remove the "Systemd with sysvinit compat" and "Sysvinit with systemd" steps from qa-extras2:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/26/builds/3165
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json#n1562

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

Hi Mattieu,

Quoted 11 lines · Mathieu Dubois-Briand
Quoted 10 lines · Richard Purdie via lists.openembedded.org

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.

Quoted 7 lines
Quoted 1 line

I suspect we also want to remove the "Systemd with sysvinit compat" and "Sysvinit with systemd" steps from qa-extras2:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/26/builds/3165
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json#n1562

Yes, that is on my todo list! I knew we had a few tests to remove, I think that is the only one I haven't patched yet. Thankfully an easy tweak for a change.

Cheers,

Richard

#3 lore raw
Quoted 22 lines · Richard Purdie

Hi Mattieu,

Quoted 11 lines · Mathieu Dubois-Briand
Quoted 10 lines · Richard Purdie via lists.openembedded.org

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.

Quoted 7 lines
Quoted 1 line

I suspect we also want to remove the "Systemd with sysvinit compat" and "Sysvinit with systemd" steps from qa-extras2:

https://autobuilder.yoctoproject.org/valkyrie/#/builders/26/builds/3165
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json#n1562

Quoted 7 lines

Yes, that is on my todo list! I knew we had a few tests to remove, I think that is the only one I haven't patched yet. Thankfully an easy tweak for a change.

Cheers,

Richard

Just in case: I also noted following selftests:

bbclasses.Systemd.test_systemd_and_sysvinit_in_distro overlayfs.OverlayFSTests.test_not_all_units_installed overlayfs.OverlayFSTests.test_not_all_units_installed_but_qa_skipped

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
Quoted 8 lines · Mathieu Dubois-Briand via lists.openembedded.org

Just in case: I also noted following selftests:

bbclasses.Systemd.test_systemd_and_sysvinit_in_distro overlayfs.OverlayFSTests.test_not_all_units_installed overlayfs.OverlayFSTests.test_not_all_units_installed_but_qa_skipped

Thanks,
Mathieu

Overlayfs feature doesn't use sysvinit.

Slava

#5 lore raw
Quoted 11 lines · Vyacheslav Yurkov
Quoted 8 lines · Mathieu Dubois-Briand via lists.openembedded.org

Just in case: I also noted following selftests:

bbclasses.Systemd.test_systemd_and_sysvinit_in_distro overlayfs.OverlayFSTests.test_not_all_units_installed overlayfs.OverlayFSTests.test_not_all_units_installed_but_qa_skipped

Thanks,
Mathieu

Overlayfs feature doesn't use sysvinit.

Some of the overlayfs tests still have sysvinit compatibility enabled which is why these tests started failing. I have a patch which tweaks those just to use systemd only which fixes that.

Cheers,

Richard