I have battled this problem a couple times and so I am documenting the issue and solution here.
Here is the error message from make modules_install
ln: target '+/source': No such file or directory
The short solution is to watch out for stray whitespace in the Makefile
This happens when I attempt to modify the Makefile in order to revision control the Kernel. I I suspect that a build I am about to make will prevent the machine I am working on from booting, I want to keep an older build functional in order to restore the machine.
Here is the diff for my Makefile:
diff --git a/Makefile b/Makefile index 2fdd8b40b7e0..cb747c16e33c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 6 PATCHLEVEL = 5 -SUBLEVEL = 0 +SUBLEVEL = 5 EXTRAVERSION = NAME = Hurr durr I'ma ninja sloth
When the run fails, the diff will show a stray whitespace character around the SUBLEVEL value. This value is used to generate the string the becomes part of the path where the install happens. At the top level, Kernels get installed into here:
# ls -la /usr/lib/modules/ total 20 drwxr-xr-x. 8 root root 122 Sep 25 08:15 . dr-xr-xr-x. 34 root root 4096 Sep 18 09:51 .. drwxr-xr-x. 8 root root 4096 May 15 19:06 5.17.5-300.fc36.aarch64 drwxr-xr-x. 8 root root 4096 Sep 18 09:53 6.2.15-100.fc36.aarch64 drwxr-xr-x. 3 root root 4096 Sep 22 10:26 6.5.0+ drwxr-xr-x. 2 root root 6 Sep 23 07:42 6.5.1 drwxr-xr-x. 2 root root 6 Sep 23 07:57 6.5.5 drwxr-xr-x. 3 root root 4096 Sep 25 08:18 6.5.5+
The source directory is a symlink underneath it:
# ls -la /usr/lib/modules/6.5.5+/source lrwxrwxrwx. 1 root root 11 Sep 25 08:15 /usr/lib/modules/6.5.5+/source -> /root/linux
Thus by having an extra space anywhere in there, the path generation gets messed up.