All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] image.bbclass: avoid boot error on read-only systemd image
@ 2014-10-21  6:30 Chen Qi
  2014-10-21  6:30 ` [PATCH 1/1] " Chen Qi
  2014-12-19  8:12 ` [PATCH 0/1] " ChenQi
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Qi @ 2014-10-21  6:30 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit fcbd1b19383daf5e160a864df1418130da01be28:

  build-appliance-image: Update to dizzy head revision (2014-10-11 08:11:11 +0100)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib ChenQi/systemd-read-only
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/systemd-read-only

Chen Qi (1):
  image.bbclass: avoid boot error on read-only systemd image

 meta/classes/image.bbclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

-- 
1.9.1



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

* [PATCH 1/1] image.bbclass: avoid boot error on read-only systemd image
  2014-10-21  6:30 [PATCH 0/1] image.bbclass: avoid boot error on read-only systemd image Chen Qi
@ 2014-10-21  6:30 ` Chen Qi
  2014-12-19  8:12 ` [PATCH 0/1] " ChenQi
  1 sibling, 0 replies; 3+ messages in thread
From: Chen Qi @ 2014-10-21  6:30 UTC (permalink / raw)
  To: openembedded-core

New version of systemd implements a new feature of updating /etc
or /var when needed at boot. For details, please see link below.

Opointer.de/blog/projects/stateless.html

For now, at boot time, the systemd-sysusers.service would update user
database files (/etc/passwd, /etc/group, etc.) according to the configuration
files under /usr/lib/sysusers.d. This step is necessary for other systemd
services to work correctly. Examples of such services are systemd-resolved
and systemd-tmpfiles-setup.

The problem is that on a read-only file system, that is, if /etc is read-only,
the user database files could not be updated, causing failures of services.

This patch fixes this problem by adding users/groups at rootfs time.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/image.bbclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 940bdb6..56109a0 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -225,6 +225,27 @@ read_only_rootfs_hook () {
 			fi
 		fi
 	fi
+
+	if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
+	    # 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
+		grep -v "^#" $conffile | sed -e '/^$/d' | while read type name id comment; do
+		    if [ "$type" = "u" ]; then
+			useradd_params=""
+			[ "$id" != "-" ] && useradd_params="$useradd_params --uid $id"
+			[ "$comment" != "-" ] && useradd_params="$useradd_params --comment $comment"
+			useradd_params="$useradd_params --system $name"
+			eval useradd --root ${IMAGE_ROOTFS} $useradd_params || true
+		    elif [ "$type" = "g" ]; then
+			groupadd_params=""
+			[ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id"
+			groupadd_params="$groupadd_params --system $name"
+			eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true
+		    fi
+		done
+	    done
+	fi
 }
 
 PACKAGE_EXCLUDE ??= ""
-- 
1.9.1



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

* Re: [PATCH 0/1] image.bbclass: avoid boot error on read-only systemd image
  2014-10-21  6:30 [PATCH 0/1] image.bbclass: avoid boot error on read-only systemd image Chen Qi
  2014-10-21  6:30 ` [PATCH 1/1] " Chen Qi
@ 2014-12-19  8:12 ` ChenQi
  1 sibling, 0 replies; 3+ messages in thread
From: ChenQi @ 2014-12-19  8:12 UTC (permalink / raw)
  To: openembedded-core

ping

On 10/21/2014 02:30 PM, Chen Qi wrote:
> The following changes since commit fcbd1b19383daf5e160a864df1418130da01be28:
>
>    build-appliance-image: Update to dizzy head revision (2014-10-11 08:11:11 +0100)
>
> are available in the git repository at:
>
>    git://git.openembedded.org/openembedded-core-contrib ChenQi/systemd-read-only
>    http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/systemd-read-only
>
> Chen Qi (1):
>    image.bbclass: avoid boot error on read-only systemd image
>
>   meta/classes/image.bbclass | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
>



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

end of thread, other threads:[~2014-12-19  8:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21  6:30 [PATCH 0/1] image.bbclass: avoid boot error on read-only systemd image Chen Qi
2014-10-21  6:30 ` [PATCH 1/1] " Chen Qi
2014-12-19  8:12 ` [PATCH 0/1] " ChenQi

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.