Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] No modules were added to the image after running mkinitcpio (Read 3317 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] No modules were added to the image after running mkinitcpio

I have a weird problem while configuring the Linux kernel version 5.15.4. I am required to do so via the traditional method and for that I have been given the following instructions, which closely match the Arch kernel configuration but none of the solutions worked for me.
Code: [Select]
Please install the following packages as well
sudo pacman -S pahole bc cpio

Also please ignore the error 'usbhid module not found' when running mkinitcpio.




The commands to run are :

#####
make mrproper   # if you already tried to compile or compiled once
#####

make   # for compiling the kernel
sudo make modules_install # for compiling and installing the modules
sudo cp  arch/x86_64/boot/bzImage /boot/vmlinuz-linux-5.14.3
sudo cp System.map System.map-5.14.3
sudo mkinitcpio -k 5.14.3 -g /boot/initramfs-linux-5.14.3.img
sudo grub-mkconfig -o /boot/grub/grub.cfg


sudo reboot

After running the mkinitcpio line it gives me the error which in turn breaks my kernel. Some advice will be very helpful.


Re: No modules were added to the image after running mkinitcpio

Reply #2
This one at the end of all the "Running build hook: ..." lines:
Code: [Select]
WARNING: No modules were added to the image. This is probably not what you want
The image generation is successful after that but i can't boot from that.
I ran it again just now and got this:
Code: [Select]
[htw@artixhtw linux-5.14.4]$ sudo make modules_install
  INSTALL /lib/modules/5.14.4/kernel/drivers/thermal/intel/x86_pkg_temp_thermal.ko
  INSTALL /lib/modules/5.14.4/kernel/fs/efivarfs/efivarfs.ko
  INSTALL /lib/modules/5.14.4/kernel/fs/reiserfs/reiserfs.ko
  INSTALL /lib/modules/5.14.4/kernel/net/ipv4/netfilter/iptable_nat.ko
  INSTALL /lib/modules/5.14.4/kernel/net/netfilter/nf_log_syslog.ko
  INSTALL /lib/modules/5.14.4/kernel/net/netfilter/xt_LOG.ko
  INSTALL /lib/modules/5.14.4/kernel/net/netfilter/xt_MASQUERADE.ko
  INSTALL /lib/modules/5.14.4/kernel/net/netfilter/xt_addrtype.ko
  INSTALL /lib/modules/5.14.4/kernel/net/netfilter/xt_mark.ko
  INSTALL /lib/modules/5.14.4/kernel/net/netfilter/xt_nat.ko
  DEPMOD  /lib/modules/5.14.4

[htw@artixhtw linux-5.14.4]$ sudo depmod -a
[htw@artixhtw linux-5.14.4]$ sudo cp  arch/x86_64/boot/bzImage /boot/vmlinuz-linux-5.14.4
[htw@artixhtw linux-5.14.4]$ sudo cp System.map System.map-5.14.4
[htw@artixhtw linux-5.14.4]$ sudo mkinitcpio -k 5.14.4 -g /boot/initramfs-linux-5.14.4.img
==> Starting build: 5.14.4
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
==> ERROR: module not found: `usbhid'
  -> Running build hook: [fsck]
==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-5.14.4.img
==> WARNING: errors were encountered during the build. The image may not be complete.
[htw@artixhtw linux-5.14.4]$

Re: No modules were added to the image after running mkinitcpio

Reply #3
What is the output of
Code: [Select]
$ grep -i config_usb_hid .config
in the main kernel source directory (from where you ran sudo make modules_install)?

You should go to Device Drivers🠂HID support🠂USB HID support, and press "M" on the "USB HID transport layer", and "Y" on the other items, then recompile.

In fact, I recommend starting from the existing Artix kernel by issuing
Code: [Select]
$ zcat /proc/config.gz > .config
and then modifying that.

Re: No modules were added to the image after running mkinitcpio

Reply #4
I will try that in a minute but meanwhile I did a thing on a clone VM. I opened the /etc/mkinitcpio.conf file and saw that array for MODULES was empty so I added the aliases of all the modules in the config file (which I assumed was in source directory linux-5.14.4/modules.alias). After doing that and running mkinitcpio, the No modules added error was gone but I still could not boor into the system. It seemed to be stuck at "Loading initial ramdisk". I looked at grub menu of the kernel and there was no line with quiet. I can't seem to figure out the error here.

Also can I run make menuconfig after executing that zcat line?

Re: No modules were added to the image after running mkinitcpio

Reply #5
You don't need any modules in the MODULES=() line. That line only serves to load the modules before anything else is done (for example, to have framebuffer console during kernel loading instead of a default text mode). https://wiki.archlinux.org/title/Mkinitcpio#MODULES

As for your other question, yes. You run make menuconfig (or make nconfig, make xconfig, make gconfig) and set options to more closely match your system.

https://wiki.archlinux.org/title/Kernel/Traditional_compilation#Advanced_configuration

I'd disregard their tip about debugging options. They are essential if anything goes wrong.

Re: No modules were added to the image after running mkinitcpio

Reply #6
Check your kernel config file. The default config builds usbhid into the kernel binary, not as a module.
Code: [Select]
#
# USB HID support
#
CONFIG_USB_HID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y

Somehow, mkinitcpio is asked to insert usbhid as a module. I would check the initcpio install/hook to see if usbhid is added as a module there.

Of course, you could also change the config to build usbhid as a module and recompile the kernel.

Re: No modules were added to the image after running mkinitcpio

Reply #7
It worked with configuring the artix file, Thanks! The error was resolved when I built usbhid as a module.