Bug 14526 added close_range() interception, but the wrapper just sets `errno = ENOSYS`. That stub breaks callers which treat ENOSYS as fatal rather than retrying. Current systemd is one such caller. close_all_fds() closes descriptors via close_range(), and safe_fork_full() aborts the child if that fails, so under pseudo every fork+exec fails. systemd has called close_range() here since v247 (2020), but only began treating a failure as fatal in v260, which raised its kernel baseline to 5.10 and dropped the previous /proc fallback. A concrete trigger is building a disk image with "pseudo systemd-repart", which dies as soon as repart spawns mkfs: Failed to close all file descriptors: Function not implemented '(mkfs)' failed with exit status 1. close_range() has been in the kernel since 5.9 (2020) and glibc since 2.34 (2021), so this increasingly affects common tooling. Could pseudo implement close_range() rather than returning ENOSYS?
Hi Vincent, We need a little more info so we can understand your issue. Which Yocto Project version are you using? I'm a little confused as we have systemd v259.5 in master currently, so no current version of the project has systemd v260 or later. What task is running `systemd-repart` under pseudo? Is this something added by one of your own layers or by a vendor BSP? Thanks, Paul
Hi Paul, Thanks for coming back to me so quickly! I'm actually not using pseudo for Yocto, but under NixOS. Specifically, I want to use pseudo instead of fakeroot to build an image with systemd-repart, because pseudo supports nftw (which fakeroot lacks). You can find more information here: https://github.com/NixOS/nixpkgs/issues/455331 Thanks, Vincent
close_range can be implemented in pseudo but we haven't done that yet. It would be a nice addition. Do you want to submit a patch ?
I don’t mean to interfere at all but I sent a patch for this. Please defer that patch if Vincent is already in progress/is working on it. He didn’t reply, hence I saw an opportunity to work on it. I’m happy to defer if needed.
(In reply to Babanpreet Singh from comment #4) > I don’t mean to interfere at all but I sent a patch for this. Please defer > that patch if Vincent is already in progress/is working on it. He didn’t > reply, hence I saw an opportunity to work on it. I’m happy to defer if > needed. I didn't start anything yet, so your patch is more than welcome!
Fixed by f85e2ae9ad9112efbbda2dd3daeb05a1144b0842 — "ports/linux/guts: Implement close_range() instead of returning ENOSYS" by Babanpreet Singh