I also get the following warnings during the build about every second:
scripts/Makefile.build:395: warning: overriding recipe for target 'built-in.a'
Makefile:1201: warning: ignoring old recipe for target 'built-in.a'
scripts/Makefile.build:405: warning: overriding recipe for target 'modules.order'
Makefile:1921: warning: ignoring old recipe for target 'modules.order'
It is the same if I do a āmake cleanā before āmake bzImageā, alghough it changes about 10 lines in the .config file for any reason.
The CPU is an Intel Core i5 760 with 4 cores (which is v2 CPU version), and 32GB RAM.
Shouldnāt these commands make the build work out of the box?
You likely have insufficient build dependencies. dnf group install āDevelopment Toolsā alone is insufficient for building the RHEL/AlmaLinux kernel.
Please try the following:
sudo dnf -y builddep kernel
Then retry the build.
If it still fails, the root cause lies in the first error: line appearing above the prepare0: Error 2 in the log. Please share that line.
Sorry. It seems the build failed not because of too many arguments,
but because there was no default config.
If you want to build using the current distro kernel configuration, do this instead:
cd /usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2
mkdir -p /tmp/kbuild
cp -a /boot/config-6.12.0-124.21.1.el10_1.x86_64_v2 /tmp/kbuild/.config
make O=/tmp/kbuild olddefconfig
make O=/tmp/kbuild -j$(nproc) bzImage
If you specifically want to use defconfig, you need the full kernel source (e.g. from the kernel SRPM), not kernel-devel.
In fact the last error was due to the make command that was missing a space after the ā-jā option, or at least the -j option causes issues and stops the build immediately. Hence I built it without the -j option this way and it continues to build properly:
make O=/tmp/kbuild bzImage
Doing this even without -j option, and adding your āmake O=/tmp/kbuild olddefconfigā procedure before, it builds further, but I still get this error after a long build time:
GEN Makefile
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/scripts/Makefile.build:395: warning: overriding recipe for target 'built-in.a'
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1201: warning: ignoring old recipe for target 'built-in.a'
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/scripts/Makefile.build:405: warning: overriding recipe for target 'modules.order'
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1921: warning: ignoring old recipe for target 'modules.order'
GEN Makefile
make[4202]: /bin/sh: Argument list too long
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/scripts/Makefile.build:395: warning: overriding recipe for target 'built-in.a'
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1201: warning: ignoring old recipe for target 'built-in.a'
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/scripts/Makefile.build:405: warning: overriding recipe for target 'modules.order'
/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1921: warning: ignoring old recipe for target 'modules.order'
make[4202]: mkdir: Argument list too long
make[4202]: /bin/sh: Argument list too long
make[4202]: *** [/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:660: outputmakefile] Error 127
make[4201]: *** [/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1234: prepare0] Error 2
make[4200]: *** [/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1234: prepare0] Error 2
make[4199]: *** [/usr/src/kernels/6.12.0-124.21.1.el10_1.x86_64_v2/./Makefile:1234: prepare0] Error 2
It seems to get stuck with the same argument list too big for the ARG_MAX limit error, but shown in a different error style.
This is not using the defconfig, only the olddefconfig with boot .config properly placed in a new /tmp/kbuild directory before, and running the build command above.
Hello. I followed your new steps, but the error is still exactly the same:
make[4202]: mkdir: Argument list too long
make[4202]: /bin/sh: Argument list too long
Would it be possible that you install the AlmaLinux 10.1 x86-64_v2 binary ISO on a dev computer and try those steps? Probably it should also install on a v3 CPU.
I understand. However I followed your new steps, and installing the new packages showed they were already installed. I still did your procedure but it failed as usual, with the āmkdir: Argument list is too longā again after 2 hours of build.
So it seems to be a real too long path to create that it is not able to create. Maybe just the ā_v2ā of āx86-64_v2ā in the path makes it just 2 characters too long and this makes it fail, compared to the āx86-64ā build ?
I understand your reasoning, but this is not a path length issue caused by the _v2 suffix.
The key evidence is make[4201] in the log. Such a high make nesting level strongly suggests a recursive make loop, and that loop can eventually hit the OS ARG_MAX limit, resulting in āArgument list too longā.
Also, building a full kernel image from /usr/src/kernels/<uname -r> is not the recommended workflow on RHEL/AlmaLinux (that tree comes from kernel-devel and is primarily meant for building external modules). For rebuilding the distro kernel, the reliable approach is to use the kernel SRPM and rpmbuild/mock.
Thank you for this very useful explanation on the difference between kernel-devel tree build, and the kernel SRPM build approaches. I could build the kernel properly now from kernel SRPM thanks to your 4 lines procedure to do it, with ārpmbuild -baā taking about 8 hours for example.
To come back to the kernel-devel way to build, I still think that it should be building properly that way, and as you say even for compiling modules. Did you try the build, and does it work at least with the AlmaLinux 10.1 x86-64 ISO, and is it sure that this āArgument list too longā error is only related to the x86-64_v2 ISO installation?
Also, is it planned to solve the issue on AlmaLinux, if that works in RHEL 10.1 ?
Maybe it is possible to enable more logs to the make process so we can see what makes it fail ? I have seen that there are some warnings at the top of my post, which might be the root cause of this issue.
Note that /usr/src/kernels/<uname -r> (kernel-devel) is mainly for building external modules (modules_prepare), not for rebuilding a full kernel image (bzImage). So bzImage failing there is not necessarily a distro bug.
However, make[4201] is clearly abnormal and suggests a recursive make loop, which can eventually hit ARG_MAX and result in āArgument list too longā.
So do you know if there is a plan to solve this āArgument list too longā, and did you try to reproduce it on an x86-64 ISO install of AlmaLinux 10.1 ? Maybe trying the original RHEL 10.1 installs might be helpful, could someone try this ?
I tried to do a āmake modules_prepareā, but even this failed with still the same error āmkdir: Argument list too longā after 2h of build, so even for external modules it is not possible to build this way.
Could you reproduce this with the āx86-64_v2ā target or even āx86-64ā target, or with original RHEL 10.1, and will this be investigated ?
I tried the same commands but in the āX86-64ā target ISO installation on a v4 Intel CPU, and the result is exactly the same with āArgument list too longā error, failing at the same stage after about 2h of build.
Hence it is not related to the āX86-64_v2ā specific target unlike I believed, this is a common issue to AlmaLinux 10.1 base installation.
I tried also on an LVM with xfs filesystem instead of ext4 on the root partition, and the result is exactly the same.
Could someone try with a RHEL 10.1 and see if this error occurs too, and if yes to report a bug in RHEL support ?