Ubuntu 23.04编译Kernel 6.4.3时持续出现make Error 2求助
Ubuntu 23.04编译Linux 6.4.3内核时Make Error 2的解决方案
问题描述
在Ubuntu 23.04系统编译Linux 6.4.3内核时,无论采用何种内核配置,均触发以下错误:
Must remake target 'kernel/'. Need a job token; we don't have children Successfully remade target file 'kernel/'. Reaping winning child 0x55de9c49f220 PID 4049603 Removing child 0x55de9c49f220 PID 4049603 from chain. Reaping losing child 0x55d945e87d90 PID 4049461 make: *** [Makefile:2026: .] Error 2
复现步骤:
tar -zxf linux-6.4.3.tar.xz chown user:user -R linux-6.4.3 cd linux-6.4.3 make menuconfig make -j4
解决步骤
1. 安装完整编译依赖
Ubuntu系统编译内核需要依赖一系列工具包,确保全部安装:
sudo apt update && sudo apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev dwarves
2. 清理编译残留
残留的编译文件可能导致make流程异常,执行完全清理:
cd linux-6.4.3 make distclean
清理完成后重新执行make menuconfig配置内核。
3. 调整并行编译线程数
部分场景下,过高的并行线程数会触发make的资源竞争问题,可尝试:
- 使用系统核心数匹配的线程数:
make -j$(nproc)
- 临时改用单线程编译排查问题:
make
4. 确认目录权限
确保当前用户对内核源码目录拥有完整读写权限:
sudo chown -R $USER:$USER linux-6.4.3
5. 检查make版本兼容性
Linux 6.4.x内核对make版本有最低要求,检查当前系统的make版本:
make --version
若版本低于4.3,执行以下命令升级:
sudo apt install --only-upgrade make
内容的提问来源于stack exchange,提问作者MB001
相关产品推荐
相关产品推荐

