Skip to contentSkip to conversation

systemd: Instruct the journal to always be volatile

PATCH In review Randy Witt 4 participants 8 messages Mar 11, 2015 – Mar 12, 2015

lore
Share & tools
lore

Randy Witt

author
#0 lore raw

PATCH 1/1 systemd: Instruct the journal to always be volatile

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal should always be volatile and never try to write to "persistent"
storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

[Yocto #7388]

---
 meta/recipes-core/systemd/systemd/journald-volatile.conf | 6 ------
 meta/recipes-core/systemd/systemd_219.bb                 | 4 ++--
 2 files changed, 2 insertions(+), 8 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd/journald-volatile.conf
meta/recipes-core/systemd/systemd/journald-volatile.conf deleted +0 -6
deleted file mode 100644
index b11e160..0000000
@@ -1,6 +0,0 @@
-# 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
meta/recipes-core/systemd/systemd_219.bb +2 -2
index d5eed08..f3bb0c4 100644
@@ -48,7 +48,6 @@ 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"
@@ -145,7 +144,6 @@ 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
@@ -170,6 +168,8 @@ do_install() {
 
 	# Enable journal to forward message to syslog daemon
 	sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
+	# Make the journal volatile by default.
+	sed -i -e 's/.*Storage.*/Storage=volatile/' ${D}${sysconfdir}/systemd/journald.conf
 	# its needed in 216 upstream has fixed it with 919699ec301ea507edce4a619141ed22e789ac0d
 	# don't order journal flushing afte remote-fs.target
 	sed -i -e 's/ remote-fs.target$//' ${D}${systemd_unitdir}/system/systemd-journal-flush.service
Signature · 1 line
1.9.3
#1 lore raw
Quoted 14 lines · Randy Witt

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal should always be volatile and never try to write to "persistent"
storage. The journal will exist in /run/log/journal only.

Quoted 5 lines

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

[Yocto #7388]

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

Quoted 57 lines

---
meta/recipes-core/systemd/systemd/journald-volatile.conf | 6 ------
meta/recipes-core/systemd/systemd_219.bb | 4 ++--

2 files changed, 2 insertions(+), 8 deletions(-)

delete mode 100644 meta/recipes-core/systemd/systemd/journald-volatile.conf

meta/recipes-core/systemd/systemd/journald-volatile.conf deleted +0 -6
deleted file mode 100644
index b11e160..0000000
@@ -1,6 +0,0 @@
-# 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
meta/recipes-core/systemd/systemd_219.bb +0 -1
index d5eed08..f3bb0c4 100644
@@ -48,7 +48,6 @@ 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"

meta/recipes-core/systemd/systemd_219.bb +2 -1
@@ -145,7 +144,6 @@ 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
@@ -170,6 +168,8 @@ do_install() {
 
 	# Enable journal to forward message to syslog daemon
 	sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
+	# Make the journal volatile by default.
+	sed -i -e 's/.*Storage.*/Storage=volatile/' ${D}${sysconfdir}/systemd/journald.conf
 	# its needed in 216 upstream has fixed it with 919699ec301ea507edce4a619141ed22e789ac0d
 	# don't order journal flushing afte remote-fs.target
 	sed -i -e 's/ remote-fs.target$//' ${D}${systemd_unitdir}/system/systemd-journal-flush.service
Signature · 7 lines
1.9.3

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#2 lore raw
Quoted 21 lines
Quoted 21 lines

On Mar 11, 2015, at 2:28 PM, Randy Witt <[email protected]> wrote:

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal
should always be volatile and never try to write to "persistent" storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

Quoted 7 lines
Quoted 1 line

[Yocto #7388]

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

The distro could still change it with a bbappend or additional configuration files just like other settings. We don't have an option for a persistent journal so I'm curious, how would both cases work currently?

Currently if a persistent journal is desired, the /var/log symlink has to be changed to point to persistent storage, or /var/volatile has to be dropped from /etc/fstab. These are also configuration changes.

The lesser of the two evils seems to be making it so that the journal works in the volatile case, which is all we've ever supported in poky. If a user wanted a non-volatile journal it was left to them to do.

I agree that the journal should be persistent, but I also agree with Richard that seems to be too big of a change in behavior when we're so close to the release point.

Quoted 72 lines
Quoted 70 lines

---
meta/recipes-core/systemd/systemd/journald-volatile.conf | 6 ------
meta/recipes-core/systemd/systemd_219.bb | 4 ++--

2 files changed, 2 insertions(+), 8 deletions(-)

delete mode 100644 meta/recipes-core/systemd/systemd/journald-volatile.conf

meta/recipes-core/systemd/systemd/journald-volatile.conf deleted +0 -3
deleted file mode 100644
index b11e160..0000000
@@ -1,6 +0,0 @@
-# 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

meta/recipes-core/systemd/systemd/journald-volatile.conf deleted +0 -3
-# happens, the journal will appear empty until restarted.
-[Unit]
-After=var-volatile.mount
meta/recipes-core/systemd/systemd_219.bb +0 -0
index d5eed08..f3bb0c4 100644
@@ -48,7 +48,6 @@ 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"

meta/recipes-core/systemd/systemd_219.bb +0 -0
@@ -145,7 +144,6 @@ do_install() {
 	install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
 
 	install -m 0644 ${WORKDIR}/00-create-volatile.conf

${D}${sysconfdir}/tmpfiles.d/

meta/recipes-core/systemd/systemd_219.bb +0 -1
-	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
meta/recipes-core/systemd/systemd_219.bb +0 -0
@@ -170,6 +168,8 @@ do_install() {
 
 	# Enable journal to forward message to syslog daemon
 	sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/'

${D}${sysconfdir}/systemd/journald.conf

meta/recipes-core/systemd/systemd_219.bb +2 -0
+	# Make the journal volatile by default.
+	sed -i -e 's/.*Storage.*/Storage=volatile/'

${D}${sysconfdir}/systemd/journald.conf

	# its needed in 216 upstream has fixed it with
919699ec301ea507edce4a619141ed22e789ac0d
	# don't order journal flushing afte remote-fs.target
	sed -i -e 's/ remote-fs.target$//'
${D}${systemd_unitdir}/system/systemd-journal-flush.service
--
1.9.3

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 24 lines · On Wed, Mar 11, 2015 at 9:18 PM, <[email protected]> wrote:
Quoted 24 lines
Quoted 22 lines

On Mar 11, 2015, at 2:28 PM, Randy Witt <[email protected]> wrote:

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal
should always be volatile and never try to write to "persistent" storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

[Yocto #7388]

Quoted 8 lines
Quoted 4 lines

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

The distro could still change it with a bbappend or additional configuration files just like other settings. We don't have an option for a persistent journal so I'm curious, how would both cases work currently?

No they dont and I have posted a patch which potentially should.

Quoted 7 lines

Currently if a persistent journal is desired, the /var/log symlink has to be changed to point to persistent storage, or /var/volatile has to be dropped from /etc/fstab. These are also configuration changes.

The lesser of the two evils seems to be making it so that the journal works in the volatile case, which is all we've ever supported in poky. If a user wanted a non-volatile journal it was left to them to do.

poky is not only the distro thats fed with OE-Core there are several open ones and several
which are maintained by companies

Quoted 4 lines

I agree that the journal should be persistent, but I also agree with Richard that seems to be too big of a change in behavior when we're so close to the release point.

what makes you think the change you posted is not intrusive, we have a regression compared to last release,
this patch does not fix the regression, it infact pacifies some errors which are new and creates yet another behavior. think of people who will be migrating from 1.7 to 1.8 problems should be solved in best possible way.
I am fine with whatever is accepted solution. I have no interest in push one or the other
I do have a solution which fixes my problems therefore I am less concerned. Carrying a couple of local reverts it not a big of a deal.

-Khem

#4 lore raw
In reply to Khem Raj
Quoted 18 lines · Khem Raj
Quoted 18 lines · Randy Witt

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal should always be volatile and never try to write to "persistent"
storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

Quoted 5 lines
Quoted 1 line

[Yocto #7388]

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

Agreed.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#5 lore raw
Quoted 19 lines · Otavio Salvador
Quoted 18 lines · Khem Raj
Quoted 18 lines · Randy Witt

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal should always be volatile and never try to write to "persistent"
storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

[Yocto #7388]

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

Agreed.

This isn't quite so simple as "agreed". Are we saying that we want to rework volatiles handling after feature freeze?

My view on this is that yes, we do need to do something about it, but right now during stabilisation is not the right time. Particularly when the patches proposed aren't even tested with sysvinit.

So I'm interested in patches which make things work better without making fundamental changes now. We can look at changing volatiles with a properly thought out plan in the next development cycle.

Making the systemd configuration match the rest of the default system setup would seem to be sensible. We should make it possible for others to override that if their setup isn't volatile.

Cheers,

Richard

#6 lore raw
Quoted 35 lines · Richard Purdie
Quoted 19 lines · Otavio Salvador
Quoted 18 lines · Khem Raj
Quoted 18 lines · Randy Witt

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal should always be volatile and never try to write to "persistent"
storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

[Yocto #7388]

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

Agreed.

This isn't quite so simple as "agreed". Are we saying that we want to rework volatiles handling after feature freeze?

My view on this is that yes, we do need to do something about it, but right now during stabilisation is not the right time. Particularly when the patches proposed aren't even tested with sysvinit.

Quoted 7 lines

So I'm interested in patches which make things work better without making fundamental changes now. We can look at changing volatiles with a properly thought out plan in the next development cycle.

Making the systemd configuration match the rest of the default system setup would seem to be sensible. We should make it possible for others to override that if their setup isn't volatile.

I am saying we should then test the patch (from Khem) and see if it is valid for merge. Khem being quite active contributor I am sure will be willing to help to fix any issue for merging (and regression, if any). I think having the volatile support working is very important and as we are not releasing tomorrow ...

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#7 lore raw
In reply to Richard Purdie
Quoted 31 lines · Richard Purdie
Quoted 19 lines · Otavio Salvador
Quoted 18 lines · Khem Raj
Quoted 18 lines · Randy Witt

When the storage mode for the journal is "auto" if /var/log/journal exists then the journal will flush to /var/log/journal assuming that /var/log/journal is persistent.

However /var/log -> /var/volatile/log in poky, so even though /var/log/journal exists, it is still volatile.

Since this can cause ordering issues due to /var/volatile needing to be mounted before the journal actually writes to it, just specify that the journal should always be volatile and never try to write to "persistent"
storage. The journal will exist in /run/log/journal only.

This also disables the "After" of the journal on var-volatile.mount since the ordering is no longer necessary when the journal is only stored in /run/log/journal.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

[Yocto #7388]

This is not right. What if I want persistent logs.? the options is just gone. Both cases should work. /var/volatile should only be used when doing ro-rfs its not FHS specified anyway. Lets not go with this patch.

Agreed.

Quoted 7 lines

This isn't quite so simple as "agreed". Are we saying that we want to rework volatiles handling after feature freeze?

My view on this is that yes, we do need to do something about it, but right now during stabilisation is not the right time. Particularly when the patches proposed aren't even tested with sysvinit.

I usually send out patches early to take advantage of some community testing especially Yocto auto builders, Since not everyone has hefty machines to do all kind of builds for such changes. Meanwhile, keep doing it in serial order.

Quoted 4 lines

So I'm interested in patches which make things work better without making fundamental changes now. We can look at changing volatiles with a properly thought out plan in the next development cycle.

Whatever is decided I have already said thats fine, so lets just stop this thread here.