Skip to contentSkip to conversation

bitbake.conf: support persistent /var/tmp

PATCH Changqing Li 2 participants 5 messages Aug 30, 2021 – May 9, 2022 2 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

ping

Quoted 204 lines · Changqing Li

From: Changqing Li <[email protected]>

Steps:
1. build out rootfs core-image-minimal-qemux86-64.tar.bz2
2. docker import core-image-minimal-qemux86-64.tar.bz2 poky:latest
3. docker run -it --rm poky:latest /bin/sh
4.
/var # ls -al

drwxr-xr-x    8 root     root          4096 Mar  9  2018 .
drwxr-xr-x    1 root     root          4096 Aug  5 06:59 ..
drwxr-xr-x    2 root     root          4096 Mar  9  2018 backups
drwxr-xr-x    2 root     root          4096 Mar  9  2018 cache
drwxr-xr-x    5 root     root          4096 Mar  9  2018 lib
drwxr-xr-x    2 root     root          4096 Mar  9  2018 local
lrwxrwxrwx    1 root     root            11 Mar  9  2018 lock -> ../run/lock
lrwxrwxrwx    1 root     root            12 Mar  9  2018 log -> volatile/log
lrwxrwxrwx    1 root     root             6 Mar  9  2018 run -> ../run
drwxr-xr-x    3 root     root          4096 Mar  9  2018 spool
lrwxrwxrwx    1 root     root            12 Mar  9  2018 tmp -> volatile/tmp
drwxr-xr-x    2 root     root          4096 Mar  9  2018 volatile

/var # cd log
/bin/sh: cd: can't cd to log: No such file or directory /var # cd tmp
/bin/sh: cd: can't cd to tmp: No such file or directory /var # cd volatile/
/var/volatile # ls -al

drwxr-xr-x    2 root     root          4096 Mar  9  2018 .
drwxr-xr-x    8 root     root          4096 Mar  9  2018 ..

In step3, because we don't launch container with init system, volatile/tmp is not created during startup, and the dad link will cause error. Supporting persistent /var/tmp can resolve this problem.

To support persistent /var/tmp, rename VOLATILE_LOG_DIR to VOLATILE_DIR

Don't use VOLATILE_LOG_DIR/VOLATILE_TMP_DIR
to control it separately since it will make things complicated, we need to make kinds of fs-perms*.txt for kinds of combination of the two variables.

---
  meta/conf/bitbake.conf                                 | 10 ++++++----
  ...erms-persistent-log.txt => fs-perms-persistent.txt} |  2 --
  meta/recipes-core/base-files/base-files_3.0.14.bb      |  7 ++++---
  .../recipes-core/initscripts/initscripts-1.0/volatiles |  3 ---
  meta/recipes-core/initscripts/initscripts_1.0.bb       |  7 +++++--
  meta/recipes-core/systemd/systemd_249.1.bb             |  5 +++--
  meta/recipes-core/udev/eudev_3.2.10.bb                 |  3 +++
  7 files changed, 21 insertions(+), 16 deletions(-)

rename meta/files/{fs-perms-persistent-log.txt => fs-perms-persistent.txt} (95%)

meta/conf/bitbake.conf +6 -4
index 821dae2ba6..e93c0b7893 100644
@@ -86,9 +86,11 @@ USRBINPATH_class-nativesdk = "/usr/bin"
  # Root home directory
  ROOT_HOME ??= "/home/root"
 
-# If set to boolean true ('yes', 'y', 'true', 't', '1'), /var/log links to /var/volatile/log.
-# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log is on persistent storage.
-VOLATILE_LOG_DIR ?= "yes"
+# If set to boolean true ('yes', 'y', 'true', 't', '1'), /var/log links to
+# /var/volatile/log, /var/tmp links to /var/volatile/tmp
+# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log and /var/tmp
+# is on persistent storage.
+VOLATILE_DIR ?= "yes"
 
  ##################################################################
  # Architecture-dependent build variables.
@@ -349,7 +351,7 @@ FILESEXTRAPATHS ?= "__default:"
  #  datadir, sysconfdir, servicedir, sharedstatedir, localstatedir, infodir,
  #  mandir, docdir, bindir, sbindir, libexecdir, libdir, includedir and
  #  oldincludedir
-FILESYSTEM_PERMS_TABLES ?= "${@'files/fs-perms.txt' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'files/fs-perms-persistent-log.txt'}"
+FILESYSTEM_PERMS_TABLES ?= "${@'files/fs-perms.txt' if oe.types.boolean(d.getVar('VOLATILE_DIR')) else 'files/fs-perms-persistent.txt'}"
 
  ##################################################################
  # General work and output directories for the build system.
meta/files/fs-perms-persistent.txt renamed from meta/files/fs-perms-persistent-log.txt +0 -2
similarity index 95%
rename from meta/files/fs-perms-persistent-log.txt
rename to meta/files/fs-perms-persistent.txt
index 518c1be3c9..326c0ed092 100644
@@ -47,7 +47,6 @@ ${oldincludedir}	0755	root	root	true	0644	root	root
  # Links
  ${localstatedir}/run	link	/run
  ${localstatedir}/lock	link	/run/lock
-${localstatedir}/tmp	link	volatile/tmp
 
  /home				0755	root	root	false - - -
  /srv				0755	root	root	false - - -
@@ -57,7 +56,6 @@ ${localstatedir}/local		0755	root	root	false - - -
  # Special permissions from base-files
  # Set 1777
  /tmp				01777	root	root	false - - -
-${localstatedir}/volatile/tmp	01777	root	root	false - - -
 
  # Set 0700
  ${ROOT_HOME}			0700	root	root	false - - -
meta/recipes-core/base-files/base-files_3.0.14.bb +4 -3
index 94299431f6..0e06629bbd 100644
@@ -29,7 +29,7 @@ S = "${WORKDIR}"
  INHIBIT_DEFAULT_DEPS = "1"
 
  docdir_append = "/${P}"
-dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
+dirs1777 = "/tmp ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_DIR}') else ''}tmp"
  dirs2775 = ""
  dirs555 = "/sys /proc"
  dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
@@ -42,7 +42,7 @@ dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
             ${localstatedir}/backups ${localstatedir}/lib \
             ${localstatedir}/lib/misc ${localstatedir}/spool \
             ${localstatedir}/volatile \
-           ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \
+           ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_DIR}') else ''}log \
             /home ${prefix}/src ${localstatedir}/local \
             /media"
 
@@ -53,7 +53,8 @@ dirs755-lsb = "/srv  \
                 ${prefix}/lib/locale"
  dirs2775-lsb = "/var/mail"
 
-volatiles = "${@'log' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''} tmp"
+volatiles = "${@'log' if oe.types.boolean('${VOLATILE_DIR}') else ''} \
+             ${@'tmp' if oe.types.boolean('${VOLATILE_DIR}') else ''}"
  conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
               ${sysconfdir}/issue /${sysconfdir}/issue.net \
               ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
meta/recipes-core/initscripts/initscripts-1.0/volatiles +0 -3
index cd8a4be05f..eeeb8905da 100644
@@ -24,11 +24,8 @@
  # a link will be created at /var/test pointing to /tmp/testfile and due to this
  # link the file defined as /var/test will actually be created as /tmp/testfile.
  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/run /run
-l root root 1777 /var/tmp /var/volatile/tmp
  l root root 1777 /tmp /var/tmp
  d root root 0755 /var/lock/subsys none
  f root root 0664 /var/log/wtmp none
meta/recipes-core/initscripts/initscripts_1.0.bb +5 -2
index 65f9c0ae8d..cc079024f4 100644
@@ -105,9 +105,12 @@ 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 [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
-		sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = True ]; then
+                sed -i -e '\@^# link the file@ a\d root root 0755 /var/volatile/log none\nd root root 1777 /var/volatile/tmp none\nl root root 0755 /var/tmp /var/volatile/tmp\nl root root 0755 /var/log /var/volatile/log' \
  			${D}${sysconfdir}/default/volatiles/00_core
+	else
+		sed -i -e 's;TMPROOT="${ROOT_DIR}/var/volatile/tmp";TMPROOT="${ROOT_DIR}/var/tmp";g' \
+			${D}${sysconfdir}/init.d/populate-volatile.sh
  	fi
  	install -m 0755    ${WORKDIR}/dmesg.sh		${D}${sysconfdir}/init.d
  	install -m 0644    ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
meta/recipes-core/systemd/systemd_249.1.bb +3 -2
index 9bfb12249c..0914b7e0b2 100644
@@ -251,8 +251,9 @@ do_install() {
  		install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
  	done
 
-	install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
-
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = True ]; then
+		install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+	fi
  	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
  		install -d ${D}${sysconfdir}/init.d
  		install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
meta/recipes-core/udev/eudev_3.2.10.bb +3 -0
index a5d2115f80..3761fd748e 100644
@@ -42,6 +42,9 @@ do_install_append() {
  	install -d ${D}${sysconfdir}/init.d
  	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
  	sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = False ]; then
+		sed -i -e 's%mkdir -m 1777 -p /var/volatile/tmp%mkdir -m 1777 -p /var/tmp%g' ${D}${sysconfdir}/init.d/udev
+	fi
 
  	install -d ${D}${sysconfdir}/udev/rules.d
  	install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
#3 lore raw
In reply to a message not in the archive

ping

Quoted 211 lines · Changqing Li

ping

Quoted 204 lines · Changqing Li

From: Changqing Li<[email protected]>

Steps:
1. build out rootfs core-image-minimal-qemux86-64.tar.bz2
2. docker import core-image-minimal-qemux86-64.tar.bz2 poky:latest
3. docker run -it --rm poky:latest /bin/sh
4.
/var # ls -al

drwxr-xr-x    8 root     root          4096 Mar  9  2018 .
drwxr-xr-x    1 root     root          4096 Aug  5 06:59 ..
drwxr-xr-x    2 root     root          4096 Mar  9  2018 backups
drwxr-xr-x    2 root     root          4096 Mar  9  2018 cache
drwxr-xr-x    5 root     root          4096 Mar  9  2018 lib
drwxr-xr-x    2 root     root          4096 Mar  9  2018 local
lrwxrwxrwx    1 root     root            11 Mar  9  2018 lock -> ../run/lock
lrwxrwxrwx    1 root     root            12 Mar  9  2018 log -> volatile/log
lrwxrwxrwx    1 root     root             6 Mar  9  2018 run -> ../run
drwxr-xr-x    3 root     root          4096 Mar  9  2018 spool
lrwxrwxrwx    1 root     root            12 Mar  9  2018 tmp -> volatile/tmp
drwxr-xr-x    2 root     root          4096 Mar  9  2018 volatile

/var # cd log
/bin/sh: cd: can't cd to log: No such file or directory /var # cd tmp
/bin/sh: cd: can't cd to tmp: No such file or directory /var # cd volatile/
/var/volatile # ls -al

drwxr-xr-x    2 root     root          4096 Mar  9  2018 .
drwxr-xr-x    8 root     root          4096 Mar  9  2018 ..

In step3, because we don't launch container with init system, volatile/tmp is not created during startup, and the dad link will cause error. Supporting persistent /var/tmp can resolve this problem.

To support persistent /var/tmp, rename VOLATILE_LOG_DIR to VOLATILE_DIR

Don't use VOLATILE_LOG_DIR/VOLATILE_TMP_DIR
to control it separately since it will make things complicated, we need to make kinds of fs-perms*.txt for kinds of combination of the two variables.

---
  meta/conf/bitbake.conf                                 | 10 ++++++----
  ...erms-persistent-log.txt => fs-perms-persistent.txt} |  2 --
  meta/recipes-core/base-files/base-files_3.0.14.bb  <https://urldefense.com/v3/__http://base-files_3.0.14.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlLGKroQBQ$>       |  7 ++++---
  .../recipes-core/initscripts/initscripts-1.0/volatiles |  3 ---
  meta/recipes-core/initscripts/initscripts_1.0.bb  <https://urldefense.com/v3/__http://initscripts_1.0.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlLZKOO3Tw$>        |  7 +++++--
  meta/recipes-core/systemd/systemd_249.1.bb  <https://urldefense.com/v3/__http://systemd_249.1.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlL5fo0QpQ$>              |  5 +++--
  meta/recipes-core/udev/eudev_3.2.10.bb  <https://urldefense.com/v3/__http://eudev_3.2.10.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlJBKLyQTw$>                  |  3 +++
  7 files changed, 21 insertions(+), 16 deletions(-)

rename meta/files/{fs-perms-persistent-log.txt => fs-perms-persistent.txt} (95%)

meta/conf/bitbake.conf +5 -4
index 821dae2ba6..e93c0b7893 100644
@@ -86,9 +86,11 @@ USRBINPATH_class-nativesdk = "/usr/bin"
  # Root home directory
  ROOT_HOME ??= "/home/root"
 
-# If set to boolean true ('yes', 'y', 'true', 't', '1'), /var/log links to /var/volatile/log.
-# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log is on persistent storage.
-VOLATILE_LOG_DIR ?= "yes"
+# If set to boolean true ('yes', 'y', 'true', 't', '1'), /var/log links to
+# /var/volatile/log, /var/tmp links to /var/volatile/tmp
+# If set to boolean false ('no', 'n', 'false', 'f', '0'), /var/log and /var/tmp
+# is on persistent storage.
+VOLATILE_DIR ?= "yes"
 
  ##################################################################
  # Architecture-dependent build variables.
@@ -349,7 +351,7 @@ FILESEXTRAPATHS ?= "__default:"
  #  datadir, sysconfdir, servicedir, sharedstatedir, localstatedir, infodir,
  #  mandir, docdir, bindir, sbindir, libexecdir, libdir, includedir and
  #  oldincludedir
-FILESYSTEM_PERMS_TABLES ?="${@'files/fs-perms.txt' if 

oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'files/fs-perms-persistent-log.txt'}" +FILESYSTEM_PERMS_TABLES ?="${@'files/fs-perms.txt' if oe.types.boolean(d.getVar('VOLATILE_DIR')) else 'files/fs-perms-persistent.txt'}"

##################################################################
# General work and output directories for the build system.

meta/files/fs-perms-persistent.txt renamed from meta/files/fs-perms-persistent-log.txt +0 -2
similarity index 95%
rename from meta/files/fs-perms-persistent-log.txt
rename to meta/files/fs-perms-persistent.txt
index 518c1be3c9..326c0ed092 100644
@@ -47,7 +47,6 @@ ${oldincludedir}	0755	root	root	true	0644	root	root
  # Links
  ${localstatedir}/run	link	/run
  ${localstatedir}/lock	link	/run/lock
-${localstatedir}/tmp	link	volatile/tmp
 
  /home				0755	root	root	false - - -
  /srv				0755	root	root	false - - -
@@ -57,7 +56,6 @@ ${localstatedir}/local		0755	root	root	false - - -
  # Special permissions from base-files
  # Set 1777
  /tmp				01777	root	root	false - - -
-${localstatedir}/volatile/tmp	01777	root	root	false - - -
 
  # Set 0700
  ${ROOT_HOME}			0700	root	root	false - - -
meta/recipes-core/base-files/base-files_3.0.14.bb <https://urldefense.com/v3/__http://base-files_3.0.14.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlLGKroQBQ$> +3 -3
index 94299431f6..0e06629bbd 100644
@@ -29,7 +29,7 @@ S = "${WORKDIR}"
  INHIBIT_DEFAULT_DEPS = "1"
 
  docdir_append = "/${P}"
-dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
+dirs1777 = "/tmp ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_DIR}') else ''}tmp"
  dirs2775 = ""
  dirs555 = "/sys /proc"
  dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
@@ -42,7 +42,7 @@ dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
             ${localstatedir}/backups ${localstatedir}/lib \
             ${localstatedir}/lib/misc ${localstatedir}/spool \
             ${localstatedir}/volatile \
-           ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \
+           ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_DIR}') else ''}log \
             /home ${prefix}/src ${localstatedir}/local \
             /media"
 
@@ -53,7 +53,8 @@ dirs755-lsb = "/srv  \
                 ${prefix}/lib/locale"
  dirs2775-lsb = "/var/mail"
 
-volatiles ="${@'log' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''} tmp"
+volatiles ="${@'log' if oe.types.boolean('${VOLATILE_DIR}') else ''} \ + 

${@'tmp' if oe.types.boolean('${VOLATILE_DIR}') else ''}"

  conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
               ${sysconfdir}/issue /${sysconfdir}/issue.net  <https://urldefense.com/v3/__http://issue.net__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlI5FtDIsg$>  \
               ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
meta/recipes-core/initscripts/initscripts-1.0/volatiles +0 -3
index cd8a4be05f..eeeb8905da 100644
@@ -24,11 +24,8 @@
  # a link will be created at /var/test pointing to /tmp/testfile and due to this
  # link the file defined as /var/test will actually be created as /tmp/testfile.
  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/run /run
-l root root 1777 /var/tmp /var/volatile/tmp
  l root root 1777 /tmp /var/tmp
  d root root 0755 /var/lock/subsys none
  f root root 0664 /var/log/wtmp none
meta/recipes-core/initscripts/initscripts_1.0.bb <https://urldefense.com/v3/__http://initscripts_1.0.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlLZKOO3Tw$> +5 -2
index 65f9c0ae8d..cc079024f4 100644
@@ -105,9 +105,12 @@ do_install () {
  	install -m 0755    ${WORKDIR}/read-only-rootfs-hook.sh  <https://urldefense.com/v3/__http://read-only-rootfs-hook.sh__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlL1vEuXgw$>  ${D}${sysconfdir}/init.d
  	install -m 0755    ${WORKDIR}/save-rtc.sh  <https://urldefense.com/v3/__http://save-rtc.sh__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlJWvQk5og$>	${D}${sysconfdir}/init.d
  	install -m 0644    ${WORKDIR}/volatiles		${D}${sysconfdir}/default/volatiles/00_core
-	if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
-		sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = True ]; then
+                sed -i -e '\@^# link the file@ a\d root root 0755 /var/volatile/log none\nd root root 1777 /var/volatile/tmp none\nl root root 0755 /var/tmp /var/volatile/tmp\nl root root 0755 /var/log /var/volatile/log' \
  			${D}${sysconfdir}/default/volatiles/00_core
+	else
+		sed -i -e 's;TMPROOT="${ROOT_DIR}/var/volatile/tmp";TMPROOT="${ROOT_DIR}/var/tmp";g' \
+			${D}${sysconfdir}/init.d/populate-volatile.sh  <https://urldefense.com/v3/__http://populate-volatile.sh__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlKbAMCb9w$>
  	fi
  	install -m 0755    ${WORKDIR}/dmesg.sh  <https://urldefense.com/v3/__http://dmesg.sh__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlLNtDYikg$>		${D}${sysconfdir}/init.d
  	install -m 0644    ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
meta/recipes-core/systemd/systemd_249.1.bb <https://urldefense.com/v3/__http://systemd_249.1.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlL5fo0QpQ$> +3 -2
index 9bfb12249c..0914b7e0b2 100644
@@ -251,8 +251,9 @@ do_install() {
  		install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
  	done
 
-	install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
-
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = True ]; then
+		install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+	fi
  	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
  		install -d ${D}${sysconfdir}/init.d
  		install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
meta/recipes-core/udev/eudev_3.2.10.bb <https://urldefense.com/v3/__http://eudev_3.2.10.bb__;!!AjveYdw8EvQ!MoXYkSbYEh_wPDSc9aNzNMO5yoT1RxF7zH1siib0KE9zK-MrIOfuYiyBk0-AGlJBKLyQTw$> +3 -0
index a5d2115f80..3761fd748e 100644
@@ -42,6 +42,9 @@ do_install_append() {
  	install -d ${D}${sysconfdir}/init.d
  	install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
  	sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev
+	if [ ${@ oe.types.boolean('${VOLATILE_DIR}') } = False ]; then
+		sed -i -e 's%mkdir -m 1777 -p /var/volatile/tmp%mkdir -m 1777 -p /var/tmp%g' ${D}${sysconfdir}/init.d/udev
+	fi
 
  	install -d ${D}${sysconfdir}/udev/rules.d
  	install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
#4 lore raw
Quoted 35 lines · Changqing Li

ping
On 8/30/21 4:11 PM, Changqing Li wrote:

Quoted 32 lines · Changqing Li

Quoted 30 lines

From: Changqing Li <[email protected]>

Steps:
1. build out rootfs core-image-minimal-qemux86-64.tar.bz2
2. docker import core-image-minimal-qemux86-64.tar.bz2 poky:latest
3. docker run -it --rm poky:latest /bin/sh
4.
/var # ls -al

drwxr-xr-x    8 root     root          4096 Mar  9  2018 .
drwxr-xr-x    1 root     root          4096 Aug  5 06:59 ..
drwxr-xr-x    2 root     root          4096 Mar  9  2018 backups
drwxr-xr-x    2 root     root          4096 Mar  9  2018 cache
drwxr-xr-x    5 root     root          4096 Mar  9  2018 lib
drwxr-xr-x    2 root     root          4096 Mar  9  2018 local
lrwxrwxrwx    1 root     root            11 Mar  9  2018 lock ->
../run/lock
lrwxrwxrwx    1 root     root            12 Mar  9  2018 log ->
volatile/log
lrwxrwxrwx    1 root     root             6 Mar  9  2018 run -> ../run
drwxr-xr-x    3 root     root          4096 Mar  9  2018 spool
lrwxrwxrwx    1 root     root            12 Mar  9  2018 tmp ->

volatile/tmp
drwxr-xr-x 2 root root 4096 Mar 9 2018 volatile
/var # cd log
/bin/sh: cd: can't cd to log: No such file or directory /var # cd tmp
/bin/sh: cd: can't cd to tmp: No such file or directory /var # cd volatile/
/var/volatile # ls -al
drwxr-xr-x 2 root root 4096 Mar 9 2018 .

Sorry, I appreciate this change hasn't had feedback. Unfortunately I'm finding this one hard to review. I'm also worried because it changes a number of key areas of the system init process in a way which looks very tailored to a specific use case.

I suspect we do need to have some kind of better configuration of this area of the system but I'm not convinced this patchset does that, it looks more likely to adversely affect other use cases in favour of a specialist one.

I am unlikely to want to make changes in this area until the next release now, sorry :/.

This is one of the problems with not having enough people with specialist knowledge to help review, too much falls to me and I just don't have the time to dive into each different thing and stand a chance of making the correct decisions. This is frustrating for everyone.

Cheers,

Richard

#5 lore raw
Quoted 47 lines · Richard Purdie

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 35 lines · Changqing Li

ping

Quoted 32 lines · Changqing Li
Quoted 30 lines · Changqing Li

From: Changqing Li <[email protected]>

Steps:
1. build out rootfs core-image-minimal-qemux86-64.tar.bz2
2. docker import core-image-minimal-qemux86-64.tar.bz2 poky:latest
3. docker run -it --rm poky:latest /bin/sh
4.
/var # ls -al

drwxr-xr-x    8 root     root          4096 Mar  9  2018 .
drwxr-xr-x    1 root     root          4096 Aug  5 06:59 ..
drwxr-xr-x    2 root     root          4096 Mar  9  2018 backups
drwxr-xr-x    2 root     root          4096 Mar  9  2018 cache
drwxr-xr-x    5 root     root          4096 Mar  9  2018 lib
drwxr-xr-x    2 root     root          4096 Mar  9  2018 local
lrwxrwxrwx    1 root     root            11 Mar  9  2018 lock ->
../run/lock
lrwxrwxrwx    1 root     root            12 Mar  9  2018 log ->
volatile/log
lrwxrwxrwx    1 root     root             6 Mar  9  2018 run -> ../run
drwxr-xr-x    3 root     root          4096 Mar  9  2018 spool
lrwxrwxrwx    1 root     root            12 Mar  9  2018 tmp ->

volatile/tmp
drwxr-xr-x 2 root root 4096 Mar 9 2018 volatile
/var # cd log
/bin/sh: cd: can't cd to log: No such file or directory /var # cd tmp
/bin/sh: cd: can't cd to tmp: No such file or directory /var # cd volatile/
/var/volatile # ls -al
drwxr-xr-x 2 root root 4096 Mar 9 2018 .

Sorry, I appreciate this change hasn't had feedback. Unfortunately I'm finding this one hard to review. I'm also worried because it changes a number of key areas of the system init process in a way which looks very tailored to a specific use case.

I suspect we do need to have some kind of better configuration of this area of the system but I'm not convinced this patchset does that, it looks more likely to adversely affect other use cases in favour of a specialist one.

Quoted 6 lines

I am unlikely to want to make changes in this area until the next release now, sorry :/.
This is one of the problems with not having enough people with specialist knowledge to help review, too much falls to me and I just don't have the time to dive into each different thing and stand a chance of making the correct decisions. This is frustrating for everyone.

Hi, Richard

I understand what you said.  And since there are still have 3 months before

3.5 release,  how about consider this patch?  if you have any suggestion, I

can refactor this patch and rebase it to least  master and resend it. Thanks.

I rebase this patch to latest master locally and test following scenario:

1.   default VOLATILE_DIR='yes'  + systemd

       /var/log  /var/tmp  link to  /var/volatile correctly

2.  default VOLATILE_DIR='yes'  + sysVinit

      /var/log  /var/tmp  link to  /var/volatile correctly

3.  VOLATILE_DIR='no'  + systemd + image_install:append = " cups"

    /var/log /var/tmp are persistent storage, not link, cups create /var/log/cups correctly

4. VOLATILE_DIR='no'  + sysVinit  + image_install:append = " cups"

    /var/log /var/tmp are persistent storage, not lin, cups create /var/log/cups correctly

Thanks

Changqing Li

#6 lore raw
In reply to Richard Purdie
Quoted 50 lines · Richard Purdie

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 35 lines · Changqing Li

ping

Quoted 32 lines · Changqing Li
Quoted 30 lines · Changqing Li

From: Changqing Li<[email protected]>

Steps:
1. build out rootfs core-image-minimal-qemux86-64.tar.bz2
2. docker import core-image-minimal-qemux86-64.tar.bz2 poky:latest
3. docker run -it --rm poky:latest /bin/sh
4.
/var # ls -al

drwxr-xr-x    8 root     root          4096 Mar  9  2018 .
drwxr-xr-x    1 root     root          4096 Aug  5 06:59 ..
drwxr-xr-x    2 root     root          4096 Mar  9  2018 backups
drwxr-xr-x    2 root     root          4096 Mar  9  2018 cache
drwxr-xr-x    5 root     root          4096 Mar  9  2018 lib
drwxr-xr-x    2 root     root          4096 Mar  9  2018 local
lrwxrwxrwx    1 root     root            11 Mar  9  2018 lock ->
../run/lock
lrwxrwxrwx    1 root     root            12 Mar  9  2018 log ->
volatile/log
lrwxrwxrwx    1 root     root             6 Mar  9  2018 run -> ../run
drwxr-xr-x    3 root     root          4096 Mar  9  2018 spool
lrwxrwxrwx    1 root     root            12 Mar  9  2018 tmp ->

volatile/tmp
drwxr-xr-x 2 root root 4096 Mar 9 2018 volatile
/var # cd log
/bin/sh: cd: can't cd to log: No such file or directory /var # cd tmp
/bin/sh: cd: can't cd to tmp: No such file or directory /var # cd volatile/
/var/volatile # ls -al
drwxr-xr-x 2 root root 4096 Mar 9 2018 .

Sorry, I appreciate this change hasn't had feedback. Unfortunately I'm finding this one hard to review. I'm also worried because it changes a number of key areas of the system init process in a way which looks very tailored to a specific use case.

I suspect we do need to have some kind of better configuration of this area of the system but I'm not convinced this patchset does that, it looks more likely to adversely affect other use cases in favour of a specialist one.

I am unlikely to want to make changes in this area until the next release now, sorry :/.

Quoted 8 lines

This is one of the problems with not having enough people with specialist knowledge to help review, too much falls to me and I just don't have the time to dive into each different thing and stand a chance of making the correct decisions. This is frustrating for everyone.

Cheers,

Richard

Hi,

Since 4.0 is Released recently,  maybe it is proper time to make changes in this area.

Any suggestion about this issue is welcome. Thanks.

Regards

Changqing

Quoted 3 lines