disallow multiple syslog daemons to be installed
cover disallow multiple syslog daemons to be installed
In OE core, we had the assumption that multiple syslog daemons could be installed at the same time. We did some work to cope with this assumption, including using update-alternatives to manage syslog related files.
In meta-openembedded, rsyslog and syslog-ng have already set RCONFLICTS to avoid being installed with other syslog daemons.
Checking Fedora and Ubuntu, they both disallow installation of multiple syslog daemons. (For other distros, I haven't checked.)
I support forbidding installing multiple syslog daemons. Reasons are below.
1) It makes things simpler and cleaner.
2) It doesn't make much sense to install multiple syslog daemons.
3) Our current implementation has some problems. One of them is that the /etc/systemd/system/syslog.service symlink is determined by the installation order of syslog daemons, while other syslog related files including syslog configuration files are determined by update-alternatives mechanism. For more info for the /etc/systemd/system/syslog.service symlink, please refer to https://www.freedesktop.org/wiki/Software/systemd/syslog/.
These two patches fix busybox and sysklogd to disallow installing multiple syslog daemons.
The following changes since commit ee5bce2d11e783c0921df47b629025a6b67c44bf:
kernel-dev: Removed bad reference for creating patches. (2017-09-02 00:52:49 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib ChenQi/syslog-conflicts
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/syslog-conflicts
Chen Qi (2):
busybox: fix syslog related meta data
sysklogd: conflict with other syslog daemons
meta/recipes-core/busybox/busybox.inc | 27 +++++++-------------------- meta/recipes-extended/sysklogd/sysklogd.inc | 12 ++++-------- 2 files changed, 11 insertions(+), 28 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 busybox: fix syslog related meta data
Set RCONFLICTS to disallow multiple syslog daemon providers to be installed on the target at the same time, and remove codes which dealt with such situation.
Supporting multiple syslog daemons on the same image doesn't have much sense. rsyslog and syslog-ng in meta-oe have set RCONFLICTS to disallow this. And we do the same for busybox.
Also, remove the line of creating a meaningless symlink of /lib/systemd/syslog.service to /dev/null.
--- meta/recipes-core/busybox/busybox.inc | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
meta/recipes-core/busybox/busybox.inc +7 -20
@@ -41,7 +41,9 @@ INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" SYSTEMD_PACKAGES = "${PN}-syslog" SYSTEMD_SERVICE_${PN}-syslog = "${@bb.utils.contains('SRC_URI', 'file://syslog.cfg', 'busybox-syslog.service', '', d)}" -CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}" +CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf" +RCONFLICTS_${PN}-syslog = "rsyslog sysklogd syslog-ng" + CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf" RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
@@ -248,9 +250,9 @@ do_install () { fi if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then - install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog.${BPN} - install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf.${BPN} - install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf.${BPN} + install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog + install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf + install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf fi if grep "CONFIG_CROND=y" ${B}/.config; then install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
@@ -311,7 +313,6 @@ do_install () { install -d ${D}${sysconfdir}/default install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog fi - ln -sf /dev/null ${D}${systemd_unitdir}/system/syslog.service fi if grep -q "CONFIG_KLOGD=y" ${B}/.config; then install -d ${D}${systemd_unitdir}/system
@@ -322,7 +323,7 @@ do_install () { # Remove the sysvinit specific configuration file for systemd systems to avoid confusion if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then - rm -f ${D}${sysconfdir}/syslog-startup.conf.${BPN} + rm -f ${D}${sysconfdir}/syslog-startup.conf fi }
@@ -336,20 +337,6 @@ inherit update-alternatives ALTERNATIVE_PRIORITY = "50" -ALTERNATIVE_${PN}-syslog += "${@bb.utils.contains('SRC_URI', 'file://syslog.cfg', 'syslog-conf', '', d)}" -ALTERNATIVE_LINK_NAME[syslog-conf] = "${@bb.utils.contains('SRC_URI', 'file://syslog.cfg', "${sysconfdir}/syslog.conf", '', d)}" - -python () { - if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): - pn = d.getVar('PN') - d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-init') - d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (d.getVar('sysconfdir'))) - d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir'), d.getVar('BPN'))) - d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-startup-conf') - d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-startup-conf', '%s/syslog-startup.conf' % (d.getVar('sysconfdir'))) - d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-startup-conf', '%s/syslog-startup.conf.%s' % (d.getVar('sysconfdir'), d.getVar('BPN'))) -} - python do_package_prepend () { # We need to load the full set of busybox provides from the /etc/busybox.links # Use this to see the update-alternatives with the right information
Signature · 1 line
1.9.1
PATCH 2/2 sysklogd: conflict with other syslog daemons
In reply to Chen QiSet RCONFLICTS to disallow multiple syslog daemon providers to be installed on the target, and remove codes that deal with such situation.
Also, set ALTERNATIVE_PRIORITY back to 100. It was set to '10' in case of systemd because sysklogd didn't have systemd support. For now, if we disallow multiple syslog daemons to be installed, and it stays '10', then if sysklogd is installed on target, the /sbin/syslogd would link to /bin/busybox.nosuid, causing sysklogd service files using busybox's utility.
--- meta/recipes-extended/sysklogd/sysklogd.inc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
meta/recipes-extended/sysklogd/sysklogd.inc +4 -8
@@ -32,7 +32,8 @@ SYSTEMD_SERVICE_${PN} = "syslogd.service klogd.service" SYSTEMD_AUTO_ENABLE = "enable" INITSCRIPT_NAME = "syslog" -CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${BPN}" +CONFFILES_${PN} = "${sysconfdir}/syslog.conf" +RCONFLICTS_${PN}-syslog = "rsyslog busybox-syslog syslog-ng" CFLAGS += "-DSYSV -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
@@ -57,20 +58,15 @@ do_install () { FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/sysklogd.conf', '', d)}" -# sysklogd package has no internal systemd support, so we weigh busybox's -# sysklogd utility over it in case of systemd -ALTERNATIVE_PRIORITY = "${@bb.utils.contains('DISTRO_FEATURES','systemd','10','100',d)}" +ALTERNATIVE_PRIORITY = "100" -ALTERNATIVE_${PN} = "syslogd klogd syslog-conf \ - ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','syslog-init','',d)}" +ALTERNATIVE_${PN} = "syslogd klogd" ALTERNATIVE_${PN}-doc = "syslogd.8" ALTERNATIVE_LINK_NAME[syslogd.8] = "${mandir}/man8/syslogd.8" ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd" ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd" -ALTERNATIVE_LINK_NAME[syslog-init] = "${sysconfdir}/init.d/syslog" -ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf" pkg_prerm_${PN} () { if test "x$D" = "x"; then
Signature · 1 line
1.9.1
ping
Quoted 40 lines · Chen Qi
In OE core, we had the assumption that multiple syslog daemons could be installed at the same time. We did some work to cope with this assumption, including using update-alternatives to manage syslog related files.
In meta-openembedded, rsyslog and syslog-ng have already set RCONFLICTS to avoid being installed with other syslog daemons.
Checking Fedora and Ubuntu, they both disallow installation of multiple syslog daemons. (For other distros, I haven't checked.)
I support forbidding installing multiple syslog daemons. Reasons are below.
1) It makes things simpler and cleaner.
2) It doesn't make much sense to install multiple syslog daemons.
3) Our current implementation has some problems. One of them is that the/etc/systemd/system/syslog.servicesymlink is determined by the installation order of syslog daemons, while other syslog related files including syslog configuration files are determined by update-alternatives mechanism. For more info for the/etc/systemd/system/syslog.servicesymlink, please refer to https://www.freedesktop.org/wiki/Software/systemd/syslog/.These two patches fix busybox and sysklogd to disallow installing multiple syslog daemons.
The following changes since commit
ee5bce2d11e783c0921df47b629025a6b67c44bf:kernel-dev: Removed bad reference for creating patches. (2017-09-02 00:52:49 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contribChenQi/syslog-conflicts
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/syslog-conflictsChen Qi (2):
busybox: fix syslog related meta data
sysklogd: conflict with other syslog daemonsmeta/recipes-core/busybox/busybox.inc | 27 +++++++-------------------- meta/recipes-extended/sysklogd/sysklogd.inc | 12 ++++-------- 2 files changed, 11 insertions(+), 28 deletions(-)