# Cannot compile kernel

**URL:** <https://forums.rockylinux.org/t/cannot-compile-kernel/12647>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-8\
**Created:** [January 27, 2024, 1:01am UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647 "2024-01-27T01:01:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jscnet](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jscnet](https://forums.rockylinux.org/u/jscnet)\
**Post date:** [January 27, 2024, 1:01am UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/1 "2024-01-27T01:01:17Z")

</div>

Attempting to compile kernel, but bumping into error.

```auto
[root@rocky8 build]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.9 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.9"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.9 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2029-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.9"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.9"

```

```auto
uname -r
4.18.0-513.11.1.el8_9.x86_64

```

source dir:  
`/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/`

Steps:

1. All necessary **dev** and **kernel-devel** utils and source files are installed
2. Copied `config-$(uname -r)` from `/boot` to `/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64` and saved as `.config`
3. Ran `make oldconfig`
4. Ran `make manuconfig` → saved changes
5. Ran `make`

Shortly afterwords I get the following error:

```auto
[root@rocky8 4.18.0-513.11.1.el8_9.x86_64]# make
  DESCEND objtool
/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Makefile.build:37: /usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Build.i
make[4]: *** No rule to make target '/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Build.include'. Stop.
make[3]: *** [Makefile:47: /usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/objtool/fixdep-in.o] Error 2
make[2]: *** [/usr/src/kernels/4.18.0-513.11.1.el8_9.x86_64/tools/build/Makefile.include:4: fixdep] Error 2
make[1]: *** [Makefile:65: objtool] Error 2
make: *** [Makefile:1782: tools/objtool] Error 2

```

There is no `Build.include` file under `tools/build/` directory.

```auto
[root@rocky8 4.18.0-513.11.1.el8_9.x86_64]# cd tools/build/
[root@rocky8 build]# ll
total 24
drwxr-xr-x. 2 root root 22 Jan 26 08:56 feature
-rw-r--r--. 1 root root 1286 Jan 10 15:09 Makefile
-rw-r--r--. 1 root root 3987 Jan 10 15:09 Makefile.build
-rw-r--r--. 1 root root 8621 Jan 10 15:09 Makefile.feature
-rw-r--r--. 1 root root 217 Jan 10 15:09 Makefile.include
drwxr-xr-x. 3 root root 16 Jan 26 08:56 tests

```

Is this a bug or am i supposed to generate it? It’s not clear if the additional errors are **the** problem or the file missing is the problem.

I’m at a loss on how to fix this, any advice would be appreciated.

---

<div class="post-metadata">

**Author:** ![label](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@label](https://forums.rockylinux.org/u/label)\
**Post date:** [January 27, 2024, 1:14am UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/2 "2024-01-27T01:14:52Z")

</div>

You’ll need a lot more than just the kernel-devel package. The devel package typically only provides enough to compile a module against that kernel. This means you’ll need the source kernel package that was used to build the current kernel.

Is there a reason why you’re trying to compile your own kernel? [This isn’t recommended nor supported](https://wiki.rockylinux.org/irc/#kernel-rebuilds).

---

<div class="post-metadata">

**Author:** ![jscnet](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jscnet](https://forums.rockylinux.org/u/jscnet)\
**Post date:** [January 27, 2024, 2:03am UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/3 "2024-01-27T02:03:07Z")

</div>

I’ve downloaded everything various online instructions have said to download and install.

Typically I (we) rebuild kernels to enable or disable features. I’m not sure why you said its not recommended, its common practice.

In my case I’m enabling NTFS r/w filesystem support.

I’m open to any suggestions on what steps you may have to address the compiling error?

---

<div class="post-metadata">

**Author:** ![label](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@label](https://forums.rockylinux.org/u/label)\
**Post date:** [January 27, 2024, 2:34am UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/4 "2024-01-27T02:34:37Z")

</div>

It is not recommended because we (the community and maintainers) cannot support it. The wiki link specifies the reasons why it’s not supported.

Are `ntfs-3g` and `ntfsprogs` from the epel repository insufficient? You can easily install them after enabling the epel repository and they provide read/write support.

I’m not sure what you’ve read for compiling kernels, but the kernel-devel package is not enough. If you insist on building your own kernel, it would be better to recompile the source RPM. See below.

```auto
% dnf download kernel --source
% sudo dnf install epel-release rpm-build -y
% sudo crb enable
% sudo dnf install mock -y
% sudo usermod -aG mock label
# run newgrp or log out and back in
% newgrp
% rpm -i kernel-4.18.0-513.11.1.el8_9.src.rpm
% vi rpmbuild/SOURCES/kernel-x86_64.config
# make your changes as you see fit
% rpmbuild -bs rpmbuild/SPECS/kernel.spec --define 'dist .el8_9.custom'
Wrote: /home/label/rpmbuild/SRPMS/kernel-4.18.0-513.11.1.el8_9.custom.src.rpm
% mock -r rocky-8-x86_64 \
  --define 'dist .el8_9.custom' \
  --enablerepo=devel \
  /home/label/rpmbuild/SRPMS/kernel-4.18.0-513.11.1.el8_9.custom.src.rpm

. . .

Wrote: /builddir/build/RPMS/kernel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-headers-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-cross-headers-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debuginfo-common-x86_64-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/perf-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/perf-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/python3-perf-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/python3-perf-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-libs-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-libs-devel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-tools-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/bpftool-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/bpftool-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-selftests-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-core-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-devel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-modules-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-modules-extra-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-modules-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debug-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-core-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-devel-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-modules-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-modules-extra-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-modules-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-debuginfo-4.18.0-513.11.1.el8_9.custom.x86_64.rpm
Wrote: /builddir/build/RPMS/kernel-ipaclones-internal-4.18.0-513.11.1.el8_9.custom.x86_64.rpm

```

---

<div class="post-metadata">

**Author:** ![jscnet](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jscnet](https://forums.rockylinux.org/u/jscnet)\
**Post date:** [January 27, 2024, 2:37am UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/5 "2024-01-27T02:37:34Z")

</div>

Thanks. I’ll try that tonight and post back my results for others who might be interested.

---

<div class="post-metadata">

**Author:** ![jscnet](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@jscnet](https://forums.rockylinux.org/u/jscnet)\
**Post date:** [January 27, 2024, 5:00pm UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/6 "2024-01-27T17:00:48Z")

</div>

This process sucked, using up all remaining hard drive space on a 40G partition. Ultimately, failing completely due to lack of disk space.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [March 27, 2024, 5:01pm UTC](https://forums.rockylinux.org/t/cannot-compile-kernel/12647/7 "2024-03-27T17:01:04Z")

</div>

Closed on March 27, 2024, 5:01pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
