You are not logged in.

#1 2018-09-13 13:40:58

Yann
Member
Registered: 2017-11-23
Posts: 235

[SOLVED] Compile linux kernel WARNING: No modules added to the image

Hi everyone,

For a kernel panic issue I need to compile the 4.18.6 linux kernel (with a patch).

I did:
- download the 4.18.6 linux kernel and apply the patch
- perform: make mrproper
- perform: make menuconfig
- in the menu I checked on (in Device Driver --> Multiple device driver support --> Device mapper support) the dm_crypt, ..., dm_thin_pool ( for Crypt, Snapshot, Thin pool and Cache (including Cache Stochastic MQ))
- make
- sudo make modules_install
- copy the kernel to the boot directory: sudo cp -v arch/x86/boot/bzImage /boot/vmlinuz-kernel_name
- sudo mkinitcpio -k kernel_version -c /etc/mkinitcpio.conf -g /boot/initramfs-kernel_name.img

Here I got a problem. Usually when I perform mkinitcpio for a running kernel (4.17.9 for exemple) I got something like:

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 4.17.9-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [encrypt]
  -> Running build hook: [lvm2]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
  -> Running build hook: [shutdown]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 4.17.9-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: aic94xx
  -> Running build hook: [encrypt]
  -> Running build hook: [lvm2]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
  -> Running build hook: [shutdown]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful


Here I got:

sudo mkinitcpio -k /boot/vmlinuz-yo_linux_build_4.18.6 -c /etc/mkinitcpio.conf -g /boot/initramfs-yo_linux_build_4.18.6.img
==> Starting build: 4.18.6
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [encrypt]
  -> Running build hook: [lvm2]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
  -> Running build hook: [shutdown]
==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating gzip-compressed initcpio image: /boot/initramfs-yo_linux_build_4.18.6.img
==> Image generation successful

Then, with no surprise I can not boot on the new kernel.

There is my mkinitcpio.conf file:

MODULES=()
BINARIES=()
FILES=()
HOOKS=(base udev autodetect modconf block encrypt lvm2 filesystems keyboard fsck shutdown)

This is my /lib/modules/4.18.6/:

build -> /home/.../linux-4.18.6/
kernel/
modules.alias
modules.alias.bin
modules.builtin
modules.builtin.bin
modules.dep
modules.dep.bin
modules.devname
modules.order
modules.softdep
modules.symbols
modules.symbols.bin
source -> /home/.../linux-4.18.6/

(I have already tried depmod)

Does anyone have an idea?
Thank you for your help and time

Last edited by Yann (2018-09-17 18:31:10)


all different - all equal

Offline

#2 2018-09-13 14:25:55

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

Did the .config for the custom kernel contain any modules?

Offline

#3 2018-09-13 14:50:28

Yann
Member
Registered: 2017-11-23
Posts: 235

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

Thanks for the quick reply.

The .config file has 4351 lines.

I checked on that lines (modules) in the make menuconfig:

<*>     Crypt target support
<*>     Snapshot target
<*>     Thin provisioning target
<*>     Cache target (EXPERIMENTAL)
<*>     Stochastic MQ Cache Policy (EXPERIMENTAL) (NEW)

And have them in the .config file:

CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_CACHE=y
CONFIG_DM_CACHE_SMQ=y

I don't know if there are others modules I am supposed to check.
Thanks.

Last edited by Yann (2018-09-13 14:51:23)


all different - all equal

Offline

#4 2018-09-14 14:12:30

NiceGuy
Member
Registered: 2018-02-19
Posts: 50

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

You did not make use of Arch's PKGBUILD (4.18.6 linux), did you?

Do you have a special need to manually do the kernel building process?

Yann wrote:

CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_CACHE=y
CONFIG_DM_CACHE_SMQ=y

Offline

#5 2018-09-14 14:42:49

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

Does the config contain any =m lines?

CONFIG_DM_CRYPT=y
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_CACHE=y
CONFIG_DM_CACHE_SMQ=y

means the modules will be built into the kernel itself rather than as an external module.

Offline

#6 2018-09-14 15:01:45

NiceGuy
Member
Registered: 2018-02-19
Posts: 50

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

I remember back in the gentoo days, it was trivial to build a kernel manually from source and afterwards inform portage, the package manager, about it in package.provided. I almost never managed to do this quite easily in any other distribution. Since you use Arch Linux, why not use the standard way with a PKGBUILD to achieve the same?

You would use the package asp like this:

asp export linux

*) Copy the revert patch to the same directory,
*) edit the PKGBUILD - add the patch to the source array
*) use updpkgsums to calculate the hash for the patch

.. or a bit more editing to use linux-custom or a different package name of your choosing,
.. and with extra care you edit the Arch default config file to change what you need.

This will provide you with a working kernel 4.18.x package ready to be installed with pacman.
More info here: https://wiki.archlinux.org/index.php/Ke … ild_System

I suspect that somehow mkinitcpio is lacking additional information about your custom kernel built from source.
That's why it is easier to stick to the PKGBUILD and the default Arch config and just customize it.

Offline

#7 2018-09-14 15:11:30

NiceGuy
Member
Registered: 2018-02-19
Posts: 50

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

What about using mkinitcpio with -v (--verbose):

sudo mkinitcpio -k /boot/vmlinuz-yo_linux_build_4.18.6 -c /etc/mkinitcpio.conf -g /boot/initramfs-yo_linux_build_4.18.6.img -v

What additional information do you get?

Offline

#8 2018-09-15 18:55:18

Yann
Member
Registered: 2017-11-23
Posts: 235

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

Thanks a lot for all your replies, helps a lot.


NiceGuy wrote:

You did not make use of Arch's PKGBUILD (4.18.6 linux), did you?
Do you have a special need to manually do the kernel building process?

I did not use the Arch's PKGBUILD (4.18.6 linux), I downloaded and compiled it by hand (make, ...). I did have to do that because I need to apply a patch and, moreover, I needed to add the previous mentioned modules (I got others modules errors at the first compilation without adding them to the kernel config).


loqs wrote:

Does the config contain any =m lines?

Yes, I got that ones:

CONFIG_NF_LOG_COMMON=m
CONFIG_NF_NAT=m
CONFIG_NF_NAT_NEEDED=y
CONFIG_NF_NAT_FTP=m
CONFIG_NF_NAT_IRC=m
CONFIG_NF_NAT_SIP=m
CONFIG_NETFILTER_XT_MARK=m
CONFIG_NETFILTER_XT_TARGET_LOG=m
CONFIG_NETFILTER_XT_NAT=m
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
CONFIG_NF_LOG_ARP=m
CONFIG_NF_LOG_IPV4=m
CONFIG_NF_REJECT_IPV4=y
CONFIG_NF_NAT_IPV4=m
CONFIG_NF_NAT_MASQUERADE_IPV4=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_NF_LOG_IPV6=m
loqs wrote:

means the modules will be built into the kernel itself rather than as an external module.

I got it smile.



NiceGuy wrote:

why not use the standard way with a PKGBUILD to achieve the same?

Thanks for your PKGBUILD suggestion. I spent a long time on that. However, I got to two problems, first one I did not succeed to apply the "asp export linux" to linux 4.18.6 (now linux = linux 4.18.7). That's a little silly but I don't know what is the real name of the linux_4.18.6 package.. Unless I can not use asp for old packages?

I tried to perform anyway the build with linux (=4.18.7) and got the following error after makepkg (without any modification):

==> Making package: linux 4.18.7.arch1-1 (Sat 15 Sep 2018 06:42:19 PM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning archlinux-linux git repo...
Cloning into bare repository '/home/yo/documents/computers_smartphones/Arch/kernels/linux-4.18.6_asp/linux/archlinux-linux'...
remote: Enumerating objects: 115333, done.
remote: Counting objects: 100% (115333/115333), done.
remote: Compressing objects: 100% (31138/31138), done.
Receiving objects: 100% (6251605/6251605), 2.02 GiB | 3.81 MiB/s, done.
remote: Total 6251605 (delta 85579), reused 112648 (delta 83884)
Resolving deltas: 100% (5179762/5179762), done.
  -> Found config
  -> Found 60-linux.hook
  -> Found 90-linux.hook
  -> Found linux.preset
==> Validating source files with sha256sums...
    archlinux-linux ... Skipped
    config ... Passed
    60-linux.hook ... Passed
    90-linux.hook ... Passed
    linux.preset ... Passed
==> Verifying source file signatures with gpg...
    archlinux-linux git repo ... FAILED (unknown public key A5E9288C4FA415FA)
==> ERROR: One or more PGP signatures could not be verified!

With this issue, I have not already tried applying the patch, even less in a previous version (4.18.6).



NiceGuy wrote:

What about using mkinitcpio with -v (--verbose):

I tried it with this result:

==> Starting build: 4.18.6
  -> Running build hook: [/usr/lib/initcpio/install/base]
    adding file: /bin/busybox
    adding file: /usr/lib/libcrypt.so.1
    adding file: /usr/lib/libc.so.6
         ........................
         400 lines like this    
         ........................
    adding file: /shutdown
    adding file: /hooks/shutdown
==> WARNING: No modules were added to the image. This is probably not what you want.
==> Creating gzip-compressed initcpio image: /boot/initramfs-yo_linux_build_4.18.6.img
72878 blocks
==> Image generation successful

Same issue at reboot, it blocked at "Loading initial ramdisk ..."


I have not succeeded to apply the patch and compile the 4.18.6 kernel, I need to do it to check if the patch fixes my kernel panic boot issue. Any idea with the kernel compilation? PKGBUILD way or make way?

Thanks a lot for your time!

Last edited by Yann (2018-09-15 18:55:46)


all different - all equal

Offline

#9 2018-09-15 19:11:48

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

Makepkg#Signature_checking
GnuPG#Use_a_keyserver
With the key imported makepkg should then be able to verify the source.  You still need to change the PKGBUILD to add the patch.

Offline

#10 2018-09-17 18:27:52

Yann
Member
Registered: 2017-11-23
Posts: 235

Re: [SOLVED] Compile linux kernel WARNING: No modules added to the image

It's done!!

As you suggested I use the PKGBUILD way:

  • use asp:

    asp export linux
  • copy the patch to the root directory

  • edit the PKGBUILD adding the patch to the source array (check the prepare() function too)

  • use updpkgsums to recalculate all the hash including the patch

  • use gpg to get the verification public keys

  • then:

    makepkg

                         ... 6 hours later ...

I got my linux-4.18.6.arch1-1-x86_64.pkg.tar.xz with the patch inside without any error nor warning

The PKGBUILD way seems to be the most appropriate way to build a package.

Thanks!


all different - all equal

Offline

Board footer

Powered by FluxBB