* [PATCH] systemd: sysusersd: change how the root home directory is set
@ 2023-07-27 9:28 Louis Rannou
2023-08-06 20:07 ` [OE-core] " Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Louis Rannou @ 2023-07-27 9:28 UTC (permalink / raw)
To: openembedded-core; +Cc: Qi.Chen, tgamblin, Louis Rannou, Peter Kjellerstedt
Modifying the sources brings troubles in the devtool command. Therefore it is
better to patch the source with a custom variable, and later replace it with the
correct root path.
Suggestion from :
<https://lore.kernel.org/all/DB5PR02MB102137939DE6D43E423A9D296EF03A@DB5PR02MB10213.eurprd02.prod.outlook.com/>
Signed-off-by: Louis Rannou <lrannou@baylibre.com>
Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
...usersd-Change-the-user-root-s-home-direct.patch | 32 ++++++++++++++++++++++
meta/recipes-core/systemd/systemd_253.3.bb | 11 ++++----
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/meta/recipes-core/systemd/systemd/0029-sysusersd-Change-the-user-root-s-home-direct.patch b/meta/recipes-core/systemd/systemd/0029-sysusersd-Change-the-user-root-s-home-direct.patch
new file mode 100644
index 0000000000..738413ec93
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0029-sysusersd-Change-the-user-root-s-home-direct.patch
@@ -0,0 +1,32 @@
+From bf97001978cdefad644f7b4b909f281368e5a4dd Mon Sep 17 00:00:00 2001
+From: Kas User <kas@example.com>
+Date: Thu, 27 Jul 2023 08:23:06 +0000
+Subject: [PATCH] sysusers.d: Change the user root's home directory
+
+The default sysusers basic.conf.in file sets the root home directory to `/root`
+and does not permit its configuration. Change this to `:ROOT_HOME:` which must
+be set before the installation.
+
+The upstream considers the root home directory should not be changed
+<https://github.com/systemd/systemd/issues/27959>
+
+Upstream-Status: Denied
+Signed-off-by: Louis Rannou <lrannou@baylibre.com>
+---
+ sysusers.d/basic.conf.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysusers.d/basic.conf.in b/sysusers.d/basic.conf.in
+index 0aec080a4c..f26c224341 100644
+--- a/sysusers.d/basic.conf.in
++++ b/sysusers.d/basic.conf.in
+@@ -7,7 +7,7 @@
+
+ # The superuser
+ g root 0 - -
+-u root 0:0 "Super User" /root
++u root 0:0 "Super User" :ROOT_HOME:
+
+ # The nobody user/group for NFS file systems
+ g {{NOBODY_GROUP_NAME}} 65534 - -
+
diff --git a/meta/recipes-core/systemd/systemd_253.3.bb b/meta/recipes-core/systemd/systemd_253.3.bb
index cf0e17ff00..0f96140025 100644
--- a/meta/recipes-core/systemd/systemd_253.3.bb
+++ b/meta/recipes-core/systemd/systemd_253.3.bb
@@ -17,7 +17,6 @@ REQUIRED_DISTRO_FEATURES = "systemd"
SRC_URI += " \
file://touchscreen.rules \
file://00-create-volatile.conf \
- file://basic.conf.in \
${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
file://init \
@@ -28,6 +27,7 @@ SRC_URI += " \
file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
file://27254.patch \
file://27253.patch \
+ file://0029-sysusersd-Change-the-user-root-s-home-direct.patch \
"
# patches needed by musl
@@ -253,10 +253,6 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
# The 60 seconds is watchdog's default vaule.
WATCHDOG_TIMEOUT ??= "60"
-do_configure:prepend() {
- sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
-}
-
do_install() {
meson_do_install
install -d ${D}/${base_sbindir}
@@ -368,6 +364,11 @@ do_install() {
sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
${D}/${sysconfdir}/systemd/system.conf
fi
+
+ # The root home directory specified in sysusers.d/ was patched to
+ # `:ROOT_HOME:`. Change now to the correct path given by ${ROOT_HOME}.
+ [ ! -f ${D}${libdir}/sysusers.d/basic.conf ] ||
+ sed -i s@:ROOT_HOME:@${ROOT_HOME}@g ${D}${libdir}/sysusers.d/basic.conf
}
python populate_packages:prepend (){
---
base-commit: 23d9e2e210f18401ac669a930f2328aefacdc925
change-id: 20230726-sysusers_root-adb4c6b4cd05
Best regards,
--
Louis Rannou <lrannou@baylibre.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [OE-core] [PATCH] systemd: sysusersd: change how the root home directory is set
2023-07-27 9:28 [PATCH] systemd: sysusersd: change how the root home directory is set Louis Rannou
@ 2023-08-06 20:07 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2023-08-06 20:07 UTC (permalink / raw)
To: Louis Rannou; +Cc: openembedded-core, Qi.Chen, tgamblin, Peter Kjellerstedt
Hi,
As we now merged the upgrade to v254, can you rebase?
On 27/07/2023 11:28:37+0200, Louis Rannou wrote:
> Modifying the sources brings troubles in the devtool command. Therefore it is
> better to patch the source with a custom variable, and later replace it with the
> correct root path.
>
> Suggestion from :
> <https://lore.kernel.org/all/DB5PR02MB102137939DE6D43E423A9D296EF03A@DB5PR02MB10213.eurprd02.prod.outlook.com/>
>
> Signed-off-by: Louis Rannou <lrannou@baylibre.com>
> Suggested-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
> ...usersd-Change-the-user-root-s-home-direct.patch | 32 ++++++++++++++++++++++
> meta/recipes-core/systemd/systemd_253.3.bb | 11 ++++----
> 2 files changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/meta/recipes-core/systemd/systemd/0029-sysusersd-Change-the-user-root-s-home-direct.patch b/meta/recipes-core/systemd/systemd/0029-sysusersd-Change-the-user-root-s-home-direct.patch
> new file mode 100644
> index 0000000000..738413ec93
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd/0029-sysusersd-Change-the-user-root-s-home-direct.patch
> @@ -0,0 +1,32 @@
> +From bf97001978cdefad644f7b4b909f281368e5a4dd Mon Sep 17 00:00:00 2001
> +From: Kas User <kas@example.com>
> +Date: Thu, 27 Jul 2023 08:23:06 +0000
> +Subject: [PATCH] sysusers.d: Change the user root's home directory
> +
> +The default sysusers basic.conf.in file sets the root home directory to `/root`
> +and does not permit its configuration. Change this to `:ROOT_HOME:` which must
> +be set before the installation.
> +
> +The upstream considers the root home directory should not be changed
> +<https://github.com/systemd/systemd/issues/27959>
> +
> +Upstream-Status: Denied
> +Signed-off-by: Louis Rannou <lrannou@baylibre.com>
> +---
> + sysusers.d/basic.conf.in | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/sysusers.d/basic.conf.in b/sysusers.d/basic.conf.in
> +index 0aec080a4c..f26c224341 100644
> +--- a/sysusers.d/basic.conf.in
> ++++ b/sysusers.d/basic.conf.in
> +@@ -7,7 +7,7 @@
> +
> + # The superuser
> + g root 0 - -
> +-u root 0:0 "Super User" /root
> ++u root 0:0 "Super User" :ROOT_HOME:
> +
> + # The nobody user/group for NFS file systems
> + g {{NOBODY_GROUP_NAME}} 65534 - -
> +
> diff --git a/meta/recipes-core/systemd/systemd_253.3.bb b/meta/recipes-core/systemd/systemd_253.3.bb
> index cf0e17ff00..0f96140025 100644
> --- a/meta/recipes-core/systemd/systemd_253.3.bb
> +++ b/meta/recipes-core/systemd/systemd_253.3.bb
> @@ -17,7 +17,6 @@ REQUIRED_DISTRO_FEATURES = "systemd"
> SRC_URI += " \
> file://touchscreen.rules \
> file://00-create-volatile.conf \
> - file://basic.conf.in \
> ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
> ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
> file://init \
> @@ -28,6 +27,7 @@ SRC_URI += " \
> file://0004-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch \
> file://27254.patch \
> file://27253.patch \
> + file://0029-sysusersd-Change-the-user-root-s-home-direct.patch \
> "
>
> # patches needed by musl
> @@ -253,10 +253,6 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
> # The 60 seconds is watchdog's default vaule.
> WATCHDOG_TIMEOUT ??= "60"
>
> -do_configure:prepend() {
> - sed s@:ROOT_HOME:@${ROOT_HOME}@g ${WORKDIR}/basic.conf.in > ${S}/sysusers.d/basic.conf.in
> -}
> -
> do_install() {
> meson_do_install
> install -d ${D}/${base_sbindir}
> @@ -368,6 +364,11 @@ do_install() {
> sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
> ${D}/${sysconfdir}/systemd/system.conf
> fi
> +
> + # The root home directory specified in sysusers.d/ was patched to
> + # `:ROOT_HOME:`. Change now to the correct path given by ${ROOT_HOME}.
> + [ ! -f ${D}${libdir}/sysusers.d/basic.conf ] ||
> + sed -i s@:ROOT_HOME:@${ROOT_HOME}@g ${D}${libdir}/sysusers.d/basic.conf
> }
>
> python populate_packages:prepend (){
>
> ---
> base-commit: 23d9e2e210f18401ac669a930f2328aefacdc925
> change-id: 20230726-sysusers_root-adb4c6b4cd05
>
> Best regards,
> --
> Louis Rannou <lrannou@baylibre.com>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#184925): https://lists.openembedded.org/g/openembedded-core/message/184925
> Mute This Topic: https://lists.openembedded.org/mt/100387322/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-06 20:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27 9:28 [PATCH] systemd: sysusersd: change how the root home directory is set Louis Rannou
2023-08-06 20:07 ` [OE-core] " Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox