Skip to contentSkip to conversation

Support persistent /var/log

PATCH In review Chen Qi 3 participants 10 messages Mar 24, 2015 – May 28, 2015

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover Support persistent /var/log

The following changes since commit d3fcfe346b3472170641d9194243c4bbe06b8585:

systemd: fix firmware path to match linux-firmware (2015-03-23 11:27:13 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib ChenQi/persistent-var-log
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/persistent-var-log

Chen Qi (4):
bitbake.conf: add VOLATILE_LOG_DIR variable
base-files: respect VOLATILE_LOG_DIR
initscripts: support persistent /var/log
package.bbclass: support persistent /var/log

 meta/classes/package.bbclass                       |  2 +-
 meta/conf/bitbake.conf                             |  4 ++
 meta/files/fs-perms-persistent-log.txt             | 66 ++++++++++++++++++++++
 meta/recipes-core/base-files/base-files_3.0.14.bb  |  4 +-
 .../initscripts/initscripts-1.0/volatiles          |  1 -
 meta/recipes-core/initscripts/initscripts_1.0.bb   |  3 +
 6 files changed, 76 insertions(+), 4 deletions(-)
 create mode 100644 meta/files/fs-perms-persistent-log.txt
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/4 bitbake.conf: add VOLATILE_LOG_DIR variable

The default value is "log" which results in the same /var/log to be a link pointing to /var/volatile/log.

The user could override this value to "" which causes /var/log to be a directory on persistent storage.

[YOCTO #6132]

---
 meta/conf/bitbake.conf | 4 ++++
 1 file changed, 4 insertions(+)
meta/conf/bitbake.conf +4 -0
index f3586da..19b904c 100644
@@ -77,6 +77,10 @@ USRBINPATH_class-nativesdk = "/usr/bin"
 # Root home directory
 ROOT_HOME ??= "/home/root"
 
+# Volatile log direcotry
+# If it's set to "", then the log directory on the final image is on persistent storage.
+VOLATILE_LOG_DIR ?= "log"
+
 ##################################################################
 # Architecture-dependent build variables.
 ##################################################################
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/4 base-files: respect VOLATILE_LOG_DIR

In reply to Chen Qi

Respect VOLATILE_LOG_DIR variable. In this way, if the user overrides this variable to be "", /var/log on the final image would reside on persistent storage.

[YOCTO #6132]

---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +2 -2
index f2d254e..f519bb2 100644
@@ -42,7 +42,7 @@ dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
            ${localstatedir}/backups ${localstatedir}/lib \
            /sys ${localstatedir}/lib/misc ${localstatedir}/spool \
            ${localstatedir}/volatile \
-           ${localstatedir}/volatile/log \
+           ${localstatedir}/${@['', 'volatile/'][d.getVar('VOLATILE_LOG_DIR', True) == "log"]}log \
            /home ${prefix}/src ${localstatedir}/local \
            /media"
 
@@ -53,7 +53,7 @@ dirs755-lsb = "/srv  \
                ${prefix}/lib/locale"
 dirs2775-lsb = "/var/mail"
 
-volatiles = "log tmp"
+volatiles = "tmp ${VOLATILE_LOG_DIR}"
 conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
              ${sysconfdir}/inputrc ${sysconfdir}/issue /${sysconfdir}/issue.net \
              ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 3/4 initscripts: support persistent /var/log

In reply to Chen Qi

Respect VOLATILE_VAR_LOG variable so that if it's set to "", we could have persistent /var/log on the final image.

[YOCTO #6132]

---
 meta/recipes-core/initscripts/initscripts-1.0/volatiles | 1 -
 meta/recipes-core/initscripts/initscripts_1.0.bb        | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/volatiles +0 -1
index 297245d..6cccab7 100644
@@ -25,7 +25,6 @@ d root root 1777 /run/lock none
 d root root 0755 /var/volatile/log none
 d root root 1777 /var/volatile/tmp none
 l root root 1777 /var/lock /run/lock
-l root root 0755 /var/log /var/volatile/log
 l root root 0755 /var/run /run
 l root root 1777 /var/tmp /var/volatile/tmp
 l root root 1777 /tmp /var/tmp
meta/recipes-core/initscripts/initscripts_1.0.bb +3 -0
index dfb75b2..14f4167 100644
@@ -98,6 +98,9 @@ do_install () {
 	install -m 0755    ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/save-rtc.sh	${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/volatiles		${D}${sysconfdir}/default/volatiles/00_core
+	if [ "${VOLATILE_LOG_DIR}" = "log" ]; then
+		echo "l root root 0755 /var/log /var/volatile/log" >> ${D}${sysconfdir}/default/volatiles/00_core
+	fi
 	install -m 0755    ${WORKDIR}/dmesg.sh		${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
 
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/4 package.bbclass: support persistent /var/log

In reply to Chen Qi

Add a new file, fs-perms-persistent-log.txt, which treats /var/log as a directory instead of a link.
Modify package.bbclass to use this file if VOLATILE_LOG_DIR is set to "".

[YOCTO #6132]

---
 meta/classes/package.bbclass           |  2 +-
 meta/files/fs-perms-persistent-log.txt | 66 ++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 meta/files/fs-perms-persistent-log.txt
meta/classes/package.bbclass +1 -1
index 9f64ed7..63a70b7 100644
@@ -699,7 +699,7 @@ python fixup_perms () {
         bbpath = d.getVar('BBPATH', True)
         fs_perms_tables = d.getVar('FILESYSTEM_PERMS_TABLES', True)
         if not fs_perms_tables:
-            fs_perms_tables = 'files/fs-perms.txt'
+            fs_perms_tables = ['files/fs-perms-persistent-log.txt', 'files/fs-perms.txt'][d.getVar('VOLATILE_LOG_DIR', True) == 'log']
         for conf_file in fs_perms_tables.split():
             str += " %s" % bb.utils.which(bbpath, conf_file)
         return str
meta/files/fs-perms-persistent-log.txt new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#5 lore raw
In reply to Chen Qi

ping

Any comment on this one?

//Chen Qi

Quoted 24 lines · Chen Qi

The following changes since commit d3fcfe346b3472170641d9194243c4bbe06b8585:

systemd: fix firmware path to match linux-firmware (2015-03-23 11:27:13 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib ChenQi/persistent-var-log
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/persistent-var-log

Chen Qi (4):
bitbake.conf: add VOLATILE_LOG_DIR variable
base-files: respect VOLATILE_LOG_DIR
initscripts: support persistent /var/log
package.bbclass: support persistent /var/log

  meta/classes/package.bbclass                       |  2 +-
  meta/conf/bitbake.conf                             |  4 ++
  meta/files/fs-perms-persistent-log.txt             | 66 ++++++++++++++++++++++
  meta/recipes-core/base-files/base-files_3.0.14.bb  |  4 +-
  .../initscripts/initscripts-1.0/volatiles          |  1 -
  meta/recipes-core/initscripts/initscripts_1.0.bb   |  3 +
  6 files changed, 76 insertions(+), 4 deletions(-)

create mode 100644 meta/files/fs-perms-persistent-log.txt

author
#6 lore raw
In reply to Chen Qi

ping ....

*ANY* comment would be welcome, really ...

Thanks,
Chen Qi

Quoted 24 lines · Chen Qi

The following changes since commit d3fcfe346b3472170641d9194243c4bbe06b8585:

systemd: fix firmware path to match linux-firmware (2015-03-23 11:27:13 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib ChenQi/persistent-var-log
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/persistent-var-log

Chen Qi (4):
bitbake.conf: add VOLATILE_LOG_DIR variable
base-files: respect VOLATILE_LOG_DIR
initscripts: support persistent /var/log
package.bbclass: support persistent /var/log

  meta/classes/package.bbclass                       |  2 +-
  meta/conf/bitbake.conf                             |  4 ++
  meta/files/fs-perms-persistent-log.txt             | 66 ++++++++++++++++++++++
  meta/recipes-core/base-files/base-files_3.0.14.bb  |  4 +-
  .../initscripts/initscripts-1.0/volatiles          |  1 -
  meta/recipes-core/initscripts/initscripts_1.0.bb   |  3 +
  6 files changed, 76 insertions(+), 4 deletions(-)

create mode 100644 meta/files/fs-perms-persistent-log.txt

#7 lore raw

Randy, Khem, Otavio - this area was the subject of a discussion involving you around the 1.8 release, if you could review this set and comment that would be great.

Thanks,
Paul

Quoted 9 lines · On Tuesday 26 May 2015 13:43:58 ChenQi wrote:

ping ....

*ANY* comment would be welcome, really ...

Thanks,
Chen Qi

Quoted 1 line · Chen Qi

The following changes since commit

d3fcfe346b3472170641d9194243c4bbe06b8585:

Quoted 22 lines
Quoted 22 lines

systemd: fix firmware path to match linux-firmware (2015-03-23 11:27:13 +0000)>
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib
ChenQi/persistent-var-log
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h
=ChenQi/persistent-var-log>
Chen Qi (4):
bitbake.conf: add VOLATILE_LOG_DIR variable
base-files: respect VOLATILE_LOG_DIR
initscripts: support persistent /var/log
package.bbclass: support persistent /var/log

  meta/classes/package.bbclass                       |  2 +-
  meta/conf/bitbake.conf                             |  4 ++
  meta/files/fs-perms-persistent-log.txt             | 66
  ++++++++++++++++++++++
  meta/recipes-core/base-files/base-files_3.0.14.bb  |  4 +-
  .../initscripts/initscripts-1.0/volatiles          |  1 -
  meta/recipes-core/initscripts/initscripts_1.0.bb   |  3 +
  6 files changed, 76 insertions(+), 4 deletions(-)

create mode 100644 meta/files/fs-perms-persistent-log.txt

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#8 lore raw
Quoted 3 lines · Paul Eggleton

Randy, Khem, Otavio - this area was the subject of a discussion involving you around the 1.8 release, if you could review this set and comment that would be great.

Looked at it but it didnt sound like it considered read only rootfs case at all.

Quoted 42 lines

Thanks,
Paul

Quoted 9 lines · On Tuesday 26 May 2015 13:43:58 ChenQi wrote:

ping ....

*ANY* comment would be welcome, really ...

Thanks,
Chen Qi

Quoted 1 line · Chen Qi

The following changes since commit

d3fcfe346b3472170641d9194243c4bbe06b8585:

Quoted 13 lines
Quoted 13 lines

systemd: fix firmware path to match linux-firmware (2015-03-23 11:27:13 +0000)>
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib
ChenQi/persistent-var-log
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h
=ChenQi/persistent-var-log>
Chen Qi (4):
bitbake.conf: add VOLATILE_LOG_DIR variable
base-files: respect VOLATILE_LOG_DIR
initscripts: support persistent /var/log
package.bbclass: support persistent /var/log

Quoted 9 lines
Quoted 9 lines
  meta/classes/package.bbclass                       |  2 +-
  meta/conf/bitbake.conf                             |  4 ++
  meta/files/fs-perms-persistent-log.txt             | 66
  ++++++++++++++++++++++
  meta/recipes-core/base-files/base-files_3.0.14.bb  |  4 +-
  .../initscripts/initscripts-1.0/volatiles          |  1 -
  meta/recipes-core/initscripts/initscripts_1.0.bb   |  3 +
  6 files changed, 76 insertions(+), 4 deletions(-)

create mode 100644 meta/files/fs-perms-persistent-log.txt

--

Paul Eggleton
Intel Open Source Technology Centre

author
#9 lore raw
Quoted 7 lines · Khem Raj
Quoted 3 lines · Paul Eggleton

Randy, Khem, Otavio - this area was the subject of a discussion involving you around the 1.8 release, if you could review this set and comment that would be great.

Looked at it but it didnt sound like it considered read only rootfs case at all.

read-only rootfs and persistent /var/log are all custom configurations.
If a user wants a read-only rootfs but a persistent /var/log, he'll need to do more custom configurations like putting /var/ on a seperate partition or something else.

The purpose of this patch is to provide an easy way to user to keep their logs between reboots.

//Chen Qi

Quoted 41 lines
Quoted 40 lines

Thanks,
Paul

Quoted 9 lines · On Tuesday 26 May 2015 13:43:58 ChenQi wrote:

ping ....

*ANY* comment would be welcome, really ...

Thanks,
Chen Qi

Quoted 1 line · Chen Qi

The following changes since commit

d3fcfe346b3472170641d9194243c4bbe06b8585:

Quoted 13 lines
Quoted 13 lines
    systemd: fix firmware path to match linux-firmware (2015-03-23 11:27:13
    +0000)>

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib
ChenQi/persistent-var-log
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h
=ChenQi/persistent-var-log>
Chen Qi (4):
bitbake.conf: add VOLATILE_LOG_DIR variable
base-files: respect VOLATILE_LOG_DIR
initscripts: support persistent /var/log
package.bbclass: support persistent /var/log

Quoted 9 lines
Quoted 9 lines
   meta/classes/package.bbclass                       |  2 +-
   meta/conf/bitbake.conf                             |  4 ++
   meta/files/fs-perms-persistent-log.txt             | 66
   ++++++++++++++++++++++
   meta/recipes-core/base-files/base-files_3.0.14.bb  |  4 +-
   .../initscripts/initscripts-1.0/volatiles          |  1 -
   meta/recipes-core/initscripts/initscripts_1.0.bb   |  3 +
   6 files changed, 76 insertions(+), 4 deletions(-)

create mode 100644 meta/files/fs-perms-persistent-log.txt

--

Paul Eggleton
Intel Open Source Technology Centre