You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GitLab CI构建Yocto镜像时出现磁盘空间监控错误

GitLab CI/CD构建Yocto镜像磁盘空间不足问题解决

一、磁盘扩容权限说明

GitLab免费版的共享运行器磁盘空间为固定规格(通常约10GB),无法直接进行磁盘扩容。自定义磁盘容量的功能仅对Premium/Pro付费版用户开放,付费用户可配置私有运行器的磁盘参数或使用更高规格的共享运行器资源。

二、免费版用户的可行解决办法

1. 清理冗余文件与优化缓存

在CI流水线脚本中添加前置清理步骤,释放磁盘空间:

  • 构建前删除旧的Yocto构建目录:rm -rf yocto/poky/build-qemuarm/tmp/*
  • 清理Yocto的无效缓存:bitbake -c cleanall core-image-minimal
  • 配置GitLab CI缓存策略,仅保留必要的sstate-cache和downloads目录,避免缓存冗余文件:
    cache:
      paths:
        - yocto/poky/build-qemuarm/sstate-cache/
        - yocto/poky/build-qemuarm/downloads/
      policy: pull-push
    

2. 调整Yocto磁盘监控参数

临时修改Yocto的local.conf文件,放宽磁盘空间监控阈值,避免过早触发中止:

BB_DISKMON_DIRS = "\
    STOPTASKS,${TMPDIR},2G,500M \
    STOPTASKS,${DL_DIR},2G,500M \
    STOPTASKS,${SSTATE_DIR},2G,500M \
    ABORT,${TMPDIR},500M,0M \
    ABORT,${DL_DIR},500M,0M \
    ABORT,${SSTATE_DIR},500M,0M"

3. 使用轻量构建镜像

替换GitLab CI的基础镜像为精简版Yocto构建环境(如基于Alpine的自定义镜像),减少系统本身占用的磁盘空间。

4. 拆分构建任务

将Yocto构建拆分为多个流水线阶段(依赖下载、组件编译、镜像打包),每个阶段仅保留当前步骤所需文件,避免单阶段占用过多磁盘资源。

报错信息

NOTE: recipe libice-1_1.0.10-r0: task do_configure: Started
WARNING: The free space of /builds/ganeshredcobra/rcc_rpi/yocto/poky/build-qemuarm/tmp (/dev/sda1) is running low (0.994GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!
WARNING: The free space of /builds/ganeshredcobra/rcc_rpi/yocto/poky/build-qemuarm/downloads (/dev/sda1) is running low (0.994GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!
WARNING: The free space of /builds/ganeshredcobra/rcc_rpi/yocto/poky/build-qemuarm/sstate-cache (/dev/sda1) is running low (0.994GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!
NOTE: recipe libice-1_1.0.10-r0: task do_configure: Succeeded
WARNING: The free space of /tmp (overlay) is running low (0.089GB left)
ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!
WARNING: The free space of /builds/ganeshredcobra/rcc_rpi/yocto/poky/build-qemuarm/tmp (/dev/sda1) is running low (0.089GB left)
ERROR: Immediately abort since the disk space monitor action is "ABORT"!
WARNING: The free space of /builds/ganeshredcobra/rcc_rpi/yocto/poky/build-qemuarm/downloads (/dev/sda1) is running low (0.089GB left)
WARNING: The free space of /builds/ganeshredcobra/rcc_rpi/yocto/poky/build-qemuarm/sstate-cache (/dev/sda1) is running low (0.089GB left)
ERROR: Immediately abort since the disk space monitor action is "ABORT"!
ERROR: Immediately abort since the disk space monitor action is "ABORT"!
NOTE: Sending SIGTERM to remaining 1 tasks
NOTE: Sending SIGTERM to remaining 1 tasks
NOTE: Sending SIGTERM to remaining 1 tasks
NOTE: Tasks Summary: Attempted 944 tasks of which 0 didn't need to be rerun and all succeeded.
Summary: There were 9 WARNING messages shown.
Summary: There were 7 ERROR messages shown, returning a non-zero exit code.

内容的提问来源于stack exchange,提问作者ganeshredcobra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 17:04:58