Bug 13464

Summary: Argument list too long when do rootfs when install too many packages
Product: [Build System, Metadata & Runtime] BitBake Reporter: Changqing Li <changqing.li>
Component: bitbakeAssignee: Changqing Li <changqing.li>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Medium+ CC: poky.bs.watcher, poky.watcher, randy.macleod, ross.burton
Version: unspecified   
Target Milestone: 6.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Changqing Li 2019-08-01 03:04:57 UTC
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 "/buildarea/layers/oe-core/bitbake/lib/bb/build.py", line 680, in exec_task
    return _exec_task(fn, task, d, quieterr)
  File "/buildarea/layers/oe-core/bitbake/lib/bb/build.py", line 619, in _exec_task
    exec_func(task, localdata)
  File "/buildarea/layers/oe-core/bitbake/lib/bb/build.py", line 209, in exec_func
    bb.utils.remove(cdir, True)
  File "/buildarea/layers/oe-core/bitbake/lib/bb/utils.py", line 689, in remove
    subprocess.check_call(['rm', '-rf'] + glob.glob(path))
  File "/usr/lib/python3.5/subprocess.py", line 576, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.5/subprocess.py", line 557, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 7] Argument list too long
Comment 1 Changqing Li 2019-12-17 08:48:16 UTC
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.
Comment 2 Randy MacLeod 2022-06-23 15:20:58 UTC
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's not clear why we are doing a glob to remove a directory but perhaps there are good reasons for that...
Comment 3 Ross Burton 2022-06-23 15:22:17 UTC
I'm thinking our custom remove code should just call shutil.rmtree. (https://docs.python.org/3/library/shutil.html#shutil.rmtree)
Comment 4 Randy MacLeod 2023-10-24 14:24:17 UTC
Bulk move from 4.99 or 0.00 to 5.99
Comment 5 Randy MacLeod 2026-01-29 16:27:04 UTC
Sandy, can we use: shutil.rmtree ?

Any idea why this build failed ?
Can it be reproduced now?
Comment 6 Changqing Li 2026-01-30 02:14:53 UTC
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('cleandirs') 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] += "${IMAGE_ROOTFS} ${IMGDEPLOYDIR} ${S}"


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?
Comment 7 Randy MacLeod 2026-02-19 16:10:51 UTC
An odd failure that hasn't happened again.