[Yocto] Error executing a python function in exec_python_func() autogenerated

 I have faced with error when build yocto :

ERROR: imx-image-full-1.0-r0 do_rootfs: Error executing a python function in exec_python_func() autogenerated

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: 
     0001:
 *** 0002:do_rootfs(d)
     0003:
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/meta/classes/image.bbclass', lineno: 247, function: do_rootfs
     0243:    progress_reporter.next_stage()
     0244:
     0245:    # generate rootfs
     0246:    d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
 *** 0247:    create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
     0248:
     0249:    progress_reporter.finish()
     0250:}
     0251:do_rootfs[dirs] = "${TOPDIR}"
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/meta/lib/oe/rootfs.py', lineno: 373, function: create_rootfs
     0369:
     0370:    img_type = d.getVar('IMAGE_PKGTYPE')
     0371:
     0372:    cls = get_class_for_type(img_type)
 *** 0373:    cls(d, manifest_dir, progress_reporter, logcatcher).create()
     0374:    os.environ.clear()
     0375:    os.environ.update(env_bkp)
     0376:
     0377:
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/meta/lib/oe/rootfs.py', lineno: 214, function: create
     0210:        execute_pre_post_process(self.d, rootfs_post_install_cmds)
     0211:
     0212:        self.pm.run_intercepts()
     0213:
 *** 0214:        execute_pre_post_process(self.d, post_process_cmds)
     0215:
     0216:        if self.progress_reporter:
     0217:            self.progress_reporter.next_stage()
     0218:
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/meta/lib/oe/utils.py', lineno: 263, function: execute_pre_post_process
     0259:    for cmd in cmds.strip().split(';'):
     0260:        cmd = cmd.strip()
     0261:        if cmd != '':
     0262:            bb.note("Executing %s ..." % cmd)
 *** 0263:            bb.build.exec_func(cmd, d)
     0264:
     0265:# For each item in items, call the function 'target' with item as the first
     0266:# argument, extraargs as the other arguments and handle any exceptions in the
     0267:# parent thread
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/bitbake/lib/bb/build.py', lineno: 256, function: exec_func
     0252:    with bb.utils.fileslocked(lockfiles):
     0253:        if ispython:
     0254:            exec_func_python(func, d, runfile, cwd=adir)
     0255:        else:
 *** 0256:            exec_func_shell(func, d, runfile, cwd=adir)
     0257:
     0258:    try:
     0259:        curcwd = os.getcwd()
     0260:    except:
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/bitbake/lib/bb/build.py', lineno: 503, function: exec_func_shell
     0499:    with open(fifopath, 'r+b', buffering=0) as fifo:
     0500:        try:
     0501:            bb.debug(2, "Executing shell function %s" % func)
     0502:            with open(os.devnull, 'r+') as stdin, logfile:
 *** 0503:                bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)])
     0504:        except bb.process.ExecutionError as exe:
     0505:            # Find the backtrace that the shell trap generated
     0506:            backtrace_marker_regex = re.compile(r"WARNING: Backtrace \(BB generated script\)")
     0507:            stdout_lines = (exe.stdout or "").split("\n")
File: '/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/poky/bitbake/lib/bb/process.py', lineno: 186, function: run
     0182:
     0183:    if pipe.returncode != 0:
     0184:        if log:
     0185:            # Don't duplicate the output in the exception if logging it
 *** 0186:            raise ExecutionError(cmd, pipe.returncode, None, None)
     0187:        raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
     0188:    return stdout, stderr
Exception: bb.process.ExecutionError: Execution of '/home/nxf71573/Yoctos/5.10.72_2.2.0/build-imx8qxpc0/tmp/work/imx8qmmek-poky-linux/imx-image-full/1.0-r0/temp/run.sound_config_file.3443098' failed with exit code 1

ERROR: Logfile of failure stored in: /home/nxf71573/Yoctos/5.10.72_2.2.0/build-imx8qxpc0/tmp/work/imx8qmmek-poky-linux/imx-image-full/1.0-r0/temp/log.do_rootfs.3443098
ERROR: Task (/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/meta-imx/meta-sdk/dynamic-layers/qt5-layer/recipes-fsl/images/imx-image-full.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 8951 tasks of which 8940 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/nxf71573/Yoctos/5.10.72_2.2.0/sources/meta-imx/meta-sdk/dynamic-layers/qt5-layer/recipes-fsl/images/imx-image-full.bb:do_rootfs
Summary: There were 2 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

==> Cause: Have some error in building processing.

Example:

  1. No such file or directory
  2. FileExistsError
  3. …etc

==> Solution:

  1. Open log file error in line contain “ERROR: Logfile of failure stored in:” in my case file is :”/home/nxf71573/Yoctos/5.10.72_2.2.0/build-imx8qxpc0/tmp/work/imx8qmmek-poky-linux/imx-image-full/1.0-r0/temp/log.do_rootfs.3443098″
  2. Find where is root case error in the log file:
    My error: ‘/home/nxf71573/Yoctos/5.10.72_2.2.0/build-imx8qxpc0/tmp/work/imx8qmmek-poky-linux/imx-image-full/1.0-r0/rootfs/var/lib/alsa/asound.state’: No such file or directory in config file “/home/nxf71573/Yoctos/5.10.72_2.2.0/sources/meta-imx-ara/recipes-core/images/ara-imx8-release.inc” has code:
    
    # Setting sound device interface
    sound_config_file() {
        mkdir -p ${IMAGE_ROOTFS}/home/root/audio_setting
        cp ${IMAGE_ROOTFS}/var/lib/alsa/asound.state ${IMAGE_ROOTFS}/home/root/audio_setting/asound.state
    }

    –> no file asound.state in rootfs

  3. Try to fix and rebuild again will be successful.

    In my case, I only append to file “conf/local.conf”: 
    IMAGE_INSTALL_append += ” alsa-lib alsa-tools alsa-utils alsa-states”

Hope that it help you more 🙂

4 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments