]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
systemd: Mitigate /var/log type mismatch issue
authorNiko Mauno <niko.mauno@vaisala.com>
Tue, 9 Jul 2024 12:22:11 +0000 (12:22 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 16 Jul 2024 10:56:47 +0000 (11:56 +0100)
When VOLATILE_LOG_DIR evaluates as True, the base-files recipe provides
/var/log -> /var/volatile/log symlink which is in conflict with systemd
upstream tmpfiles.d/var.conf.in which defines it as a directory.

This generates following error in journal:

  Jul 03 14:28:00 qemux86-64 systemd-tmpfiles[165]: "/var/log" already exists and is not a directory.

Mitigate the issue by defining /var/log as symlink corresponding to
the one created by base-files, when appropriate.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd_256.bb

index 9bd59ef39fd4963b196985002a4dede33b7a12ac..3579c718914203453b3f9c699249ec9dd2c95bd4 100644 (file)
@@ -314,9 +314,10 @@ do_install() {
        fi
 
        if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then
-               # /var/log is typically a symbolic link to inside /var/volatile,
-               # which is expected to be empty.
+               # base-files recipe provides /var/log which is a symlink to /var/volatile/log
                rm -rf ${D}${localstatedir}/log
+               printf 'L\t\t%s/log\t\t-\t-\t-\t-\t%s/volatile/log\n' "${localstatedir}" \
+                       "${localstatedir}" >>${D}${nonarch_libdir}/tmpfiles.d/00-create-volatile.conf
        elif [ -e ${D}${localstatedir}/log/journal ]; then
                chown root:systemd-journal ${D}${localstatedir}/log/journal