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 ?