* Patch: Krogoth systemd network service fails to start on boot
@ 2016-07-19 11:37 Kristian Amlie
2016-07-19 21:39 ` Khem Raj
0 siblings, 1 reply; 3+ messages in thread
From: Kristian Amlie @ 2016-07-19 11:37 UTC (permalink / raw)
To: Openembedded-core
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
Hey,
on our krogoth build the systemd network service does not start, and it
seems to be because of missing users, which has already been fixed on
master. I've cherry-picked the two patches that fixed the problem for
us. Note that they are not written by me, but by other people on this
list. I hope they can be applied to krogoth.
Regards
Kristian Amlie
[-- Attachment #2: 0001-systemd-Create-missing-sysusers-offline.patch --]
[-- Type: text/x-patch, Size: 2514 bytes --]
From 5da020f1b00c5ed003400baa3905843824db0a60 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 17 May 2016 21:40:21 -0700
Subject: [PATCH 1/2] systemd: Create missing sysusers offline
Some system users which are needed by systemd components were missing
create these users knobbed with relevant packageconfig
(From OE-Core rev: d18957925c6c073b7194e3a233efea24e436f74e)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit fd36a447d0da53e713d992b17ce86dd31ea63c67)
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
meta/recipes-core/systemd/systemd_229.bb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-core/systemd/systemd_229.bb b/meta/recipes-core/systemd/systemd_229.bb
index c23c749..a2d35f8 100644
--- a/meta/recipes-core/systemd/systemd_229.bb
+++ b/meta/recipes-core/systemd/systemd_229.bb
@@ -319,10 +319,16 @@ PACKAGES =+ "\
SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)}"
SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
-USERADD_PACKAGES = "${PN}"
+USERADD_PACKAGES = "${PN} ${PN}-extra-utils"
USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M --shell /bin/nologin systemd-journal-gateway;', '', d)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M --shell /bin/nologin systemd-journal-remote;', '', d)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '--system -d / -M --shell /bin/nologin systemd-journal-upload;', '', d)}"
USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}"
GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
+USERADD_PARAM_${PN}-extra-utils += "--system -d / -M --shell /bin/nologin systemd-bus-proxy;"
FILES_${PN}-analyze = "${bindir}/systemd-analyze"
--
2.7.4
[-- Attachment #3: 0002-systemd-allow-add-users-as-a-rootfs-postprocess-cmd.patch --]
[-- Type: text/x-patch, Size: 4242 bytes --]
From 27f74da024b459e0f8f02184f3e253dc58305cba Mon Sep 17 00:00:00 2001
From: Stephano Cetola <stephano.cetola@linux.intel.com>
Date: Tue, 31 May 2016 13:59:54 -0700
Subject: [PATCH 2/2] systemd: allow add users as a rootfs postprocess cmd
Adding all the users / groups to systemd is only available for readonly
file systems. This change allows users to add them to read / write file
systems as well by specifying:
ROOTFS_POSTPROCESS_COMMAND += "systemd_create_users"
Also, add "--shell /sbin/nologin" to each user's add params.
[ YOCTO #9497 ]
(From OE-Core rev: 98a4c642444a524f547f5d978a28814d20c12354)
Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 79be110c1fdfd0affe6a310b96e7107c4549d23c)
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
meta/classes/rootfs-postcommands.bbclass | 43 +++++++++++++++-----------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 95d28af..db8b551 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -21,7 +21,7 @@ ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
# Set default target for systemd images
SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}'
-ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; ", "", d)}'
+ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; systemd_create_users;", "", d)}'
ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
@@ -30,7 +30,25 @@ ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
SSH_DISABLE_DNS_LOOKUP ?= " ssh_disable_dns_lookup ; "
ROOTFS_POSTPROCESS_COMMAND_append_qemuall = "${SSH_DISABLE_DNS_LOOKUP}"
-
+systemd_create_users () {
+ 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="--shell /sbin/nologin"
+ [ "$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
+}
#
# A hook function to support read-only-rootfs IMAGE_FEATURES
@@ -73,27 +91,6 @@ read_only_rootfs_hook () {
${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
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
}
#
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: Patch: Krogoth systemd network service fails to start on boot
2016-07-19 11:37 Patch: Krogoth systemd network service fails to start on boot Kristian Amlie
@ 2016-07-19 21:39 ` Khem Raj
2016-07-20 7:55 ` Kristian Amlie
0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2016-07-19 21:39 UTC (permalink / raw)
To: Kristian Amlie; +Cc: Openembedded-core
[-- Attachment #1: Type: text/plain, Size: 889 bytes --]
thats fine. Post the patches using git-format patch and have [krogoth] in the subject header
> On Jul 19, 2016, at 4:37 AM, Kristian Amlie <kristian.amlie@mender.io> wrote:
>
> Hey,
>
> on our krogoth build the systemd network service does not start, and it
> seems to be because of missing users, which has already been fixed on
> master. I've cherry-picked the two patches that fixed the problem for
> us. Note that they are not written by me, but by other people on this
> list. I hope they can be applied to krogoth.
>
> Regards
> Kristian Amlie
> <0001-systemd-Create-missing-sysusers-offline.patch><0002-systemd-allow-add-users-as-a-rootfs-postprocess-cmd.patch>--
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 211 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-20 7:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 11:37 Patch: Krogoth systemd network service fails to start on boot Kristian Amlie
2016-07-19 21:39 ` Khem Raj
2016-07-20 7:55 ` Kristian Amlie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox