Message ID | 20240816140422.1665537-1-niko.mauno@vaisala.com |
---|---|
State | New |
Headers | show |
Series | util-linux: Add 'no-libmount-mountfd' PACKAGECONFIG option | expand |
On Fri, 16 Aug 2024 at 16:04, Niko Mauno via lists.openembedded.org <niko.mauno=vaisala.com@lists.openembedded.org> wrote: > Taking the above findings into consideration, add a new PACKAGECONFIG > option which allows to conveniently opt-out from prematurely using a > feature which can cause issues with a bit older kernels. > +PACKAGECONFIG[no-libmount-mountfd] = "--disable-libmount-mountfd-support" The option's definition should include both enabling and disabling options so that the resulting component configuration is deterministic (e.g. not left to autodetection by upstream) both when it's enabled and when it is not. It also helps to add a comment just above explaining that only the newer kernels have the required API, and ideally also mention which is the minimum required kernel version. Alex
On 16.8.2024 17.24, Alexander Kanavin wrote: > On Fri, 16 Aug 2024 at 16:04, Niko Mauno via lists.openembedded.org > <niko.mauno=vaisala.com@lists.openembedded.org> wrote: > >> Taking the above findings into consideration, add a new PACKAGECONFIG >> option which allows to conveniently opt-out from prematurely using a >> feature which can cause issues with a bit older kernels. >> +PACKAGECONFIG[no-libmount-mountfd] = "--disable-libmount-mountfd-support" > > The option's definition should include both enabling and disabling > options so that the resulting component configuration is deterministic > (e.g. not left to autodetection by upstream) both when it's enabled > and when it is not. It also helps to add a comment just above > explaining that only the newer kernels have the required API, and > ideally also mention which is the minimum required kernel version. Thanks, submitted v2 which addresses aforementioned aspects, and also now defaults to disabling the new mount API by default. -Niko
I'm a little concerned about this patch because PACKAGECONFIG like this is likely to sit there forever. The master branch's kernel version is at least 6.6. So this patch does not have any effect for master branch, right? If this PACKAGECONFIG is added, when should we remove it? Also, if the automatic detection codes determine util-linux could build with mountfd support, but it fails at runtime, then it sounds like something to fix for the auto detection codes in configure.ac/meson.build. So if we really want to improve something, maybe we should work with the util-linux community to add more checks about mountfd. Maybe start by filing an issue for util-linux? Regards, Qi On 8/16/24 22:04, Niko Mauno via lists.openembedded.org wrote: > The 2.39 version of util-linux took new file descriptors based mount > kernel API into use. In relation to this change, the upstream release > notes in > https://github.com/util-linux/util-linux/blob/v2.39/Documentation/releases/v2.39-ReleaseNotes#L14-L21 > mention that > > This change is very aggressive to libmount code, but hopefully, it does not introduce regressions in traditional mount(8) behavior. > > While testing with a board using a 6.1 version kernel, an initramfs > rootfs based boot flow contains the error > > [FAILED] Failed to start Remount Root and Kernel File Systems. > See 'systemctl status systemd-remount-fs.service' for details. > > on closer inspection: > > demoboard ~ # systemctl status -l systemd-remount-fs.service > x systemd-remount-fs.service - Remount Root and Kernel File Systems > Loaded: loaded (/usr/lib/systemd/system/systemd-remount-fs.service; enabled-runtime; preset: disabled) > Active: failed (Result: exit-code) since Wed 2024-08-14 14:53:48 UTC; 1min 22s ago > Docs: man:systemd-remount-fs.service(8) > https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems > Process: 76 ExecStart=/usr/lib/systemd/systemd-remount-fs (code=exited, status=1/FAILURE) > Main PID: 76 (code=exited, status=1/FAILURE) > > Aug 14 14:53:48 demoboard systemd-remount-fs[76]: /usr/bin/mount for / exited with exit status 32. > Aug 14 14:53:48 demoboard systemd-remount-fs[81]: mount: /: mount point not mounted or bad option. > Aug 14 14:53:48 demoboard systemd-remount-fs[81]: dmesg(1) may have more information after failed mount system call. > Aug 14 14:53:48 demoboard systemd[1]: systemd-remount-fs.service: Main process exited, code=exited, status=1/FAILURE > Aug 14 14:53:48 demoboard systemd[1]: systemd-remount-fs.service: Failed with result 'exit-code'. > Aug 14 14:53:48 demoboard systemd[1]: Failed to start Remount Root and Kernel File Systems. > > also consequentially, 'systemctl status' reported: > > State: degraded > > When issuing 'strace -ff mount -o remount /' the failure occurs at > > mount_setattr(3, "", AT_EMPTY_PATH, {attr_set=MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOATIME|MOUNT_ATTR_NODIRATIME, attr_clr=MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_NOATIME|MOUNT_ATTR_STRICTATIME|MOUNT_ATTR_NOSYMFOLLOW|0x40, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EINVAL (Invalid argument) > > however the failure didn't occur when using qemuarm64 with 6.6 version > kernel to boot a corresponding initramfs image, in that case the exact > same call under strace returned 0. > > Taking the above findings into consideration, add a new PACKAGECONFIG > option which allows to conveniently opt-out from prematurely using a > feature which can cause issues with a bit older kernels. > > Signed-off-by: Niko Mauno <niko.mauno@vaisala.com> > --- > meta/recipes-core/util-linux/util-linux_2.40.1.bb | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/meta/recipes-core/util-linux/util-linux_2.40.1.bb b/meta/recipes-core/util-linux/util-linux_2.40.1.bb > index a1aab94055..3ecc55f61e 100644 > --- a/meta/recipes-core/util-linux/util-linux_2.40.1.bb > +++ b/meta/recipes-core/util-linux/util-linux_2.40.1.bb > @@ -107,6 +107,7 @@ PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" > PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh," > PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" > PACKAGECONFIG[lastlog2] = "--enable-liblastlog2,--disable-liblastlog2,sqlite3" > +PACKAGECONFIG[no-libmount-mountfd] = "--disable-libmount-mountfd-support" > > EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#203466): https://lists.openembedded.org/g/openembedded-core/message/203466 > Mute This Topic: https://lists.openembedded.org/mt/107932364/7304865 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Qi.Chen@eng.windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/recipes-core/util-linux/util-linux_2.40.1.bb b/meta/recipes-core/util-linux/util-linux_2.40.1.bb index a1aab94055..3ecc55f61e 100644 --- a/meta/recipes-core/util-linux/util-linux_2.40.1.bb +++ b/meta/recipes-core/util-linux/util-linux_2.40.1.bb @@ -107,6 +107,7 @@ PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh," PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" PACKAGECONFIG[lastlog2] = "--enable-liblastlog2,--disable-liblastlog2,sqlite3" +PACKAGECONFIG[no-libmount-mountfd] = "--disable-libmount-mountfd-support" EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
The 2.39 version of util-linux took new file descriptors based mount kernel API into use. In relation to this change, the upstream release notes in https://github.com/util-linux/util-linux/blob/v2.39/Documentation/releases/v2.39-ReleaseNotes#L14-L21 mention that This change is very aggressive to libmount code, but hopefully, it does not introduce regressions in traditional mount(8) behavior. While testing with a board using a 6.1 version kernel, an initramfs rootfs based boot flow contains the error [FAILED] Failed to start Remount Root and Kernel File Systems. See 'systemctl status systemd-remount-fs.service' for details. on closer inspection: demoboard ~ # systemctl status -l systemd-remount-fs.service x systemd-remount-fs.service - Remount Root and Kernel File Systems Loaded: loaded (/usr/lib/systemd/system/systemd-remount-fs.service; enabled-runtime; preset: disabled) Active: failed (Result: exit-code) since Wed 2024-08-14 14:53:48 UTC; 1min 22s ago Docs: man:systemd-remount-fs.service(8) https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems Process: 76 ExecStart=/usr/lib/systemd/systemd-remount-fs (code=exited, status=1/FAILURE) Main PID: 76 (code=exited, status=1/FAILURE) Aug 14 14:53:48 demoboard systemd-remount-fs[76]: /usr/bin/mount for / exited with exit status 32. Aug 14 14:53:48 demoboard systemd-remount-fs[81]: mount: /: mount point not mounted or bad option. Aug 14 14:53:48 demoboard systemd-remount-fs[81]: dmesg(1) may have more information after failed mount system call. Aug 14 14:53:48 demoboard systemd[1]: systemd-remount-fs.service: Main process exited, code=exited, status=1/FAILURE Aug 14 14:53:48 demoboard systemd[1]: systemd-remount-fs.service: Failed with result 'exit-code'. Aug 14 14:53:48 demoboard systemd[1]: Failed to start Remount Root and Kernel File Systems. also consequentially, 'systemctl status' reported: State: degraded When issuing 'strace -ff mount -o remount /' the failure occurs at mount_setattr(3, "", AT_EMPTY_PATH, {attr_set=MOUNT_ATTR_RDONLY|MOUNT_ATTR_NOATIME|MOUNT_ATTR_NODIRATIME, attr_clr=MOUNT_ATTR_NOSUID|MOUNT_ATTR_NODEV|MOUNT_ATTR_NOEXEC|MOUNT_ATTR_NOATIME|MOUNT_ATTR_STRICTATIME|MOUNT_ATTR_NOSYMFOLLOW|0x40, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EINVAL (Invalid argument) however the failure didn't occur when using qemuarm64 with 6.6 version kernel to boot a corresponding initramfs image, in that case the exact same call under strace returned 0. Taking the above findings into consideration, add a new PACKAGECONFIG option which allows to conveniently opt-out from prematurely using a feature which can cause issues with a bit older kernels. Signed-off-by: Niko Mauno <niko.mauno@vaisala.com> --- meta/recipes-core/util-linux/util-linux_2.40.1.bb | 1 + 1 file changed, 1 insertion(+)