<?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>13464</bug_id>
          
          <creation_ts>2019-08-01 03:04:57 +0000</creation_ts>
          <short_desc>Argument list too long when do rootfs when install too many packages</short_desc>
          <delta_ts>2026-02-19 16:10:51 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Changqing Li">changqing.li</reporter>
          <assigned_to name="Changqing Li">changqing.li</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84556</commentid>
    <comment_count>0</comment_count>
    <who name="Changqing Li">changqing.li</who>
    <bug_when>2019-08-01 03:04:57 +0000</bug_when>
    <thetext>NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: image-std-sato-1.0-r1 do_rootfs: Build of do_rootfs failed
ERROR: image-std-sato-1.0-r1 do_rootfs: Traceback (most recent call last):
  File &quot;/buildarea/layers/oe-core/bitbake/lib/bb/build.py&quot;, line 680, in exec_task
    return _exec_task(fn, task, d, quieterr)
  File &quot;/buildarea/layers/oe-core/bitbake/lib/bb/build.py&quot;, line 619, in _exec_task
    exec_func(task, localdata)
  File &quot;/buildarea/layers/oe-core/bitbake/lib/bb/build.py&quot;, line 209, in exec_func
    bb.utils.remove(cdir, True)
  File &quot;/buildarea/layers/oe-core/bitbake/lib/bb/utils.py&quot;, line 689, in remove
    subprocess.check_call([&apos;rm&apos;, &apos;-rf&apos;] + glob.glob(path))
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 576, in check_call
    retcode = call(*popenargs, **kwargs)
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 557, in call
    with Popen(*popenargs, **kwargs) as p:
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 947, in __init__
    restore_signals, start_new_session)
  File &quot;/usr/lib/python3.5/subprocess.py&quot;, line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 7] Argument list too long</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85848</commentid>
    <comment_count>1</comment_count>
    <who name="Changqing Li">changqing.li</who>
    <bug_when>2019-12-17 08:48:16 +0000</bug_when>
    <thetext>the path is get from cleandirs and splited,

so it is like:
/yocto/builds/systemd/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/core-image-minimal-1.0

/yocto/builds/systemd/tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete


seems cannot generate multi files for glob.glob


need to check after reproduce again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93592</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-06-23 15:20:58 +0000</bug_when>
    <thetext>Sandy, 
Do you have a record of what was going on in this build?
How many packages were in the image and how long the paths were?
Basically, how can we reproduce this?

It&apos;s not clear why we are doing a glob to remove a directory but perhaps there are good reasons for that...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93593</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2022-06-23 15:22:17 +0000</bug_when>
    <thetext>I&apos;m thinking our custom remove code should just call shutil.rmtree. (https://docs.python.org/3/library/shutil.html#shutil.rmtree)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96783</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-24 14:24:17 +0000</bug_when>
    <thetext>Bulk move from 4.99 or 0.00 to 5.99</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104114</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-01-29 16:27:04 +0000</bug_when>
    <thetext>Sandy, can we use: shutil.rmtree ?

Any idea why this build failed ?
Can it be reproduced now?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104119</commentid>
    <comment_count>6</comment_count>
    <who name="Changqing Li">changqing.li</who>
    <bug_when>2026-01-30 02:14:53 +0000</bug_when>
    <thetext>Refer https://git.openembedded.org/bitbake/tree/lib/bb/utils.py#n876
[# shutil.rmtree(name) would be ideal but its too slow]

we use glob.glob on purpose to make remove faster.


I didnot reproduce it again, after read the code,

[snip of bitbake/lib/bb/build.py ]
    cleandirs = flags.get(&apos;cleandirs&apos;) if flags else None 
    if cleandirs:
        for cdir in d.expand(cleandirs).split():
            bb.utils.remove(cdir, True)
[snip]

meta/classes-recipe/image.bbclass:270:do_rootfs[cleandirs] += &quot;${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${S}&quot;


I guess it reproduced then a lot of packages are installed in rootfs, and these packages have many files.  This issue should rarely to meet,  do we need to change to use rmtree?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104356</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-02-19 16:10:51 +0000</bug_when>
    <thetext>An odd failure that hasn&apos;t happened again.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>