Make systemd as default init manager and configure wired network
v4 cover Make systemd as default init manager and configure wired network
From: Kai Kang <[email protected]>
v4:
* move the configures to poky.conf. Introduce a new variable 'POKY_INIT_MANAGER' whose value should be either 'systemd' or 'sysvinit' to configure the init manager setting.
Kai Kang (3):
poky.conf: make systemd as default init manager poky-tiny.conf: not backfill distro feature systemd
systemd-conf: configure wired network with dhcp
meta-poky/conf/distro/poky-tiny.conf | 2 +- meta-poky/conf/distro/poky.conf | 10 ++++++++++ meta-poky/conf/local.conf.sample.extended | 9 --------- meta/recipes-core/systemd/systemd-conf/wired.network | 9 +++++++++ meta/recipes-core/systemd/systemd-conf_242.bb | 6 ++++++ 5 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd-conf/wired.network
--
2.20.0
PATCH v4 1/3 poky.conf: make systemd as default init manager
From: Kai Kang <[email protected]>
Move configurations from local.conf.sample.extended to poky.conf to make systemd as default init manager for poky. Introduce a new variable 'POKY_INIT_MANAGER' whose value should be either 'systemd' or 'sysvinit' to configure the init manager setting.
For users who still want to use sysvinit, set in local.conf or any other configure file with:
POKY_INIT_MANAGER = "sysvinit"
[YOCTO #13031]
--- meta-poky/conf/distro/poky.conf | 10 ++++++++++ meta-poky/conf/local.conf.sample.extended | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-)
meta-poky/conf/distro/poky.conf +10 -0
@@ -21,6 +21,16 @@ POKY_DEFAULT_EXTRA_RRECOMMENDS = "kernel-module-af-packet" DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${POKY_DEFAULT_DISTRO_FEATURES}" +# +# Use systemd for system initialization +# +POKY_INIT_MANAGER ?= "systemd" +DISTRO_FEATURES_BACKFILL += "${POKY_INIT_MANAGER}" +DISTRO_FEATURES_BACKFILL_CONSIDERED += "${@bb.utils.contains('POKY_INIT_MANAGER', 'systemd', 'sysvinit', 'systemd', d)}" +VIRTUAL-RUNTIME_login_manager = "${@bb.utils.contains('POKY_INIT_MANAGER', 'systemd', 'shadow-base', 'busybox', d)}" +VIRTUAL-RUNTIME_init_manager = "${POKY_INIT_MANAGER}" +VIRTUAL-RUNTIME_initscripts = "${@bb.utils.contains('POKY_INIT_MANAGER', 'systemd', 'systemd-compat-units', 'initscripts', d)}" + PREFERRED_VERSION_linux-yocto ?= "5.0%" SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
meta-poky/conf/local.conf.sample.extended +0 -9
@@ -377,12 +377,3 @@ DISTRO_FEATURES_remove = "x11" #VIRTUAL-RUNTIME_initscripts = "initscripts" #VIRTUAL-RUNTIME_keymaps = "keymaps" #DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit" - -# -# Use systemd for system initialization -# -#DISTRO_FEATURES_append = " systemd" -#DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit" -#VIRTUAL-RUNTIME_login_manager = "shadow-base" -#VIRTUAL-RUNTIME_init_manager = "systemd" -#VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
Signature · 1 line
2.20.0
Re: [meta-poky][PATCH v4 1/3] poky.conf: make systemd as default init manager
Quoted 15 lines · On Thu, 2019-05-30 at 05:22 -0400, [email protected] wrote:
From: Kai Kang <[email protected]>
Move configurations from local.conf.sample.extended to poky.conf to make
systemd as default init manager for poky. Introduce a new variable 'POKY_INIT_MANAGER' whose value should be either 'systemd' or 'sysvinit'
to configure the init manager setting.For users who still want to use sysvinit, set in local.conf or any other
configure file with:
POKY_INIT_MANAGER= "sysvinit"
Quoted 7 lines
[YOCTO #13031]
Signed-off-by Kai Kang <[email protected]>--- meta-poky/conf/distro/poky.conf | 10 ++++++++++ meta-poky/conf/local.conf.sample.extended | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-)
Thanks for working on this patchset, I think its nearly there. I'm wondering if we should set
POKY_INIT_MANAGER_libc-musl = "sysvinit"
since I am worried about what I read about musl and systemd from a security perspective.
I'm also wondering what we need to do with the autobuilder init system tests, I think those may need rewriting to add some sysvinit tests.
Does POKY_INIT_MANAGER = "sysvinit systemd" work for the mode where we allow old sysvinit scripts for compatibility?
Cheers,
Richard
Re: [meta-poky][PATCH v4 1/3] poky.conf: make systemd as default init manager
Quoted 23 lines · On 2019/5/30 下午7:44, [email protected] wrote:
Quoted 15 lines · On Thu, 2019-05-30 at 05:22 -0400, [email protected] wrote:
From: Kai Kang <[email protected]>
Move configurations from local.conf.sample.extended to poky.conf to make
systemd as default init manager for poky. Introduce a new variable 'POKY_INIT_MANAGER' whose value should be either 'systemd' or 'sysvinit'
to configure the init manager setting.For users who still want to use sysvinit, set in local.conf or any other
configure file with:
POKY_INIT_MANAGER= "sysvinit"Quoted 7 lines
[YOCTO #13031]
Signed-off-by Kai Kang <[email protected]>--- meta-poky/conf/distro/poky.conf | 10 ++++++++++ meta-poky/conf/local.conf.sample.extended | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-)
Quoted 7 lines
Thanks for working on this patchset, I think its nearly there. I'm wondering if we should set
POKY_INIT_MANAGER_libc-musl = "sysvinit"
since I am worried about what I read about musl and systemd from a security perspective.
OK. I'll add it.
Quoted 3 lines
I'm also wondering what we need to do with the autobuilder init system tests, I think those may need rewriting to add some sysvinit tests.
Something likes meta/lib/oeqa/runtime/cases/systemd.py? I think it is better to do in next milestone and create a defect to address it. If it is ok, I'll create one.
Quoted 3 lines
Does
POKY_INIT_MANAGER= "sysvinit systemd" work for the mode where we allow old sysvinit scripts for compatibility?
I am afraid only one value could be set for POKY_INIT_MANAGER. And I believe that most packages have been supporting systemd. If there is, we can add a systemd service file for it.
BTW, POKY_INIT_MANAGER doesn't consider the case of mdev/busybox. If want to use mdev/busybox for init, just set DISTRO with poky-tiny and everything have been set properly in poky-tiny.conf.
Regards,
Kai
Quoted 6 lines
Cheers,
Richard
Signature · 1 line
Kai Kang
Re: [meta-poky][PATCH v4 1/3] poky.conf: make systemd as default init manager
Quoted 38 lines · Kang Kai
Quoted 26 lines · On 2019/5/30 下午7:44, [email protected] wrote:
Quoted 18 lines · On Thu, 2019-05-30 at 05:22 -0400, [email protected] wrote:
From: Kai Kang <[email protected]>
Move configurations from local.conf.sample.extended to poky.conf to
make
systemd as default init manager for poky. Introduce a new variable
'POKY_INIT_MANAGER' whose value should be either 'systemd' or 'sysvinit'
to configure the init manager setting.For users who still want to use sysvinit, set in local.conf or any
other
configure file with:
POKY_INIT_MANAGER= "sysvinit"Quoted 7 lines
[YOCTO #13031]
Signed-off-by Kai Kang <[email protected]>--- meta-poky/conf/distro/poky.conf | 10 ++++++++++ meta-poky/conf/local.conf.sample.extended | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-)Quoted 7 lines
Thanks for working on this patchset, I think its nearly there. I'm wondering if we should set
POKY_INIT_MANAGER_libc-musl = "sysvinit"
since I am worried about what I read about musl and systemd from a security perspective.
OK. I'll add it.
Quoted 7 lines
Quoted 3 lines
I'm also wondering what we need to do with the autobuilder init system
tests, I think those may need rewriting to add some sysvinit tests.Something likes
meta/lib/oeqa/runtime/cases/systemd.py? I think it is better to do in next milestone and create a defect to address it. If it is ok, I'll create one.
No, I mean:
http://git.yoctoproject.org/cgit.cgi/yocto-autobuilder-helper/tree/config.json#n813
which corresponds to steps 5-7 of 'qa-extras2' on the autobuilder.
We're going to need to update the test configuration on master to cover the things we no longer test and remove the duplication.
Quoted 6 lines
Quoted 2 lines
Does
POKY_INIT_MANAGER= "sysvinit systemd" work for the mode where we allow old sysvinit scripts for compatibility?I am afraid only one value could be set for
POKY_INIT_MANAGER. And I believe that most packages have been supporting systemd. If there is, we can add a systemd service file for it.
This isn't the point, we support 3 different configurations of this and the variable needs to reflect that.
How about a slightly different approach. We define POKY_INIT_MANAGER to take three different values, sysvinit, systemd and systemd-compat.
We do something like:
require conf/distro/include/init-template-${POKY_INIT_MANAGER}.inc
and then put the appropriate configuration in each .inc file?
Quoted 3 lines
BTW,
POKY_INIT_MANAGERdoesn't consider the case of mdev/busybox. If want to use mdev/busybox for init, just set DISTRO with poky-tiny and everything have been set properly in poky-tiny.conf.
This might be an opportunity to have another setting for POKY_INIT_MANAGER which covers this too through an additional .inc?
Cheers,
Richard
Re: [meta-poky][PATCH v4 1/3] poky.conf: make systemd as default init manager
Quoted 68 lines · On 2019/5/31 下午5:00, [email protected] wrote:
Quoted 37 lines · Kang Kai
Quoted 26 lines · On 2019/5/30 下午7:44, [email protected] wrote:
Quoted 18 lines · On Thu, 2019-05-30 at 05:22 -0400, [email protected] wrote:
From: Kai Kang <[email protected]>
Move configurations from local.conf.sample.extended to poky.conf to
make
systemd as default init manager for poky. Introduce a new variable
'POKY_INIT_MANAGER' whose value should be either 'systemd' or 'sysvinit'
to configure the init manager setting.For users who still want to use sysvinit, set in local.conf or any
other
configure file with:
POKY_INIT_MANAGER= "sysvinit"Quoted 7 lines
[YOCTO #13031]
Signed-off-by Kai Kang <[email protected]>--- meta-poky/conf/distro/poky.conf | 10 ++++++++++ meta-poky/conf/local.conf.sample.extended | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-)Quoted 7 lines
Thanks for working on this patchset, I think its nearly there. I'm wondering if we should set
POKY_INIT_MANAGER_libc-musl = "sysvinit"
since I am worried about what I read about musl and systemd from a security perspective.
OK. I'll add it.
Quoted 6 lines
Quoted 3 lines
I'm also wondering what we need to do with the autobuilder init system
tests, I think those may need rewriting to add some sysvinit tests.Something likes
meta/lib/oeqa/runtime/cases/systemd.py? I think it is better to do in next milestone and create a defect to address it. If it is ok, I'll create one.No, I mean:
http://git.yoctoproject.org/cgit.cgi/yocto-autobuilder-helper/tree/config.json#n813
which corresponds to steps 5-7 of 'qa-extras2' on the autobuilder.
We're going to need to update the test configuration on master to cover the things we no longer test and remove the duplication.
Quoted 5 lines
Quoted 2 lines
Does
POKY_INIT_MANAGER= "sysvinit systemd" work for the mode where we allow old sysvinit scripts for compatibility?I am afraid only one value could be set for
POKY_INIT_MANAGER. And I believe that most packages have been supporting systemd. If there is, we can add a systemd service file for it.This isn't the point, we support 3 different configurations of this and the variable needs to reflect that.
How about a slightly different approach. We define
POKY_INIT_MANAGERto take three different values, sysvinit, systemd and systemd-compat.We do something like:
require conf/distro/include/init-template-${POKY_INIT_MANAGER}.inc
Quoted 7 lines
and then put the appropriate configuration in each .inc file?
Quoted 3 lines
BTW,
POKY_INIT_MANAGERdoesn't consider the case of mdev/busybox. If want to use mdev/busybox for init, just set DISTRO with poky-tiny and everything have been set properly in poky-tiny.conf.This might be an opportunity to have another setting for
POKY_INIT_MANAGERwhich covers this too through an additional .inc?
Got it.
Regards,
Kai
Quoted 7 lines
Cheers,
Richard
Signature · 1 line
Kai Kang
PATCH v4 2/3 poky-tiny.conf: not backfill distro feature systemd
In reply to [email protected]From: Kai Kang <[email protected]>
systemd has been added to DISTRO_FEATURES_BACKFILL for poky by default, but it is compatible with poky-tiny. So not backfile it to DISTRO_FEATURES by adding it to DISTRO_FEATURES_BACKFILL_CONSIDERED.
--- meta-poky/conf/distro/poky-tiny.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-poky/conf/distro/poky-tiny.conf +1 -1
@@ -87,7 +87,7 @@ VIRTUAL-RUNTIME_login_manager = "busybox" VIRTUAL-RUNTIME_init_manager = "busybox" VIRTUAL-RUNTIME_initscripts = "initscripts" VIRTUAL-RUNTIME_keymaps = "keymaps" -DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit" +DISTRO_FEATURES_BACKFILL_CONSIDERED += "systemd sysvinit" # FIXME: Consider adding "modules" to MACHINE_FEATURES and using that in # packagegroup-core-base to select modutils-initscripts or not. Similar with "net" and
Signature · 1 line
2.20.0
PATCH v4 3/3 systemd-conf: configure wired network with dhcp
In reply to [email protected]From: Kai Kang <[email protected]>
Add a configure file for systemd.networkd to configure wired network interfaces with dhcp. It works with common network interfaces such eth0 and eno1. And do not install it for qemu bsps.
Refer to
https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
[YOCTO #13057]
--- meta/recipes-core/systemd/systemd-conf/wired.network | 9 +++++++++ meta/recipes-core/systemd/systemd-conf_242.bb | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd-conf/wired.network
meta/recipes-core/systemd/systemd-conf/wired.network new file +9 -0
@@ -0,0 +1,9 @@ +[Match] +Name=en* eth* + +[Network] +DHCP=yes + +[DHCP] +RouteMetric=10 +ClientIdentifier=mac
meta/recipes-core/systemd/systemd-conf_242.bb +6 -0
@@ -10,17 +10,22 @@ SRC_URI = "\ file://logind.conf \ file://system.conf \ file://system.conf-qemuall \ + file://wired.network \ " do_install() { install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf + install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network } # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 do_install_append_qemuall() { install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf + + # Do not install wired.network for qemu bsps + rm -rf ${D}${systemd_unitdir}/network } PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -29,4 +34,5 @@ FILES_${PN} = "\ ${systemd_unitdir}/journald.conf.d/ \ ${systemd_unitdir}/logind.conf.d/ \ ${systemd_unitdir}/system.conf.d/ \ + ${systemd_unitdir}/network/ \ "
Signature · 1 line
2.20.0