diff options
author | Mark Asselstine <mark.asselstine@windriver.com> | 2017-01-03 12:01:58 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-16 18:05:12 +0000 |
commit | e30f00bca5f61e9693d59e763a3dce633d76f00b (patch) | |
tree | 3f2ae58878e5f238406f080e98c45984d0d3e7e5 /meta/recipes-extended/sysklogd | |
parent | 5ff8fdd3d676670412e9d504abbe34a635991583 (diff) | |
download | poky-e30f00bca5f61e9693d59e763a3dce633d76f00b.tar.gz |
sysklogd: do more to properly work with systemd
It was noticed that syslogd and klogd were no longer running on system
startup, meaning no /var/log/messages etc.. It appears as though
sysklogd has never been updated to follow the expected logging
requirement for systemd as described here:
https://www.freedesktop.org/wiki/Software/systemd/syslog/
As such no service was started and no logging present. Using the above
guidelines we create two new service files syslogd.service and
klogd.service. We make use of tmpfiles.d in order to ensure the
xconsole device node exists and do other minor recipe cleanup to
ensure peaceful coexistence with sysvinit and systemd implementations.
The systemd documentation also asks that for a logger which is not
rsyslog that we also enable 'ForwardToSyslog=' in journald.conf, but
this is already the case so no action is required.
With this change in place syslogd and klogd are started at system
startup and the expected logs are available.
Unfortunately I was not able to find any work done on this upstream or
in other distros so this is my best effort at making this work.
(From OE-Core rev: 914e08cf627e54e5019eda2154663c30b9a68ded)
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/sysklogd')
4 files changed, 47 insertions, 2 deletions
diff --git a/meta/recipes-extended/sysklogd/files/klogd.service b/meta/recipes-extended/sysklogd/files/klogd.service new file mode 100644 index 0000000000..0c888c497d --- /dev/null +++ b/meta/recipes-extended/sysklogd/files/klogd.service | |||
@@ -0,0 +1,13 @@ | |||
1 | [Unit] | ||
2 | Description=Kernel Logging Service | ||
3 | After=syslogd.service | ||
4 | |||
5 | [Service] | ||
6 | Type=forking | ||
7 | ExecStart=/sbin/klogd | ||
8 | PIDFile=/var/run/klogd.pid | ||
9 | StandardOutput=null | ||
10 | Restart=on-failure | ||
11 | |||
12 | [Install] | ||
13 | WantedBy=multi-user.target | ||
diff --git a/meta/recipes-extended/sysklogd/files/syslogd.service b/meta/recipes-extended/sysklogd/files/syslogd.service new file mode 100644 index 0000000000..eeaff3d38d --- /dev/null +++ b/meta/recipes-extended/sysklogd/files/syslogd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=System Logging Service | ||
3 | Requires=syslog.socket | ||
4 | |||
5 | [Service] | ||
6 | Type=forking | ||
7 | ExecStart=/sbin/syslogd | ||
8 | PIDFile=/var/run/syslogd.pid | ||
9 | StandardOutput=null | ||
10 | Restart=on-failure | ||
11 | |||
12 | [Install] | ||
13 | WantedBy=multi-user.target | ||
14 | Alias=syslog.service | ||
diff --git a/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf b/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf new file mode 100644 index 0000000000..f4aecd385b --- /dev/null +++ b/meta/recipes-extended/sysklogd/files/tmpfiles.sysklogd.conf | |||
@@ -0,0 +1 @@ | |||
p /dev/xconsole 0640 root adm | |||
diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc index 5c15ffe8ab..f9af0a4833 100644 --- a/meta/recipes-extended/sysklogd/sysklogd.inc +++ b/meta/recipes-extended/sysklogd/sysklogd.inc | |||
@@ -11,17 +11,24 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \ | |||
11 | file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \ | 11 | file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \ |
12 | " | 12 | " |
13 | 13 | ||
14 | inherit update-rc.d update-alternatives | 14 | inherit update-rc.d update-alternatives systemd |
15 | 15 | ||
16 | SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \ | 16 | SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \ |
17 | file://no-strip-install.patch \ | 17 | file://no-strip-install.patch \ |
18 | file://0001-Fix-build-with-musl.patch \ | 18 | file://0001-Fix-build-with-musl.patch \ |
19 | file://sysklogd \ | 19 | file://sysklogd \ |
20 | file://syslog.conf \ | 20 | file://syslog.conf \ |
21 | file://syslogd.service \ | ||
22 | file://klogd.service \ | ||
23 | file://tmpfiles.sysklogd.conf \ | ||
21 | " | 24 | " |
22 | 25 | ||
23 | SRC_URI_append_e500v2 = " file://no-vectorization.patch" | 26 | SRC_URI_append_e500v2 = " file://no-vectorization.patch" |
24 | 27 | ||
28 | SYSTEMD_PACKAGES = "${PN}" | ||
29 | SYSTEMD_SERVICE_${PN} = "syslogd.service klogd.service" | ||
30 | SYSTEMD_AUTO_ENABLE = "enable" | ||
31 | |||
25 | INITSCRIPT_NAME = "syslog" | 32 | INITSCRIPT_NAME = "syslog" |
26 | CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${BPN}" | 33 | CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${BPN}" |
27 | 34 | ||
@@ -39,13 +46,23 @@ do_install () { | |||
39 | install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf | 46 | install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf |
40 | install -d ${D}${sysconfdir}/init.d | 47 | install -d ${D}${sysconfdir}/init.d |
41 | install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog | 48 | install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog |
49 | install -d ${D}${systemd_unitdir}/system | ||
50 | install -m 644 ${WORKDIR}/syslogd.service ${D}${systemd_unitdir}/system | ||
51 | install -m 644 ${WORKDIR}/klogd.service ${D}${systemd_unitdir}/system | ||
52 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true', 'false', d)}; then | ||
53 | install -d ${D}${exec_prefix}/lib/tmpfiles.d | ||
54 | install -m 644 ${WORKDIR}/tmpfiles.sysklogd.conf ${D}${exec_prefix}/lib/tmpfiles.d/sysklogd.conf | ||
55 | fi | ||
42 | } | 56 | } |
43 | 57 | ||
58 | FILES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES','systemd','${exec_prefix}/lib/tmpfiles.d/sysklogd.conf', '', d)}" | ||
59 | |||
44 | # sysklogd package has no internal systemd support, so we weigh busybox's | 60 | # sysklogd package has no internal systemd support, so we weigh busybox's |
45 | # sysklogd utility over it in case of systemd | 61 | # sysklogd utility over it in case of systemd |
46 | ALTERNATIVE_PRIORITY = "${@bb.utils.contains('DISTRO_FEATURES','systemd','10','100',d)}" | 62 | ALTERNATIVE_PRIORITY = "${@bb.utils.contains('DISTRO_FEATURES','systemd','10','100',d)}" |
47 | 63 | ||
48 | ALTERNATIVE_${PN} = "syslogd klogd syslog-init syslog-conf" | 64 | ALTERNATIVE_${PN} = "syslogd klogd syslog-conf \ |
65 | ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','syslog-init','',d)}" | ||
49 | 66 | ||
50 | ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd" | 67 | ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd" |
51 | ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd" | 68 | ALTERNATIVE_LINK_NAME[klogd] = "${base_sbindir}/klogd" |