]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd: Fix the problem of an empty journal on boot
authorRandy Witt <randy.e.witt@linux.intel.com>
Fri, 6 Mar 2015 02:11:46 +0000 (18:11 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 9 Mar 2015 16:05:08 +0000 (16:05 +0000)
systemd by default tries to write the journal to /var/log/journal.
But base-files has a symlink /var/log -> /var/volatile/log. And
/var/volatile is a tmpfs mount in /etc/fstab.

If the journal service started before /var/volatile was mounted (which
was the typical scenario) then the journal would appear empty since
the old location was mounted over.

This change fixes the problem by ensuring that the journal doesn't start
until after the mount happens.

[Yocto #7388]

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/systemd/systemd/journald-volatile.conf [new file with mode: 0644]
meta/recipes-core/systemd/systemd_219.bb

diff --git a/meta/recipes-core/systemd/systemd/journald-volatile.conf b/meta/recipes-core/systemd/systemd/journald-volatile.conf
new file mode 100644 (file)
index 0000000..b11e160
--- /dev/null
@@ -0,0 +1,6 @@
+# If /var/volatile is a mount point then make sure to mount it before
+# the journal starts. This is because base-files creates a symlink
+# /var/log -> /var/volatile/log. And if the journal starts before the mount
+# happens, the journal will appear empty until restarted.
+[Unit]
+After=var-volatile.mount
index 5f58f409f4fa381e11a4d3918f187f1077e7595d..d5eed08f1f8e8458991bbb0187a3e090c37102b0 100644 (file)
@@ -48,6 +48,7 @@ SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=
            file://00-create-volatile.conf \
            file://init \
            file://run-ptest \
+           file://journald-volatile.conf \
           "
 
 S = "${WORKDIR}/git"
@@ -144,6 +145,7 @@ do_install() {
        install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
 
        install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+       install -D -m 0644 ${WORKDIR}/journald-volatile.conf ${D}${systemd_unitdir}/system/systemd-journald.service.d/journald-volatile.conf
 
        if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
                install -d ${D}${sysconfdir}/init.d