[OE-core] [PATCHv2] systemd: enable KeepConfiguration= when running on network filesystem
This fix boot from NFS for systemd enabled systems. Previously systemd-networkd dropped network configuration on exit from initrd even if there're NFS mount. Bug-Url: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14708 Signed-off-by: Pavel Zhukov --- ...eepConfiguration-when-running-on-net.patch | 253 ++ meta/recipes-core/systemd/systemd_250.3.bb| 1 + 2 files changed, 254 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch diff --git a/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch new file mode 100644 index 00..782b9645cb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch @@ -0,0 +1,253 @@ +From 6f4e84126aaa4e26cb6865b054ea5ddebd3906e5 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Thu, 3 Feb 2022 12:14:19 +0900 +Subject: [PATCH] network: enable KeepConfiguration= when running on network + filesystem +Cc: pa...@zhukoff.net + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/22383] +[YOCTO #14708] + +network-generator: rename DHCP_TYPE_DHCP -> DHCP_TYPE_DHCP4 + +To emphasize this is DHCPv4. No behavior is changed. + +stat-util: introduce path_is_network_fs() + +network: enable KeepConfiguration= when running on network filesystem + +Also, set KeepConfiguration=dhcp-on-stop by default when running in +initrd. + +Fixes #21967. +--- + man/systemd.network.xml | 6 +++-- + src/basic/stat-util.c | 9 +++ + src/basic/stat-util.h | 1 + + src/network/generator/network-generator.c | 4 ++-- + src/network/generator/network-generator.h | 2 +- + src/network/networkd-manager.c| 29 +++ + src/network/networkd-manager.h| 2 ++ + src/network/networkd-network.c| 12 ++ + src/network/test-networkd-conf.c | 5 + 9 files changed, 60 insertions(+), 10 deletions(-) + +diff --git a/man/systemd.network.xml b/man/systemd.network.xml +index af431e4f2c..f90cff4cd6 100644 +--- a/man/systemd.network.xml b/man/systemd.network.xml +@@ -944,8 +944,10 @@ Table=1234 + lease expires. This is contrary to the DHCP specification, but may be the best choice if, + e.g., the root filesystem relies on this connection. The setting dhcp + implies dhcp-on-stop, and yes implies +- dhcp and static. Defaults to no. +- ++ dhcp and static. Defaults to ++ dhcp-on-stop when systemd-networkd is running in ++ initrd, yes when the root filesystem is a network filesystem, and ++ no otherwise. + + + +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index efac7b002e..c2269844f8 100644 +--- a/src/basic/stat-util.c b/src/basic/stat-util.c +@@ -249,6 +249,15 @@ int path_is_temporary_fs(const char *path) { + return is_temporary_fs(&s); + } + ++int path_is_network_fs(const char *path) { ++struct statfs s; ++ ++if (statfs(path, &s) < 0) ++return -errno; ++ ++return is_network_fs(&s); ++} ++ + int stat_verify_regular(const struct stat *st) { + assert(st); + +diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h +index a566114f7c..f7d2f12aa9 100644 +--- a/src/basic/stat-util.h b/src/basic/stat-util.h +@@ -53,6 +53,7 @@ int fd_is_temporary_fs(int fd); + int fd_is_network_fs(int fd); + + int path_is_temporary_fs(const char *path); ++int path_is_network_fs(const char *path); + + /* Because statfs.t_type can be int on some architectures, we have to cast + * the const magic to the type, otherwise the compiler warns about +diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +index c081ec673c..063ad08d80 100644 +--- a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +@@ -47,7 +47,7 @@ static const char * const dracut_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "off", + [DHCP_TYPE_ON] = "on", + [DHCP_TYPE_ANY] = "any", +-[DHCP_TYPE_DHCP]= "dhcp", ++[DHCP_TYPE_DHCP4] = "dhcp", + [DHCP_TYPE_DHCP6] = "dhcp6", + [DHCP_TYPE_AUTO6] = "auto6", + [DHCP_TYPE_EITHER6] = "either6", +@@ -62,7 +62,7 @@ static const char * const networkd_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "no", + [DHCP_TYPE_ON] = "yes", + [DHCP_TYPE_ANY] = "yes", +-[DHCP_TYPE_DHCP]= "ipv4", ++[DHCP_TYPE_DHCP4] = "ipv4", + [DHCP_TYPE_DHCP6] = "ipv6", + [DHCP_TYPE_AUTO6] = "no", /* TODO: enable other setting? */ + [DHCP_TYPE_EITHER6] =
[OE-core] [PATCH] systemd: enable KeepConfiguration= when running on network filesystem
This fix boot from NFS for systemd enabled systems. Previously systemd-networkd dropped network configuration on exit from initrd even if there're NFS mount. Bug-Url: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14708 Signed-off-by: Pavel Zhukov --- ...eepConfiguration-when-running-on-net.patch | 253 ++ meta/recipes-core/systemd/systemd_250.3.bb| 1 + 2 files changed, 254 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch diff --git a/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch new file mode 100644 index 00..4943a0fe5c --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch @@ -0,0 +1,253 @@ +From 6f4e84126aaa4e26cb6865b054ea5ddebd3906e5 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Thu, 3 Feb 2022 12:14:19 +0900 +Subject: [PATCH] network: enable KeepConfiguration= when running on network + filesystem +Cc: pa...@zhukoff.net + +Upstream-Status: Pending +Upstream-Url: https://github.com/systemd/systemd/pull/22383/commits + +network-generator: rename DHCP_TYPE_DHCP -> DHCP_TYPE_DHCP4 + +To emphasize this is DHCPv4. No behavior is changed. + +stat-util: introduce path_is_network_fs() + +network: enable KeepConfiguration= when running on network filesystem + +Also, set KeepConfiguration=dhcp-on-stop by default when running in +initrd. + +Fixes #21967. +--- + man/systemd.network.xml | 6 +++-- + src/basic/stat-util.c | 9 +++ + src/basic/stat-util.h | 1 + + src/network/generator/network-generator.c | 4 ++-- + src/network/generator/network-generator.h | 2 +- + src/network/networkd-manager.c| 29 +++ + src/network/networkd-manager.h| 2 ++ + src/network/networkd-network.c| 12 ++ + src/network/test-networkd-conf.c | 5 + 9 files changed, 60 insertions(+), 10 deletions(-) + +diff --git a/man/systemd.network.xml b/man/systemd.network.xml +index af431e4f2c..f90cff4cd6 100644 +--- a/man/systemd.network.xml b/man/systemd.network.xml +@@ -944,8 +944,10 @@ Table=1234 + lease expires. This is contrary to the DHCP specification, but may be the best choice if, + e.g., the root filesystem relies on this connection. The setting dhcp + implies dhcp-on-stop, and yes implies +- dhcp and static. Defaults to no. +- ++ dhcp and static. Defaults to ++ dhcp-on-stop when systemd-networkd is running in ++ initrd, yes when the root filesystem is a network filesystem, and ++ no otherwise. + + + +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index efac7b002e..c2269844f8 100644 +--- a/src/basic/stat-util.c b/src/basic/stat-util.c +@@ -249,6 +249,15 @@ int path_is_temporary_fs(const char *path) { + return is_temporary_fs(&s); + } + ++int path_is_network_fs(const char *path) { ++struct statfs s; ++ ++if (statfs(path, &s) < 0) ++return -errno; ++ ++return is_network_fs(&s); ++} ++ + int stat_verify_regular(const struct stat *st) { + assert(st); + +diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h +index a566114f7c..f7d2f12aa9 100644 +--- a/src/basic/stat-util.h b/src/basic/stat-util.h +@@ -53,6 +53,7 @@ int fd_is_temporary_fs(int fd); + int fd_is_network_fs(int fd); + + int path_is_temporary_fs(const char *path); ++int path_is_network_fs(const char *path); + + /* Because statfs.t_type can be int on some architectures, we have to cast + * the const magic to the type, otherwise the compiler warns about +diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +index c081ec673c..063ad08d80 100644 +--- a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +@@ -47,7 +47,7 @@ static const char * const dracut_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "off", + [DHCP_TYPE_ON] = "on", + [DHCP_TYPE_ANY] = "any", +-[DHCP_TYPE_DHCP]= "dhcp", ++[DHCP_TYPE_DHCP4] = "dhcp", + [DHCP_TYPE_DHCP6] = "dhcp6", + [DHCP_TYPE_AUTO6] = "auto6", + [DHCP_TYPE_EITHER6] = "either6", +@@ -62,7 +62,7 @@ static const char * const networkd_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "no", + [DHCP_TYPE_ON] = "yes", + [DHCP_TYPE_ANY] = "yes", +-[DHCP_TYPE_DHCP]= "ipv4", ++[DHCP_TYPE_DHCP4] = "ipv4", + [DHCP_TYPE_DHCP6] = "ipv6", + [DHCP_TYPE_AUTO6] = "no", /* TODO: enable other setting? */ + [DHCP_TYPE_EITHER6
Re: [OE-core] [PATCH] runqemu: preload uninative libraries when host gl drivers are in use
On Fri, 2022-02-04 at 21:40 +0100, Alexander Kanavin wrote: > Some of the host distributions build the drivers in a way (RPATH/RUNPATH) > that tricks uninative loader into loading pieces of the host libc, if > the same pieces haven't been previously loaded by native binaries. Mixing > the two libc versions leads to failures. > > This change ensures that the correct (uninative) versions are always in use. > > Signed-off-by: Alexander Kanavin > --- > meta/classes/qemuboot.bbclass | 2 +- > scripts/runqemu | 4 > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass > index cc1cbce69d..229bd88527 100644 > --- a/meta/classes/qemuboot.bbclass > +++ b/meta/classes/qemuboot.bbclass > @@ -109,7 +109,7 @@ def qemuboot_vars(d): > build_vars = ['MACHINE', 'TUNE_ARCH', 'DEPLOY_DIR_IMAGE', > 'KERNEL_IMAGETYPE', 'IMAGE_NAME', 'IMAGE_LINK_NAME', > 'STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE', > -'STAGING_DIR_HOST', 'SERIAL_CONSOLES'] > +'STAGING_DIR_HOST', 'SERIAL_CONSOLES', 'UNINATIVE_LOADER'] > return build_vars + [k for k in d.keys() if k.startswith('QB_')] > > do_write_qemuboot_conf[vardeps] += "${@' '.join(qemuboot_vars(d))}" > diff --git a/scripts/runqemu b/scripts/runqemu > index 4e05c1bb15..7d1f85f357 100755 > --- a/scripts/runqemu > +++ b/scripts/runqemu > @@ -460,6 +460,10 @@ class BaseConfig(object): > except subprocess.CalledProcessError as e: > raise RunQemuError("Could not determine the path to dri drivers > on the host via pkg-config.\nPlease install Mesa development files > (particularly, dri.pc) on the host machine.") > os.environ['LIBGL_DRIVERS_PATH'] = dripath.decode('utf-8').strip() > +uninative_path = os.path.dirname(self.get("UNINATIVE_LOADER")) > +preload_items = ['libdl.so.2', 'librt.so.1', 'libpthread.so.0'] > +preload_paths = [os.path.join(uninative_path, i) for i in > preload_items] > +os.environ['LD_PRELOAD'] = " ".join(preload_paths) > This looks like a good way to work around this corner case and I don't see any other alternative. Can I ask that: a) we put some comment into the code so we can understand this in a couple of years time as it is a rather weird corner case b) we put some "if os.path.exists()" in there, maybe even just on the uninnative loader direction so that in the non-uninative case we don't throw warnings? Cheers, Richard -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#161389): https://lists.openembedded.org/g/openembedded-core/message/161389 Mute This Topic: https://lists.openembedded.org/mt/88916306/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] systemd_create_users broken even more
On Fri, 2022-02-04 at 18:53 -0800, Chuck Wolber wrote: > > When relying on useradd-staticids, this commit [1] made the problems that this > [2] bug causes, much worse. Prior to that commit we could predict with > surprising accuracy what the UID and GID would be for the very small number of > systemd-* accounts that were created (or simply patch the expected UID/GID > values in, but that never became necessary). After that commit, a bunch of > system accounts and groups get created with the wrong UID and/or GID. > > I suppose this is an opportunity to implement BZ9789. But since this issue is > so old it either means it was forgotten, or it is really hard in some non- > obvious way. Is there any insight available into which it is? I don't think staticids are used that heavily and maybe not with systemd so I suspect that it is just that nobody has spotted this issue. It doesn't sound too hard to fix. We're at a weird point with the project where many things were solved in the past but the people and processes who solved those issues aren't there anymore. We continue to make great progress in many areas but some issues are slipping through the cracks. We do have new policies in place about tests and so on but given the diverse uses of the project, there is only so much which can be practically done with our current resourcing (from the community, membership and otherwise). > The solution seems pretty straight forward, so that pretty much guarantees I > am missing something important. In the systemd_create_users function inherit > extrausers, set the appropriate variables, call set_user_group directly, and > then remove set_user_group from ROOTFS_POSTPROCESS_COMMAND. > > So where did I go wrong there? > > Also, does it make sense to return from systemd_create_users early if read- > only-rootfs is *NOT* in IMAGE_FEATURES? I'd imagine we'd prefer to do this "pre-processing" at build time if we can and save it happening on every target device even if read-write. Cheers, Richard -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#161388): https://lists.openembedded.org/g/openembedded-core/message/161388 Mute This Topic: https://lists.openembedded.org/mt/88922422/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-