Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Building kernel error: Cannot find module directory
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 226
Location: Somewhere in the 77

PostPosted: Sun May 12, 2024 3:27 pm    Post subject: Building kernel error: Cannot find module directory Reply with quote

Hello,

Information about my system configuration (kernel in use, profile, emerge --info, etc) here.

What I try to do:

From this topic (Guidance needed to setup SELinux) I try to recompile my kernel, after creating a .config into /usr/src/linux with xconfig, I compile it successfully (at least, no error), then try to run make install.

What is my problem:

The command make install return this error:

Code:
Mephistopheles /usr/src/linux # make install
  INSTALL /boot
Loading /usr/lib/kernel/install.conf…
layout=grub set via /usr/lib/kernel/install.conf
INITRD_GENERATOR (dracut) set via /usr/lib/kernel/install.conf.
UKI_GENERATOR (none) set via /usr/lib/kernel/install.conf.
Loaded /usr/lib/kernel/install.conf.
MACHINE_ID=8e755a1a2626cca36eca4f67662d84ab set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
Directory "/boot" is not the root of the file system.
Couldn't find an XBOOTLDR partition.
Using EFI System Partition at /efi as $BOOT_ROOT.
Using entry token: 8e755a1a2626cca36eca4f67662d84ab
kernel version (6.6.30-gentoo) set via command line.
kernel image file (/usr/src/linux-6.6.30-gentoo/arch/x86/boot/bzImage) set via command line.
Using ENTRY_DIR=/efi/8e755a1a2626cca36eca4f67662d84ab/6.6.30-gentoo
Using plugins:
  /usr/lib/kernel/install.d/00-00machineid-directory.install
  /usr/lib/kernel/install.d/10-copy-prebuilt.install
  /usr/lib/kernel/install.d/50-depmod.install
  /usr/lib/kernel/install.d/50-dracut.install
  /usr/lib/kernel/install.d/51-dracut-rescue.install
  /usr/lib/kernel/install.d/90-compat.install
  /usr/lib/kernel/install.d/90-loaderentry.install
  /usr/lib/kernel/install.d/90-uki-copy.install
  /usr/lib/kernel/install.d/91-grub-mkconfig.install
Plugin environment:
  LC_COLLATE=C.UTF-8
  KERNEL_INSTALL_VERBOSE=1
  KERNEL_INSTALL_IMAGE_TYPE=pe
  KERNEL_INSTALL_MACHINE_ID=8e755a1a2626cca36eca4f67662d84ab
  KERNEL_INSTALL_ENTRY_TOKEN=8e755a1a2626cca36eca4f67662d84ab
  KERNEL_INSTALL_BOOT_ROOT=/efi
  KERNEL_INSTALL_LAYOUT=grub
  KERNEL_INSTALL_INITRD_GENERATOR=dracut
  KERNEL_INSTALL_UKI_GENERATOR=none
  KERNEL_INSTALL_STAGING_AREA=/tmp/kernel-install.staging.Kjz9Bn
Plugin arguments: add 6.6.30-gentoo /efi/8e755a1a2626cca36eca4f67662d84ab/6.6.30-gentoo /usr/src/linux-6.6.30-gentoo/arch/x86/boot/bzImage
Successfully forked off '(sd-exec-strv)' as PID 103344.
About to execute /usr/lib/kernel/install.d/00-00machineid-directory.install add 6.6.30-gentoo /efi/8e755a1a2626cca36eca4f67662d84ab/6.6.30-gentoo /usr/src/linux-6.6.30-gentoo/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 103345.
/usr/lib/kernel/install.d/00-00machineid-directory.install succeeded.
About to execute /usr/lib/kernel/install.d/10-copy-prebuilt.install add 6.6.30-gentoo /efi/8e755a1a2626cca36eca4f67662d84ab/6.6.30-gentoo /usr/src/linux-6.6.30-gentoo/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 103346.
/usr/lib/kernel/install.d/10-copy-prebuilt.install succeeded.
About to execute /usr/lib/kernel/install.d/50-depmod.install add 6.6.30-gentoo /efi/8e755a1a2626cca36eca4f67662d84ab/6.6.30-gentoo /usr/src/linux-6.6.30-gentoo/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 103348.
/usr/lib/kernel/install.d/50-depmod.install succeeded.
About to execute /usr/lib/kernel/install.d/50-dracut.install add 6.6.30-gentoo /efi/8e755a1a2626cca36eca4f67662d84ab/6.6.30-gentoo /usr/src/linux-6.6.30-gentoo/arch/x86/boot/bzImage
Successfully forked off '(direxec)' as PID 103349.
dracut[F]: Cannot find module directory /lib/modules/6.6.30-gentoo/
dracut[F]: and --no-kernel was not specified
/usr/lib/kernel/install.d/50-dracut.install failed with exit status 1.
/usr/lib/kernel/install.d/50-dracut.install failed with exit status 1.
(sd-exec-strv) failed with exit status 1.
make[1]: *** [arch/x86/Makefile:292: install] Error 1
make: *** [Makefile:234: __sub-make] Error 2


While I ls /lib/modules/:
Code:
Mephistopheles /usr/src/linux # ls /lib/modules
6.6.28-gentoo-dist-hardened  6.6.30-gentoo-dist-hardened


Not being in ease with these operation I done only a few times in my life, I'm requiring assistance please :) !

As a note, please see this with some comments from another user.

He's supposing by installing the package sys-kernel/gentoo-sources it made a conflict on my system, because I installed it with dist-kernel as explained here in the handbook.

This is all the packages installed on my machine in the sys-kernel/ category:

Code:
[IP-] [  ] sys-kernel/dracut-060_pre20240104-r4:0
[IP-] [  ] sys-kernel/gentoo-kernel-6.6.30:6.6.30
[IP-] [  ] sys-kernel/gentoo-sources-6.6.30:6.6.30
[IP-] [  ] sys-kernel/installkernel-28:0
[IP-] [  ] sys-kernel/linux-firmware-20240410:0
[IP-] [  ] sys-kernel/linux-headers-6.6-r1:0


So, from the user comment above, I can try to guess that having sys-kernel/gentoo-kernel-6.6.30 & sys-kernel/gentoo-sources-6.6.30 at the same time is not something you want, but I was not aware of that.

Still if I understand, I should have used this method while installing my Gentoo. Is that correct ?

If it's correct, I guess I have to remove sys-kernel/gentoo-kernel for keeping only sys-kernel/gentoo-sources, compile it as I tried before, and then make install will actually install it, instead of managing the kernel version with portage ? Only what portage will do is updating the package sys-kernel/gentoo-sources, to have the usual Gentoo Linux kernel with my modification (in this case for now, having all needed to use SELinux and enable it from the kernel at boot).

Am I right or taking the wrong path ?

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
CooSee
Veteran
Veteran


Joined: 20 Nov 2004
Posts: 1455
Location: Earth

PostPosted: Mon May 13, 2024 9:53 pm    Post subject: Reply with quote

your modules folder
Code:
6.6.30-gentoo-dist-hardened

the install is looking for >>> Cannot find module directory /lib/modules/6.6.30-gentoo/

you mixed up your kernel folders somehow !?

8)
_________________
" Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier "
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 226
Location: Somewhere in the 77

PostPosted: Tue May 14, 2024 9:04 am    Post subject: Reply with quote

CooSee wrote:
your modules folder
Code:
6.6.30-gentoo-dist-hardened

the install is looking for >>> Cannot find module directory /lib/modules/6.6.30-gentoo/

you mixed up your kernel folders somehow !?

8)


Hello, I did noticed that but I think I wasn't stating it in my topic, of course it miss something here :lol: ! Sorry.

But, what do you mean by I mixed up my kernel folders ?

---

While installing, I used the dist-kernel way, compiling it myself.

Later, to enable SELinux, I installed gentoo-sources and then tried to compile it.

From what I understood, the problem is located here: Having disk-kernel & gentoo-sources.

---

Should I remove dist-kernel and install a kernel from gentoo-sources I compiled myself ?

Oldfashionnedcow was speaking about chrooting. I guess I'll have to:
1/ Chroot
2/ Remove the dist-kernel
3/ Reboot into a chroot
4/ make & make install my new kermel from gentoo-sources, hardened, 6.6.30.
5/ eselect profile set it
6/ Restart

^ this is just my guess for now.

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 939
Location: Richmond Hill, Canada

PostPosted: Tue May 14, 2024 2:42 pm    Post subject: Reply with quote

kgdrenefort,

You have correctly identify the issue, have both gentoo-source and gentoo-kernel at same time is not advised.

sys-kernel/gentoo-kernel design is use Portage(emerge) to manage the kernel life cycle, whereas the sys-kernel/gentoo-source is design to let user manage the compile/install cycle.

Have sys-kernel/gentoo-kernel does not prevent you from change kernel options to customise to your need so I suggest you remove sys-kernel/gentoo-source. However you should make copy of your gentoo-sources .config file. so your hard worked changes will not lost.

Having said above, you can opt to keep sys-kernel/gentoo-sources and remove sys-kernel/gentoo-kernel. Using sys-kernel/gentoo-source you have full control of how to build kernel in your way and how to install into location of your choose. but you should understood the booting sequence of your machine before your try that.

I am not entirely sure the sys-kernel/gentoo-kernel life cycle management. but I think /etc/portage/sys-kernel/ should have a copy of your gentoo-kernel's .config file. you can apply your sys-kerne;/gentoo-sources configuration changes and run emerge to rebuild it.

P.S. Are you sure the sys-kernel/gentoo-kernel(hardened) does not have everything your need for testing selinux? my test show lots of selinux already enabled
Code:
58eace052d6a /etc/portage/savedconfig/sys-kernel # grep -i selinux gentoo-kernel-6.6.30
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9
CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
# CONFIG_SECURITY_SELINUX_DEBUG is not set
# CONFIG_DEFAULT_SECURITY_SELINUX is not set
Back to top
View user's profile Send private message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 283
Location: Nijmegen

PostPosted: Wed May 15, 2024 9:57 pm    Post subject: Reply with quote

Quote:
So, from the user comment above, I can try to guess that having sys-kernel/gentoo-kernel-6.6.30 & sys-kernel/gentoo-sources-6.6.30 at the same time is not something you want, but I was not aware of that.


This configuration is fine, you can install as many different versions of the same kernel version as you want. Note though that one may overwrite the other.

Something else is going wrong, but I am a bit confused about what you are doing, Which kernel are you running 'make install' for? the dist-kernel or your custom kernel? Both make install and make modules_install should take the same kernel version string so the later should always be able to find the modules.

I suspect that you are not installing the kernel you think you are installing, or maybe forgot to run 'make modules_install'
_________________
OS: Gentoo 6.7.3-gentoo-dist, ~amd64, 17.1/desktop/plasma/systemd/merged-usr
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 226
Location: Somewhere in the 77

PostPosted: Thu May 16, 2024 10:15 am    Post subject: Reply with quote

Hello and thanks for the reply.

I was on other problem so I kind of forget a bit how I proceed.

I'll try to restart the process for scratch and try to remove gentoo-sources.

Will get back to this topic with problems or telling why it was bad and how I fixed it.

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 226
Location: Somewhere in the 77

PostPosted: Fri May 17, 2024 9:39 am    Post subject: Reply with quote

Hello,

So I think I really misunderstood stuff, explaining a lot.

From the command pingtoo showed, this is what I have in my dist-kernel:

Code:
# grep -i selinux gentoo-kernel-6.6.30
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9
CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
# CONFIG_SECURITY_SELINUX_DEBUG is not set
# CONFIG_DEFAULT_SECURITY_SELINUX is not set


Meanings I already have these options enabled.

Could someone confirm that everything is ok ? 

I'll try to keep going anyway, worst case I have backups.

PS: I removed gentoo-source.

Regards,
GASPARD DE RENEFORT Kévin
_________________
wiki/User:Kgdrenefort/captain_logs My system info
G. does not have problems, only learning opportunities. - NeddyS.
If your installation isn't valuable to you, feel free to continue to ignore the instructions. - figue.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 939
Location: Richmond Hill, Canada

PostPosted: Sat May 18, 2024 1:43 pm    Post subject: Reply with quote

kgdrenefort wrote:
Hello,

So I think I really misunderstood stuff, explaining a lot.

From the command pingtoo showed, this is what I have in my dist-kernel:

Code:
# grep -i selinux gentoo-kernel-6.6.30
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9
CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
# CONFIG_SECURITY_SELINUX_DEBUG is not set
# CONFIG_DEFAULT_SECURITY_SELINUX is not set


Meanings I already have these options enabled.

Could someone confirm that everything is ok ? 
Can you define what do you mean "everything is ok"? are you asking is those setting is enough for enable selinux? I believe it is "yes" but I am no selinux expert so I don't know what is you trying to archive. So if you can put down more detail explain than someone who better understand selinux can give better guidance.

BTW, from your wiki I know you are already running on a sys-kernel/gentoo-kernel. so may be you can use this running kernel as base to explain what difficulty you encounter.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum