Skip to contentSkip to conversation

systemd and nios2 fixes

PATCH In review Khem Raj 5 participants 16 messages May 18, 2016 – Sep 29, 2016

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover systemd and nios2 fixes

These patches address the useradd problem which was exposed by the systemd useradd patch.

Additionally, few patches to help packages build with nios2

Khem Raj (3):
useradd.bbclass: Strip trailing ';' in cmd params
systemd: Create missing sysusers offline
pixman: Fix build on arches not defining FE_INVALID exception

Marek Vasut (2):
kernel: fitimage: Repair misuse of shell test command
sysprof: Disable nios2 support

 meta/classes/kernel-fitimage.bbclass               |  2 +-
 meta/classes/useradd.bbclass                       |  2 +-
 .../packagegroup-core-tools-profile.bb             |  3 +-
 meta/recipes-core/systemd/systemd_229.bb           |  8 +++++-
 ...Check-for-FE_INVALID-definition-before-us.patch | 33 ++++++++++++++++++++++
 meta/recipes-graphics/xorg-lib/pixman_0.34.0.bb    |  1 +
 6 files changed, 45 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-graphics/xorg-lib/pixman/0001-test-utils-Check-for-FE_INVALID-definition-before-us.patch
Signature · 1 line
2.8.2
author
#1 lore raw

PATCH 1/5 useradd.bbclass: Strip trailing '; ' in cmd params

When there are more than 1 packages in a recipe requiring useradd services, they are concatnated and a ';' is inserted just after each of the users being added by the packages. A situation arises in cases where this is controlled by PACKAGECONFIG then we add a ';' separator in the USERADD_PARAM value itself for each packagecofig since we do not know which one will be picked, we end up in situation where the final string returned from get_all_cmd_params() appears to be

a; ; b; c;

and then the logic which uses these cmds triggers with ';' as separator but in this case it will fail after executing useradd 'a' because the next cmd it will call will be just a whitespace

This is highlighted by the systemd patch to add more users as needed by systemd 229 components.

---
 meta/classes/useradd.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/useradd.bbclass +1 -1
index ee402ac..ae27c01 100644
@@ -203,7 +203,7 @@ def get_all_cmd_params(d, cmd_type):
     for pkg in useradd_packages.split():
         param = d.getVar(param_type % pkg, True)
         if param:
-            params.append(param)
+            params.append(param.rstrip(" ;"))
 
     return "; ".join(params)
 
Signature · 1 line
2.8.2
author
#2 lore raw

PATCH 2/5 systemd: Create missing sysusers offline

Some system users which are needed by systemd components were missing create these users knobbed with relevant packageconfig

---
 meta/recipes-core/systemd/systemd_229.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-core/systemd/systemd_229.bb +7 -1
index c23c749..a2d35f8 100644
@@ -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"
 
Signature · 1 line
2.8.2
#3 lore raw

Re: [PATCH 2/5] systemd: Create missing sysusers offline

Quoted 7 lines · Khem Raj

Some system users which are needed by systemd components were missing create these users knobbed with relevant packageconfig

---
 meta/recipes-core/systemd/systemd_229.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

This looks better but there do appear to still be problems:

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd/b
uilds/776/steps/Running%20Sanity%20Tests/logs/stdio

and

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd/b
uilds/776/steps/Running%20Sanity%20Tests_2/logs/stdio

Cheers,

Richard

#4 lore raw

Re: [PATCH 2/5] systemd: Create missing sysusers offline

Quoted 16 lines · Richard Purdie
Quoted 8 lines · Khem Raj

Some system users which are needed by systemd components were missing
create these users knobbed with relevant packageconfig

---
 meta/recipes-core/systemd/systemd_229.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

This looks better but there do appear to still be problems:

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd
/b uilds/776/steps/Running%20Sanity%20Tests/logs/stdio

Quoted 5 lines

and

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd
/b uilds/776/steps/Running%20Sanity%20Tests_2/logs/stdio

Just seen your other email. I'll queue the revised patch in the next -next build.

Cheers,

Richard

#5 lore raw

Re: [PATCH 2/5] systemd: Create missing sysusers offline

Hi,

Quoted 17 lines · Richard Purdie
Quoted 16 lines · Richard Purdie
Quoted 8 lines · Khem Raj

Some system users which are needed by systemd components were missing
create these users knobbed with relevant packageconfig

---
  meta/recipes-core/systemd/systemd_229.bb | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

This looks better but there do appear to still be problems:

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd
/b uilds/776/steps/Running%20Sanity%20Tests/logs/stdio

Quoted 6 lines
Quoted 5 lines

and

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd
/b uilds/776/steps/Running%20Sanity%20Tests_2/logs/stdio

I just stumbled over this issue when building systemd with networkd enabled in krogoth release. Shouldn't this patch be backported to krogoth as well?

Regards, Enrico

Signature · 4 lines
Pengutronix e.K.                           | Enrico Jörns                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
author
#6 lore raw

Re: [PATCH 2/5] systemd: Create missing sysusers offline

Quoted 25 lines · Enrico Joerns

Hi,

Quoted 19 lines · Richard Purdie
Quoted 18 lines · Richard Purdie
Quoted 8 lines · Khem Raj

Some system users which are needed by systemd components were missing
create these users knobbed with relevant packageconfig

---
 meta/recipes-core/systemd/systemd_229.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

This looks better but there do appear to still be problems:

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd
/b uilds/776/steps/Running%20Sanity%20Tests/logs/stdio

and

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd
/b uilds/776/steps/Running%20Sanity%20Tests_2/logs/stdio

I just stumbled over this issue when building systemd with networkd enabled in krogoth release. Shouldn't this patch be backported to krogoth as well?

I think yes. Feel free to send a request to krogoth maintainer.

author
#7 lore raw

PATCH 3/5 pixman: Fix build on arches not defining FE_INVALID exception

In reply to Khem Raj

Nios2 e.g. only supports round to nearest in glibc

---
 ...Check-for-FE_INVALID-definition-before-us.patch | 33 ++++++++++++++++++++++
 meta/recipes-graphics/xorg-lib/pixman_0.34.0.bb    |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta/recipes-graphics/xorg-lib/pixman/0001-test-utils-Check-for-FE_INVALID-definition-before-us.patch
meta/recipes-graphics/xorg-lib/pixman/0001-test-utils-Check-for-FE_INVALID-definition-before-us.patch new file +33 -0
new file mode 100644
index 0000000..782c1db
@@ -0,0 +1,33 @@
+From 0ccd906b904d21536d5ab41c6196760e3e5d72cb Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 17 May 2016 17:30:00 -0700
+Subject: [PATCH] test/utils: Check for FE_INVALID definition before use
+
+Some architectures e.g. nios2 do not support all exceptions
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Submitted
+
+ test/utils.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/test/utils.c b/test/utils.c
+index f8e42a5..fe32b1e 100644
+--- a/test/utils.c
++++ b/test/utils.c
+@@ -978,9 +978,11 @@ enable_invalid_exceptions (void)
+ {
+ #ifdef HAVE_FENV_H
+ #ifdef HAVE_FEENABLEEXCEPT
++#ifdef FE_INVALID
+     feenableexcept (FE_INVALID);
+ #endif
+ #endif
++#endif
+ }
+ 
+ void *
+-- 
+2.8.2
+
meta/recipes-graphics/xorg-lib/pixman_0.34.0.bb +1 -0
index 87da5c2..c4ca621 100644
@@ -32,6 +32,7 @@ EXTRA_OECONF_class-nativesdk = "--disable-gtk"
 SRC_URI += "\
             file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch \
 	    file://asm_include.patch \
+	    file://0001-test-utils-Check-for-FE_INVALID-definition-before-us.patch \
 "
 
 SRC_URI[md5sum] = "002a4fcb644ddfcb4b0e4191576a0d59"
Signature · 1 line
2.8.2
author
#8 lore raw

PATCH 4/5 kernel: fitimage: Repair misuse of shell test command

In reply to Khem Raj

From: Marek Vasut <[email protected]>

The kernel fitImage must be amended with signature if and only if UBOOT_SIGN_ENABLE = 1 . In the current case, the UBOOT_SIGN_ENABLE could be either 0 (default) or 1 , which test -n always correctly interprets as non-empty string, thus always true. This does not match the logic above though, so replace the test with check which passed only for UBOOT_SIGN_ENABLE = 1 .

Cc Yannick Gicquel <[email protected]>
Cc Richard Purdie <[email protected]>
---
 meta/classes/kernel-fitimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/kernel-fitimage.bbclass +1 -1
index 809bd4d..298eda2 100644
@@ -250,7 +250,7 @@ do_assemble_fitimage() {
 		#
 		# Step 5: Sign the image and add public key to U-Boot dtb
 		#
-		if test -n "${UBOOT_SIGN_ENABLE}"; then
+		if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
 			uboot-mkimage \
 				${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
 				-F -k "${UBOOT_SIGN_KEYDIR}" \
Signature · 1 line
2.8.2
author
#9 lore raw

PATCH 5/5 sysprof: Disable nios2 support

In reply to Khem Raj

From: Marek Vasut <[email protected]>

sysprof does not support nios2 yet, so disable it.

Cc Ley Foon Tan <[email protected]>
Cc Richard Purdie <[email protected]>
Cc Ross Burton <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Walter Goossens <[email protected]>
---
 meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb +2 -1
index 5a8ee58..55e9c6f 100644
@@ -11,8 +11,9 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 inherit packagegroup
 
 PROFILE_TOOLS_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'sysprof', '', d)}"
-# sysprof doesn't support aarch64
+# sysprof doesn't support aarch64 and nios2
 PROFILE_TOOLS_X_aarch64 = ""
+PROFILE_TOOLS_X_nios2 = ""
 PROFILE_TOOLS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-analyze', '', d)}"
 
 RRECOMMENDS_${PN} = "\
Signature · 1 line
2.8.2
author
#10 lore raw

Re: [PATCH 1/5] useradd.bbclass: Strip trailing '; ' in cmd params

In reply to Khem Raj

This fix was not sufficient and there has to be extra fix done to also consider the case
when sysroot is created during image build time. I have updated it in pull request here

http://git.openembedded.org/openembedded-core-contrib/commit/?h=kraj/pu&id=642c6cf0b6a0371de476513162bd0cefa9c438b3

Quoted 38 lines · Khem Raj

When there are more than 1 packages in a recipe requiring useradd services, they are concatnated and a ';' is inserted just after each of the users being added by the packages. A situation arises in cases where this is controlled by PACKAGECONFIG then we add a ';' separator in the USERADD_PARAM value itself for each packagecofig since we do not know which one will be picked, we end up in situation where the final string returned from get_all_cmd_params() appears to be

a; ; b; c;

and then the logic which uses these cmds triggers with ';' as separator but in this case it will fail after executing useradd 'a' because the next cmd it will call will be just a whitespace

This is highlighted by the systemd patch to add more users as needed by systemd 229 components.

---
 meta/classes/useradd.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/useradd.bbclass +1 -2
index ee402ac..ae27c01 100644
@@ -203,7 +203,7 @@ def get_all_cmd_params(d, cmd_type):
     for pkg in useradd_packages.split():
         param = d.getVar(param_type % pkg, True)
         if param:
-            params.append(param)
+            params.append(param.rstrip(" ;"))
 
     return "; ".join(params)
 
--

2.8.2

#11 lore raw

Re: [PATCH 1/5] useradd.bbclass: Strip trailing '; ' in cmd params

Quoted 6 lines · Khem Raj

This fix was not sufficient and there has to be extra fix done to also consider the case
when sysroot is created during image build time. I have updated it in pull request here

http://git.openembedded.org/openembedded-core-contrib/commit/?h=kraj/pu&id=642c6cf0b6a0371de476513162bd0cefa9c438b3

That now fails for cases where the USERADD_PARAM ends in trailing white space after the last valid opts. The reason is that the 'if test "x $opts" = "x$remaining"; then break; fi' check does not get triggered anymore, because $remaining has the trailing white space whereas "$opts" does not.

I'm not sure what the best approach is in this case. Perhaps also strip trailing whitespace from all assignments to $remaining?

The case were we see this is:
USERADD_PARAM_iot-rest-api-server="--system --home /var/lib/empty --no-create-home --shell /bin/false --gid restful restful "

The build then hangs because the useradd preinst loops forever.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
#12 lore raw

Re: [PATCH 1/5] useradd.bbclass: Strip trailing '; ' in cmd params

Quoted 23 lines · Patrick Ohly
Quoted 9 lines · Khem Raj

This fix was not sufficient and there has to be extra fix done to also
consider the case
when sysroot is created during image build time. I have updated it in
pull request here

http://git.openembedded.org/openembedded-core-contrib/commit/?h=kra
j/pu&id=642c6cf0b6a0371de476513162bd0cefa9c438b3

That now fails for cases where the USERADD_PARAM ends in trailing white
space after the last valid opts. The reason is that the 'if test "x $opts" = "x$remaining"; then break; fi' check does not get triggered anymore, because $remaining has the trailing white space whereas "$opts"
does not.

I'm not sure what the best approach is in this case. Perhaps also strip
trailing whitespace from all assignments to $remaining?

Quoted 5 lines

The case were we see this is:
USERADD_PARAM_iot-rest-api-server="--system --home /var/lib/empty - -no-create-home --shell /bin/false --gid restful restful "

The build then hangs because the useradd preinst loops forever.

I've posted a patch which addresses this issue since its pretty nasty for people to run into.

Cheers,

Richard

#13 lore raw

Re: [PATCH 1/5] useradd.bbclass: Strip trailing '; ' in cmd params

Quoted 24 lines · Richard Purdie
Quoted 23 lines · Patrick Ohly
Quoted 9 lines · Khem Raj

This fix was not sufficient and there has to be extra fix done to also
consider the case
when sysroot is created during image build time. I have updated it in
pull request here

http://git.openembedded.org/openembedded-core-contrib/commit/?h=kra
j/pu&id=642c6cf0b6a0371de476513162bd0cefa9c438b3

That now fails for cases where the USERADD_PARAM ends in trailing white
space after the last valid opts. The reason is that the 'if test "x $opts" = "x$remaining"; then break; fi' check does not get triggered anymore, because $remaining has the trailing white space whereas "$opts"
does not.

I'm not sure what the best approach is in this case. Perhaps also strip
trailing whitespace from all assignments to $remaining?

Quoted 8 lines
Quoted 5 lines

The case were we see this is:
USERADD_PARAM_iot-rest-api-server="--system --home /var/lib/empty - -no-create-home --shell /bin/false --gid restful restful "

The build then hangs because the useradd preinst loops forever.

I've posted a patch which addresses this issue since its pretty nasty for people to run into.

This now has been merged to krogoth and I get vsftpd preinst hanging forever - has everything related been picked up during backport or something got missed?

Signature · 1 line
Denys
#14 lore raw

Re: [PATCH 1/5] useradd.bbclass: Strip trailing '; ' in cmd params

Quoted 29 lines · Denys Dmytriyenko
Quoted 28 lines · Richard Purdie
Quoted 27 lines · Patrick Ohly
Quoted 9 lines · Khem Raj

This fix was not sufficient and there has to be extra fix done to also
consider the case
when sysroot is created during image build time. I have updated it in
pull request here

http://git.openembedded.org/openembedded-core-contrib/commit/?h=kra
j/pu&id=642c6cf0b6a0371de476513162bd0cefa9c438b3

That now fails for cases where the USERADD_PARAM ends in trailing white
space after the last valid opts. The reason is that the 'if test "x $opts" = "x$remaining"; then break; fi' check does not get triggered anymore, because $remaining has the trailing white space whereas "$opts"
does not.

I'm not sure what the best approach is in this case. Perhaps also strip
trailing whitespace from all assignments to $remaining?

The case were we see this is:
USERADD_PARAM_iot-rest-api-server="--system --home /var/lib/empty - -no-create-home --shell /bin/false --gid restful restful "

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

The build then hangs because the useradd preinst loops forever.

I've posted a patch which addresses this issue since its pretty nasty for people to run into.

This now has been merged to krogoth and I get vsftpd preinst hanging forever - has everything related been picked up during backport or something got missed?

Ok, it seems this change hasn't been picked up:

http://cgit.openembedded.org/openembedded-core/commit/meta/classes/useradd.bbclass?id=d6241e4c94a0a72acfc57e96a59918c0b2146d65

Signature · 1 line
Denys
#15 lore raw

Re: [PATCH 1/5] useradd.bbclass: Strip trailing '; ' in cmd params

Quoted 35 lines · Denys Dmytriyenko
Quoted 34 lines · Denys Dmytriyenko
Quoted 32 lines · Richard Purdie
Quoted 23 lines · Patrick Ohly
Quoted 9 lines · Khem Raj

This fix was not sufficient and there has to be extra fix done to also
consider the case
when sysroot is created during image build time. I have updated it in
pull request here

http://git.openembedded.org/openembedded-core-contrib/commit/?h=kra
j/pu&id=642c6cf0b6a0371de476513162bd0cefa9c438b3

That now fails for cases where the USERADD_PARAM ends in trailing white
space after the last valid opts. The reason is that the 'if test "x $opts" = "x$remaining"; then break; fi' check does not get triggered anymore, because $remaining has the trailing white space whereas "$opts"
does not.

I'm not sure what the best approach is in this case. Perhaps also strip
trailing whitespace from all assignments to $remaining?

Quoted 5 lines

The case were we see this is:
USERADD_PARAM_iot-rest-api-server="--system --home /var/lib/empty - -no-create-home --shell /bin/false --gid restful restful "

The build then hangs because the useradd preinst loops forever.

I've posted a patch which addresses this issue since its pretty nasty for people to run into.

Quoted 6 lines
Quoted 2 lines

This now has been merged to krogoth and I get vsftpd preinst hanging forever - has everything related been picked up during backport or something got missed?

Ok, it seems this change hasn't been picked up:

http://cgit.openembedded.org/openembedded-core/commit/meta/classes/useradd.bbclass?id=d6241e4c94a0a72acfc57e96a59918c0b2146d65

Ok, this fixes my problem with vsftpd - I sent a patch to backport this commit into krogoth.

Signature · 1 line
Denys