<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>16339</bug_id>
          
          <creation_ts>2026-06-30 22:08:19 +0000</creation_ts>
          <short_desc>close_range() returns ENOSYS, breaking fork+exec under current systemd</short_desc>
          <delta_ts>2026-10-15 09:05:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Pseudo</product>
          <component>pseudo</component>
          <version>master</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>6.1 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vincent Haupert">mail</reporter>
          <assigned_to name="Vincent Haupert">mail</assigned_to>
          <cc>bbnpreetsingh</cc>
    
    <cc>david.c.nystrom</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>tim.orling</cc>
    
    <cc>yp.pseudo.watcher</cc>
    
    <cc>yp.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>106054</commentid>
    <comment_count>0</comment_count>
    <who name="Vincent Haupert">mail</who>
    <bug_when>2026-06-30 22:08:19 +0000</bug_when>
    <thetext>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 &quot;pseudo systemd-repart&quot;, which
dies as soon as repart spawns mkfs:

    Failed to close all file descriptors: Function not implemented
    &apos;(mkfs)&apos; 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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106082</commentid>
    <comment_count>1</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2026-07-02 18:15:31 +0000</bug_when>
    <thetext>Hi Vincent,

We need a little more info so we can understand your issue.

Which Yocto Project version are you using? I&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106083</commentid>
    <comment_count>2</comment_count>
    <who name="Vincent Haupert">mail</who>
    <bug_when>2026-07-02 18:27:19 +0000</bug_when>
    <thetext>Hi Paul,

Thanks for coming back to me so quickly!

I&apos;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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106133</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-07-09 14:43:54 +0000</bug_when>
    <thetext>close_range can be implemented in pseudo but we haven&apos;t done that yet.
It would be a nice addition.

Do you want to submit a patch ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106172</commentid>
    <comment_count>4</comment_count>
    <who name="Babanpreet Singh">bbnpreetsingh</who>
    <bug_when>2026-07-15 15:19:01 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106173</commentid>
    <comment_count>5</comment_count>
    <who name="Vincent Haupert">mail</who>
    <bug_when>2026-07-15 17:42:08 +0000</bug_when>
    <thetext>(In reply to Babanpreet Singh from comment #4)
&gt; I don’t mean to interfere at all but I sent a patch for this. Please defer
&gt; that patch if Vincent is already in progress/is working on it. He didn’t
&gt; reply, hence I saw an opportunity to work on it. I’m happy to defer if
&gt; needed.

I didn&apos;t start anything yet, so your patch is more than welcome!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107070</commentid>
    <comment_count>6</comment_count>
    <who name="David Nyström">david.c.nystrom</who>
    <bug_when>2026-10-15 09:05:16 +0000</bug_when>
    <thetext>Fixed by f85e2ae9ad9112efbbda2dd3daeb05a1144b0842 — &quot;ports/linux/guts: Implement close_range() instead of returning ENOSYS&quot; by Babanpreet Singh</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>