All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] var/volatile: Mount it if doing ro-rfs
@ 2015-03-11 15:59 Khem Raj
  2015-03-11 17:40 ` Ridish Rema Aravindan
  2015-03-11 17:53 ` Martin Jansa
  0 siblings, 2 replies; 6+ messages in thread
From: Khem Raj @ 2015-03-11 15:59 UTC (permalink / raw)
  To: openembedded-devel

- Do not mount /var/volatile to be tmpfs always only when generating
  readonly rootfs
- Generate var-volatile.mount unit when using system in readonly-rootfs
  to mount /var/volatile as tmpfs
- for sysvinit, mount /var/volatile to be tmpfs if its not already
  mounted so
- Use RequiresMountsFor instead of After=, so systemd figures out the
  needed dependencies for making /var/volatile accessible for journald
  and not us.

Change-Id: I0b176b3e1c1e88e84d2c93154aac04cef565d8ea
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/image.bbclass                                             | 1 +
 meta/recipes-core/base-files/base-files/fstab                          | 1 -
 meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 2 +-
 meta/recipes-core/systemd/systemd/journald-volatile.conf               | 2 +-
 4 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 89eb5f3..818af86 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -228,6 +228,7 @@ read_only_rootfs_hook () {
 	fi
 
 	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+	    sed -e 's#/tmp#/var/volatile#g' ${IMAGE_ROOTFS}/lib/systemd/system/tmp.mount > ${IMAGE_ROOTFS}/lib/systemd/system/var-volatile.mount
 	    # Update user database files so that services don't fail for a read-only systemd system
 	    for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
 		[ -e $conffile ] || continue
diff --git a/meta/recipes-core/base-files/base-files/fstab b/meta/recipes-core/base-files/base-files/fstab
index 739b844..56b14d7 100644
--- a/meta/recipes-core/base-files/base-files/fstab
+++ b/meta/recipes-core/base-files/base-files/fstab
@@ -5,7 +5,6 @@ proc                 /proc                proc       defaults              0  0
 devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
 usbdevfs             /proc/bus/usb        usbdevfs   noauto                0  0
 tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
-tmpfs                /var/volatile        tmpfs      defaults              0  0
 
 # uncomment this if your device has a SD/MMC/Transflash slot
 #/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
index 1a0328d..3ff39f4 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -29,7 +29,7 @@ is_on_read_only_partition () {
 
 if [ "$1" = "start" ] ; then
 	if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
-		grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
+		grep -q "tmpfs /var/volatile" /proc/mounts || mount -t tmpfs -o strictatime tmpfs /var/volatile
 		mkdir -p /var/volatile/lib
 		cp -a /var/lib/* /var/volatile/lib
 		mount --bind /var/volatile/lib /var/lib
diff --git a/meta/recipes-core/systemd/systemd/journald-volatile.conf b/meta/recipes-core/systemd/systemd/journald-volatile.conf
index b11e160..9356a4e 100644
--- a/meta/recipes-core/systemd/systemd/journald-volatile.conf
+++ b/meta/recipes-core/systemd/systemd/journald-volatile.conf
@@ -3,4 +3,4 @@
 # /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
+RequiresMountsFor=/var/volatile
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] var/volatile: Mount it if doing ro-rfs
  2015-03-11 15:59 [PATCH V2] var/volatile: Mount it if doing ro-rfs Khem Raj
@ 2015-03-11 17:40 ` Ridish Rema Aravindan
  2015-03-11 17:53 ` Martin Jansa
  1 sibling, 0 replies; 6+ messages in thread
From: Ridish Rema Aravindan @ 2015-03-11 17:40 UTC (permalink / raw)
  To: openembedded-devel

Hi Khem,

Yes this is a welcome change.

Ridish

On Wed, Mar 11, 2015 at 8:59 AM, Khem Raj <raj.khem@gmail.com> wrote:

> - Do not mount /var/volatile to be tmpfs always only when generating
>   readonly rootfs
> - Generate var-volatile.mount unit when using system in readonly-rootfs
>   to mount /var/volatile as tmpfs
> - for sysvinit, mount /var/volatile to be tmpfs if its not already
>   mounted so
> - Use RequiresMountsFor instead of After=, so systemd figures out the
>   needed dependencies for making /var/volatile accessible for journald
>   and not us.
>
> Change-Id: I0b176b3e1c1e88e84d2c93154aac04cef565d8ea
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/classes/image.bbclass                                             |
> 1 +
>  meta/recipes-core/base-files/base-files/fstab                          |
> 1 -
>  meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh |
> 2 +-
>  meta/recipes-core/systemd/systemd/journald-volatile.conf               |
> 2 +-
>  4 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 89eb5f3..818af86 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -228,6 +228,7 @@ read_only_rootfs_hook () {
>         fi
>
>         if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true",
> "false", d)}; then
> +           sed -e 's#/tmp#/var/volatile#g'
> ${IMAGE_ROOTFS}/lib/systemd/system/tmp.mount >
> ${IMAGE_ROOTFS}/lib/systemd/system/var-volatile.mount
>             # Update user database files so that services don't fail for a
> read-only systemd system
>             for conffile in
> ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf
> ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
>                 [ -e $conffile ] || continue
> diff --git a/meta/recipes-core/base-files/base-files/fstab
> b/meta/recipes-core/base-files/base-files/fstab
> index 739b844..56b14d7 100644
> --- a/meta/recipes-core/base-files/base-files/fstab
> +++ b/meta/recipes-core/base-files/base-files/fstab
> @@ -5,7 +5,6 @@ proc                 /proc                proc
>  defaults              0  0
>  devpts               /dev/pts             devpts     mode=0620,gid=5
>  0  0
>  usbdevfs             /proc/bus/usb        usbdevfs   noauto
>   0  0
>  tmpfs                /run                 tmpfs
> mode=0755,nodev,nosuid,strictatime 0  0
> -tmpfs                /var/volatile        tmpfs      defaults
>   0  0
>
>  # uncomment this if your device has a SD/MMC/Transflash slot
>  #/dev/mmcblk0p1       /media/card          auto
>  defaults,sync,noauto  0  0
> diff --git
> a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> index 1a0328d..3ff39f4 100644
> ---
> a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> +++
> b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> @@ -29,7 +29,7 @@ is_on_read_only_partition () {
>
>  if [ "$1" = "start" ] ; then
>         if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
> -               grep -q "tmpfs /var/volatile" /proc/mounts || mount
> /var/volatile
> +               grep -q "tmpfs /var/volatile" /proc/mounts || mount -t
> tmpfs -o strictatime tmpfs /var/volatile
>                 mkdir -p /var/volatile/lib
>                 cp -a /var/lib/* /var/volatile/lib
>                 mount --bind /var/volatile/lib /var/lib
> diff --git a/meta/recipes-core/systemd/systemd/journald-volatile.conf
> b/meta/recipes-core/systemd/systemd/journald-volatile.conf
> index b11e160..9356a4e 100644
> --- a/meta/recipes-core/systemd/systemd/journald-volatile.conf
> +++ b/meta/recipes-core/systemd/systemd/journald-volatile.conf
> @@ -3,4 +3,4 @@
>  # /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
> +RequiresMountsFor=/var/volatile
> --
> 2.1.4
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] var/volatile: Mount it if doing ro-rfs
  2015-03-11 15:59 [PATCH V2] var/volatile: Mount it if doing ro-rfs Khem Raj
  2015-03-11 17:40 ` Ridish Rema Aravindan
@ 2015-03-11 17:53 ` Martin Jansa
  1 sibling, 0 replies; 6+ messages in thread
From: Martin Jansa @ 2015-03-11 17:53 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 4241 bytes --]

On Wed, Mar 11, 2015 at 03:59:52PM +0000, Khem Raj wrote:
> - Do not mount /var/volatile to be tmpfs always only when generating
>   readonly rootfs
> - Generate var-volatile.mount unit when using system in readonly-rootfs
>   to mount /var/volatile as tmpfs
> - for sysvinit, mount /var/volatile to be tmpfs if its not already
>   mounted so
> - Use RequiresMountsFor instead of After=, so systemd figures out the
>   needed dependencies for making /var/volatile accessible for journald
>   and not us.

Wrong ML :)

> 
> Change-Id: I0b176b3e1c1e88e84d2c93154aac04cef565d8ea
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/classes/image.bbclass                                             | 1 +
>  meta/recipes-core/base-files/base-files/fstab                          | 1 -
>  meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 2 +-
>  meta/recipes-core/systemd/systemd/journald-volatile.conf               | 2 +-
>  4 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 89eb5f3..818af86 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -228,6 +228,7 @@ read_only_rootfs_hook () {
>  	fi
>  
>  	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
> +	    sed -e 's#/tmp#/var/volatile#g' ${IMAGE_ROOTFS}/lib/systemd/system/tmp.mount > ${IMAGE_ROOTFS}/lib/systemd/system/var-volatile.mount
>  	    # Update user database files so that services don't fail for a read-only systemd system
>  	    for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
>  		[ -e $conffile ] || continue
> diff --git a/meta/recipes-core/base-files/base-files/fstab b/meta/recipes-core/base-files/base-files/fstab
> index 739b844..56b14d7 100644
> --- a/meta/recipes-core/base-files/base-files/fstab
> +++ b/meta/recipes-core/base-files/base-files/fstab
> @@ -5,7 +5,6 @@ proc                 /proc                proc       defaults              0  0
>  devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
>  usbdevfs             /proc/bus/usb        usbdevfs   noauto                0  0
>  tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
> -tmpfs                /var/volatile        tmpfs      defaults              0  0
>  
>  # uncomment this if your device has a SD/MMC/Transflash slot
>  #/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> index 1a0328d..3ff39f4 100644
> --- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
> @@ -29,7 +29,7 @@ is_on_read_only_partition () {
>  
>  if [ "$1" = "start" ] ; then
>  	if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
> -		grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
> +		grep -q "tmpfs /var/volatile" /proc/mounts || mount -t tmpfs -o strictatime tmpfs /var/volatile
>  		mkdir -p /var/volatile/lib
>  		cp -a /var/lib/* /var/volatile/lib
>  		mount --bind /var/volatile/lib /var/lib
> diff --git a/meta/recipes-core/systemd/systemd/journald-volatile.conf b/meta/recipes-core/systemd/systemd/journald-volatile.conf
> index b11e160..9356a4e 100644
> --- a/meta/recipes-core/systemd/systemd/journald-volatile.conf
> +++ b/meta/recipes-core/systemd/systemd/journald-volatile.conf
> @@ -3,4 +3,4 @@
>  # /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
> +RequiresMountsFor=/var/volatile
> -- 
> 2.1.4
> 
> -- 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] var/volatile: Mount it if doing ro-rfs
  2015-03-11 21:02 ` Burton, Ross
@ 2015-03-11 21:20   ` Khem Raj
  0 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2015-03-11 21:20 UTC (permalink / raw)
  To: Ross Burton; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

On Mar 11, 2015 2:02 PM, "Burton, Ross" <ross.burton@intel.com> wrote:
>
>
> On 11 March 2015 at 18:07, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> +               grep -q "tmpfs /var/volatile" /proc/mounts || mount -t
tmpfs -o strictatime tmpfs /var/volatile
>
>
> What is someone uses tmpfs[tab]/var/volatile?  This should match on
arbitrary whitespace.

Yes. But my commit does not make it worse than it already is.
>
> Ross

[-- Attachment #2: Type: text/html, Size: 678 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] var/volatile: Mount it if doing ro-rfs
  2015-03-11 18:07 Khem Raj
@ 2015-03-11 21:02 ` Burton, Ross
  2015-03-11 21:20   ` Khem Raj
  0 siblings, 1 reply; 6+ messages in thread
From: Burton, Ross @ 2015-03-11 21:02 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

On 11 March 2015 at 18:07, Khem Raj <raj.khem@gmail.com> wrote:

> +               grep -q "tmpfs /var/volatile" /proc/mounts || mount -t
> tmpfs -o strictatime tmpfs /var/volatile
>

What is someone uses tmpfs[tab]/var/volatile?  This should match on
arbitrary whitespace.

Ross

[-- Attachment #2: Type: text/html, Size: 709 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V2] var/volatile: Mount it if doing ro-rfs
@ 2015-03-11 18:07 Khem Raj
  2015-03-11 21:02 ` Burton, Ross
  0 siblings, 1 reply; 6+ messages in thread
From: Khem Raj @ 2015-03-11 18:07 UTC (permalink / raw)
  To: openembedded-core

- Do not mount /var/volatile to be tmpfs always only when generating
  readonly rootfs
- Generate var-volatile.mount unit when using system in readonly-rootfs
  to mount /var/volatile as tmpfs
- for sysvinit, mount /var/volatile to be tmpfs if its not already
  mounted so
- Use RequiresMountsFor instead of After=, so systemd figures out the
  needed dependencies for making /var/volatile accessible for journald
  and not us.

Change-Id: I0b176b3e1c1e88e84d2c93154aac04cef565d8ea
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/image.bbclass                                             | 1 +
 meta/recipes-core/base-files/base-files/fstab                          | 1 -
 meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 2 +-
 meta/recipes-core/systemd/systemd/journald-volatile.conf               | 2 +-
 4 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 89eb5f3..818af86 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -228,6 +228,7 @@ read_only_rootfs_hook () {
 	fi
 
 	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+	    sed -e 's#/tmp#/var/volatile#g' ${IMAGE_ROOTFS}/lib/systemd/system/tmp.mount > ${IMAGE_ROOTFS}/lib/systemd/system/var-volatile.mount
 	    # Update user database files so that services don't fail for a read-only systemd system
 	    for conffile in ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd.conf ${IMAGE_ROOTFS}/usr/lib/sysusers.d/systemd-remote.conf; do
 		[ -e $conffile ] || continue
diff --git a/meta/recipes-core/base-files/base-files/fstab b/meta/recipes-core/base-files/base-files/fstab
index 739b844..56b14d7 100644
--- a/meta/recipes-core/base-files/base-files/fstab
+++ b/meta/recipes-core/base-files/base-files/fstab
@@ -5,7 +5,6 @@ proc                 /proc                proc       defaults              0  0
 devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
 usbdevfs             /proc/bus/usb        usbdevfs   noauto                0  0
 tmpfs                /run                 tmpfs      mode=0755,nodev,nosuid,strictatime 0  0
-tmpfs                /var/volatile        tmpfs      defaults              0  0
 
 # uncomment this if your device has a SD/MMC/Transflash slot
 #/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
index 1a0328d..3ff39f4 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -29,7 +29,7 @@ is_on_read_only_partition () {
 
 if [ "$1" = "start" ] ; then
 	if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
-		grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
+		grep -q "tmpfs /var/volatile" /proc/mounts || mount -t tmpfs -o strictatime tmpfs /var/volatile
 		mkdir -p /var/volatile/lib
 		cp -a /var/lib/* /var/volatile/lib
 		mount --bind /var/volatile/lib /var/lib
diff --git a/meta/recipes-core/systemd/systemd/journald-volatile.conf b/meta/recipes-core/systemd/systemd/journald-volatile.conf
index b11e160..9356a4e 100644
--- a/meta/recipes-core/systemd/systemd/journald-volatile.conf
+++ b/meta/recipes-core/systemd/systemd/journald-volatile.conf
@@ -3,4 +3,4 @@
 # /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
+RequiresMountsFor=/var/volatile
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-11 21:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 15:59 [PATCH V2] var/volatile: Mount it if doing ro-rfs Khem Raj
2015-03-11 17:40 ` Ridish Rema Aravindan
2015-03-11 17:53 ` Martin Jansa
2015-03-11 18:07 Khem Raj
2015-03-11 21:02 ` Burton, Ross
2015-03-11 21:20   ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.