* [PATCH 1/4] rpm-postinsts: don't create broken postinst script
2013-04-10 15:42 [PATCH 0/4] Fixes for read-only-rootfs Paul Eggleton
@ 2013-04-10 15:42 ` Paul Eggleton
2013-04-10 15:42 ` [PATCH 2/4] rpm-postinsts: avoid errors during boot with read-only-rootfs enabled Paul Eggleton
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Paul Eggleton @ 2013-04-10 15:42 UTC (permalink / raw)
To: openembedded-core
Not only was the variable reference in this line broken, but it wasn't
going to work anyway - we install the script directly into /etc/rcS.d
and not into /etc/init.d, so the code in update-rc.d.bbclass couldn't
find anything there. This resulted in a postinstall script for
rpm-postinsts being created in /etc/rpm-postinsts which can't work when
the root filesystem is read-only. To simplify things just remove the use
of update-rc.d.bbclass since we don't really need the added complexity
here.
Fixes [YOCTO #4222].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
meta/recipes-devtools/rpm/rpm-postinsts.bb | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
index 27ef2aa..0a62da0 100644
--- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
+++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
@@ -5,15 +5,12 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/LGPL-2.1;md5=1
RDEPENDS_${PN} = "base-files"
-inherit update-rc.d allarch
+inherit allarch
#
# Allow distributions to alter when [postponed] package install scripts are run
#
POSTINSTALL_INITPOSITION ?= "98"
-INITSCRIPT_NAME = "run-postinsts"
-INITSCRIPT_PARAMS = "start ${{POSTINSTALL_INITPOSITION} S ."
-
POSTLOG ?= "/var/log/postinstall.log"
REDIRECT_CMD = "${@base_contains('IMAGE_FEATURES', 'debug-tweaks', '>>${POSTLOG} 2>&1', '', d)}"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] rpm-postinsts: avoid errors during boot with read-only-rootfs enabled
2013-04-10 15:42 [PATCH 0/4] Fixes for read-only-rootfs Paul Eggleton
2013-04-10 15:42 ` [PATCH 1/4] rpm-postinsts: don't create broken postinst script Paul Eggleton
@ 2013-04-10 15:42 ` Paul Eggleton
2013-04-10 15:42 ` [PATCH 3/4] initscripts: fix read-only-rootfs-hook.sh to avoid using unionfs Paul Eggleton
2013-04-10 15:42 ` [PATCH 4/4] initscripts: fix read-only-rootfs-hook.sh to start earlier Paul Eggleton
3 siblings, 0 replies; 7+ messages in thread
From: Paul Eggleton @ 2013-04-10 15:42 UTC (permalink / raw)
To: openembedded-core
* If /etc/rpm-postinsts doesn't exist, don't error
* If deleting the script errors, don't bother printing it (this will
always happen if the root filesystem is read-only)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
meta/recipes-devtools/rpm/rpm-postinsts.bb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-devtools/rpm/rpm-postinsts.bb b/meta/recipes-devtools/rpm/rpm-postinsts.bb
index 0a62da0..fb05ad6 100644
--- a/meta/recipes-devtools/rpm/rpm-postinsts.bb
+++ b/meta/recipes-devtools/rpm/rpm-postinsts.bb
@@ -32,7 +32,10 @@ do_install() {
i=\$i
cat > ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << EOF
#!/bin/sh
-for i in \`ls /etc/rpm-postinsts/\`; do
+
+. /etc/default/rcS
+
+[ -d /etc/rpm-postinsts ] && for i in \`ls /etc/rpm-postinsts/ \`; do
i=/etc/rpm-postinsts/$i
echo "Running postinst $i..."
if [ -f $i ] && $i ${REDIRECT_CMD}; then
@@ -41,7 +44,7 @@ for i in \`ls /etc/rpm-postinsts/\`; do
echo "ERROR: postinst $i failed."
fi
done
-rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
+rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts 2>/dev/null
EOF
chmod 0755 ${D}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] initscripts: fix read-only-rootfs-hook.sh to avoid using unionfs
2013-04-10 15:42 [PATCH 0/4] Fixes for read-only-rootfs Paul Eggleton
2013-04-10 15:42 ` [PATCH 1/4] rpm-postinsts: don't create broken postinst script Paul Eggleton
2013-04-10 15:42 ` [PATCH 2/4] rpm-postinsts: avoid errors during boot with read-only-rootfs enabled Paul Eggleton
@ 2013-04-10 15:42 ` Paul Eggleton
2013-04-10 15:42 ` [PATCH 4/4] initscripts: fix read-only-rootfs-hook.sh to start earlier Paul Eggleton
3 siblings, 0 replies; 7+ messages in thread
From: Paul Eggleton @ 2013-04-10 15:42 UTC (permalink / raw)
To: openembedded-core
Unionfs isn't available everywhere, and we can get similar results (if
not quite as neatly) by using bind mounts + tmpfs and copying the data
over.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
.../initscripts-1.0/read-only-rootfs-hook.sh | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
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 3a295ee..4f3e0d9 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
@@ -4,16 +4,9 @@
[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
-# Make sure unionfs is in /proc/filesystems
-if ! grep -q unionfs /proc/filesystems; then
- echo "ERROR: unionfs not supported by kernel!"
- exit 1
+if [ "$1" = "start" ] ; then
+ mkdir -p /var/volatile/lib
+ cp -a /var/lib/* /var/volatile/lib
+ mount --bind /var/volatile/lib /var/lib
fi
-mkdir -p /var/volatile/lib
-mount -t unionfs -o dirs=/var/volatile/lib:/var/lib=ro none /var/lib
-
-if [ $? != 0 ]; then
- echo "ERROR: Union mount failed!"
- exit 1
-fi
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] initscripts: fix read-only-rootfs-hook.sh to start earlier
2013-04-10 15:42 [PATCH 0/4] Fixes for read-only-rootfs Paul Eggleton
` (2 preceding siblings ...)
2013-04-10 15:42 ` [PATCH 3/4] initscripts: fix read-only-rootfs-hook.sh to avoid using unionfs Paul Eggleton
@ 2013-04-10 15:42 ` Paul Eggleton
2013-04-11 6:29 ` Bernhard Reutner-Fischer
3 siblings, 1 reply; 7+ messages in thread
From: Paul Eggleton @ 2013-04-10 15:42 UTC (permalink / raw)
To: openembedded-core
Mount /var/volatile ourselves so that we can set up the writable area
first. This fixes the urandom service not starting properly when
read-only-rootfs is enabled.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
.../initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 1 +
meta/recipes-core/initscripts/initscripts_1.0.bb | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
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 4f3e0d9..9cf0921 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
@@ -5,6 +5,7 @@
[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
if [ "$1" = "start" ] ; then
+ grep -q "tmpfs /var/volatile" /proc/mounts || mount /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/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index 649e182..531b2b6 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -118,7 +118,7 @@ do_install () {
update-rc.d -r ${D} bootmisc.sh start 55 S .
update-rc.d -r ${D} sysfs.sh start 02 S .
update-rc.d -r ${D} populate-volatile.sh start 37 S .
- update-rc.d -r ${D} read-only-rootfs-hook.sh start 41 S .
+ update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
update-rc.d -r ${D} devpts.sh start 38 S .
if [ "${TARGET_ARCH}" = "arm" ]; then
update-rc.d -r ${D} alignment.sh start 06 S .
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 4/4] initscripts: fix read-only-rootfs-hook.sh to start earlier
2013-04-10 15:42 ` [PATCH 4/4] initscripts: fix read-only-rootfs-hook.sh to start earlier Paul Eggleton
@ 2013-04-11 6:29 ` Bernhard Reutner-Fischer
2013-04-11 9:23 ` Paul Eggleton
0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2013-04-11 6:29 UTC (permalink / raw)
To: Paul Eggleton, openembedded-core
On 10 April 2013 17:42:28 Paul Eggleton <paul.eggleton@linux.intel.com> wrote:
> Mount /var/volatile ourselves so that we can set up the writable area
> first. This fixes the urandom service not starting properly when
> read-only-rootfs is enabled.
>
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
> .../initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 1 +
> meta/recipes-core/initscripts/initscripts_1.0.bb | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> 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 4f3e0d9..9cf0921 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
> @@ -5,6 +5,7 @@
> [ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
>
> if [ "$1" = "start" ] ; then
> + grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
Or just use mountpoint(1)?
Sent with AquaMail for Android
http://www.aqua-mail.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 4/4] initscripts: fix read-only-rootfs-hook.sh to start earlier
2013-04-11 6:29 ` Bernhard Reutner-Fischer
@ 2013-04-11 9:23 ` Paul Eggleton
0 siblings, 0 replies; 7+ messages in thread
From: Paul Eggleton @ 2013-04-11 9:23 UTC (permalink / raw)
To: Bernhard Reutner-Fischer; +Cc: openembedded-core
On Thursday 11 April 2013 08:29:49 Bernhard Reutner-Fischer wrote:
> On 10 April 2013 17:42:28 Paul Eggleton <paul.eggleton@linux.intel.com>
wrote:
> > Mount /var/volatile ourselves so that we can set up the writable area
> > first. This fixes the urandom service not starting properly when
> > read-only-rootfs is enabled.
> >
> > Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> > ---
> >
> > .../initscripts/initscripts-1.0/read-only-rootfs-hook.sh |
> > 1 + meta/recipes-core/initscripts/initscripts_1.0.bb
> > | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > 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 4f3e0d9..9cf0921 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
> > @@ -5,6 +5,7 @@
> >
> > [ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
> >
> > if [ "$1" = "start" ] ; then
> >
> > + grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
>
> Or just use mountpoint(1)?
That would have been a better choice if I had known about it, yes. I'll send a
patch to change it.
Thanks,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 7+ messages in thread