Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] systemd: Correct and clean up user/group definitions
@ 2019-01-15  0:49 Peter Kjellerstedt
  2019-01-15  0:49 ` [PATCH 2/2] systemd: Correct a conditional add to SYSTEMD_PACKAGES Peter Kjellerstedt
  2019-01-15  0:59 ` [PATCH 1/2] systemd: Correct and clean up user/group definitions Peter Kjellerstedt
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Kjellerstedt @ 2019-01-15  0:49 UTC (permalink / raw)
  To: openembedded-core

This makes sure that packages are only added to USERADD_PACKAGES if
they will create users/groups. This avoids the following error:

  ERROR: systemd_239.bb: meta/recipes-core/systemd/systemd_239.bb
  inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or
  GROUPMEMS_PARAM for package systemd-journal-gateway

Normally this problem is not triggered even if the conditional code that
expands in, e.g., USERADD_PARAM_${PN}-journal-gateway is empty because
it is assigned with += and thus ends up as " ", which fools the check in
useradd.bbclass.

However, if USERADDEXTENSION += "useradd-staticids" and
INHERIT += "extrausers" are used, they cause the problem to occur. The
reason for this is because when useradd-staticids is used, it rewrites
USERADD_PARAM_${PN}-journal-gateway, which strips unnecessary whitespace
and thus USERADD_PARAM_${PN}-journal-gateway becomes empty. And
extrausers is needed, because otherwise the test in useradd.bbclass is
triggered before useradd-staticids has rewritten the variables...

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-core/systemd/systemd_239.bb | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb
index be836ffa42..aa05af3beb 100644
--- a/meta/recipes-core/systemd/systemd_239.bb
+++ b/meta/recipes-core/systemd/systemd_239.bb
@@ -343,17 +343,21 @@ SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfm
 "
 SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
 
-USERADD_PACKAGES = "${PN} ${PN}-extra-utils ${PN}-journal-gateway ${PN}-journal-upload ${PN}-journal-remote"
-USERADD_PARAM_${PN}-journal-gateway += "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M --shell /bin/nologin systemd-journal-gateway;', '', d)}"
-USERADD_PARAM_${PN}-journal-remote += "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M --shell /bin/nologin systemd-journal-remote;', '', d)}"
-USERADD_PARAM_${PN}-journal-upload += "${@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_PACKAGES = "${PN} ${PN}-extra-utils \
+                    ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \
+                    ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
+                    ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
+"
+GROUPADD_PARAM_${PN} = "-r systemd-journal"
 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)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}"
 USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
-GROUPADD_PARAM_${PN} = "-r systemd-journal"
-USERADD_PARAM_${PN}-extra-utils += "--system -d / -M --shell /bin/nologin systemd-bus-proxy;"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}"
+USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}"
+USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy"
+USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway"
+USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote"
+USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload"
 
 FILES_${PN}-analyze = "${bindir}/systemd-analyze"
 
-- 
2.12.0



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

* [PATCH 2/2] systemd: Correct a conditional add to SYSTEMD_PACKAGES
  2019-01-15  0:49 [PATCH 1/2] systemd: Correct and clean up user/group definitions Peter Kjellerstedt
@ 2019-01-15  0:49 ` Peter Kjellerstedt
  2019-01-15  0:59 ` [PATCH 1/2] systemd: Correct and clean up user/group definitions Peter Kjellerstedt
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Kjellerstedt @ 2019-01-15  0:49 UTC (permalink / raw)
  To: openembedded-core

The code conditionally adding ${PN}-journal-remote to SYSTEMD_PACKAGE
checked PACKAGECONFIG for an empty string rather than 'microhttpd'...

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/recipes-core/systemd/systemd_239.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb
index aa05af3beb..832257992d 100644
--- a/meta/recipes-core/systemd/systemd_239.bb
+++ b/meta/recipes-core/systemd/systemd_239.bb
@@ -338,8 +338,8 @@ DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to recei
 
 SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
                     ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
+                    ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
                     ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
-                    ${@bb.utils.contains('PACKAGECONFIG', '', '${PN}-journal-remote', '', d)} \
 "
 SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
 
-- 
2.12.0



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

* Re: [PATCH 1/2] systemd: Correct and clean up user/group definitions
  2019-01-15  0:49 [PATCH 1/2] systemd: Correct and clean up user/group definitions Peter Kjellerstedt
  2019-01-15  0:49 ` [PATCH 2/2] systemd: Correct a conditional add to SYSTEMD_PACKAGES Peter Kjellerstedt
@ 2019-01-15  0:59 ` Peter Kjellerstedt
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Kjellerstedt @ 2019-01-15  0:59 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Peter Kjellerstedt
> Sent: den 15 januari 2019 01:49
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 1/2] systemd: Correct and clean up user/group
> definitions
> 
> This makes sure that packages are only added to USERADD_PACKAGES if
> they will create users/groups. This avoids the following error:
> 
>   ERROR: systemd_239.bb: meta/recipes-core/systemd/systemd_239.bb
>   inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or
>   GROUPMEMS_PARAM for package systemd-journal-gateway
> 
> Normally this problem is not triggered even if the conditional code
> that
> expands in, e.g., USERADD_PARAM_${PN}-journal-gateway is empty because
> it is assigned with += and thus ends up as " ", which fools the check
> in
> useradd.bbclass.
> 
> However, if USERADDEXTENSION += "useradd-staticids" and
> INHERIT += "extrausers" are used, they cause the problem to occur. The
> reason for this is because when useradd-staticids is used, it rewrites
> USERADD_PARAM_${PN}-journal-gateway, which strips unnecessary
> whitespace
> and thus USERADD_PARAM_${PN}-journal-gateway becomes empty. And
> extrausers is needed, because otherwise the test in useradd.bbclass is
> triggered before useradd-staticids has rewritten the variables...
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
>  meta/recipes-core/systemd/systemd_239.bb | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-
> core/systemd/systemd_239.bb
> index be836ffa42..aa05af3beb 100644
> --- a/meta/recipes-core/systemd/systemd_239.bb
> +++ b/meta/recipes-core/systemd/systemd_239.bb
> @@ -343,17 +343,21 @@ SYSTEMD_PACKAGES =
> "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfm
>  "
>  SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
> 
> -USERADD_PACKAGES = "${PN} ${PN}-extra-utils ${PN}-journal-gateway
> ${PN}-journal-upload ${PN}-journal-remote"
> -USERADD_PARAM_${PN}-journal-gateway +=
> "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M
> --shell /bin/nologin systemd-journal-gateway;', '', d)}"
> -USERADD_PARAM_${PN}-journal-remote +=
> "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M
> --shell /bin/nologin systemd-journal-remote;', '', d)}"
> -USERADD_PARAM_${PN}-journal-upload +=
> "${@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_PACKAGES = "${PN} ${PN}-extra-utils \
> +                    ${@bb.utils.contains('PACKAGECONFIG',
> 'microhttpd', '${PN}-journal-gateway', '', d)} \
> +                    ${@bb.utils.contains('PACKAGECONFIG',
> 'microhttpd', '${PN}-journal-remote', '', d)} \
> +                    ${@bb.utils.contains('PACKAGECONFIG', 'journal-
> upload', '${PN}-journal-upload', '', d)} \
> +"
> +GROUPADD_PARAM_${PN} = "-r systemd-journal"
>  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)}"
> +USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG',
> 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;',
> '', d)}"
>  USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG',
> 'polkit', '--system --no-create-home --user-group --home-dir
> ${sysconfdir}/polkit-1 polkitd;', '', d)}"
> -GROUPADD_PARAM_${PN} = "-r systemd-journal"
> -USERADD_PARAM_${PN}-extra-utils += "--system -d / -M --shell
> /bin/nologin systemd-bus-proxy;"
> +USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG',
> 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;',
> '', d)}"
> +USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG',
> 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;',
> '', d)}"
> +USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell
> /bin/nologin systemd-bus-proxy"
> +USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell
> /bin/nologin systemd-journal-gateway"
> +USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell
> /bin/nologin systemd-journal-remote"
> +USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell
> /bin/nologin systemd-journal-upload"
> 
>  FILES_${PN}-analyze = "${bindir}/systemd-analyze"
> 
> --
> 2.12.0

This also needs to be cherry-picked to Thud once it has been accepted for 
master. I assume it is too late for 2.6.1, but one can always hope...

//Peter



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

end of thread, other threads:[~2019-01-15  0:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-15  0:49 [PATCH 1/2] systemd: Correct and clean up user/group definitions Peter Kjellerstedt
2019-01-15  0:49 ` [PATCH 2/2] systemd: Correct a conditional add to SYSTEMD_PACKAGES Peter Kjellerstedt
2019-01-15  0:59 ` [PATCH 1/2] systemd: Correct and clean up user/group definitions Peter Kjellerstedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox