Welcome to the Linux Foundation Forum!

Unable to install the custom Kernel

commands used

$ make localmodconfig
$ lsmod > /tmp/my-lsmod
$ make LSMOD=/tmp/my-lsmod localmodconfig
$ sudo make -j3 all
$ su -c "make modules_install install"

Comments

  • dipsonu10
    dipsonu10 Posts: 13

    Please help

  • coop
    coop Posts: 782

    The error message in fact tells you exactly what is wrong. Turn off "CONFIG_x86_X32" in your .config file as your binutils does not support it and you are unlikely to need it. In the config menus, this is under "Binary Emulations" after Bus Options and before Virtualization. I'd recommend you do

    grep CONFIG_X86_X32 /boot/config*
    
    /boot/config-4.18.0-305.19.1.el8_4.x86_64:# CONFIG_X86_X32 is not set
    /boot/config-5.14.13:# CONFIG_X86_X32 is not set
    /boot/config-5.14.14:# CONFIG_X86_X32 is not set
    /boot/config-5.15.0-rc6:# CONFIG_X86_X32 is not set
    

    on my system. I don't know why localmodconfig gave you this, but the error message is actually rather precise
    in this case. Or I am wrong :(

  • dipsonu10
    dipsonu10 Posts: 13

    okay trying

  • dipsonu10
    dipsonu10 Posts: 13
    edited October 25


    so need to set the values = 'n' as I am running it in VMWare??

  • ShuahKhanLF
    ShuahKhanLF Posts: 91
    edited October 25

    Does vmware support 64-bit kernels? If this is the default localmodconfig, then you night have to install 32-bit binutils

  • dipsonu10
    dipsonu10 Posts: 13

    I had tried it in desktop computer there also it is showing this error

  • dipsonu10
    dipsonu10 Posts: 13

    cloned from this repo

  • Okay. Try checking out the latest stable kernel instead from the stable git - and then generate localmodconfig - is your desktop 32-bit?

  • dipsonu10
    dipsonu10 Posts: 13

    okay will try mine desktop is 64-bit

  • coop
    coop Posts: 782
    edited October 26

    Unless you are working with embedded hardware, it is extremely unlikely you have 32 bit on either the host or the guest. VMWare does indeed run 64 bit fully (and you can run a 32-bit guest on a 64-bit host) but please do not use 32-bit at all. And you just showed you have the option set to "Y" so mystery solved. Run your favorite configuration program (probably make menuconfig) and just change the option as I explained to you and I hope this goes away. Editing .config directly is a bad idea in general but can work. Your use of the environment variable "LSMOD" seems to make no sense to me, your commands are just "make localmodconfig" and "make". Unless this variable is part of the course.

    make localmodconfigwill only work seamlessly when the kernel version you are running is not to distant from the one you are configuring. i.e., you cannot run 4.18 and configure 5.15 with "make localmodconfig" and expect it to work without a lot of
    inspection. You are running a stock ubuntu 5.11, but you are not saying what you are trying to configure.

    I don't know why ubuntu seems to have this set to "y" and while the kernel seems to work for them, it sounds like the tool chain
    is defective as the binutils doesn't support it.

    Good luck!

  • dipsonu10
    dipsonu10 Posts: 13

    So should I just run these commands??
    $ cp /boot/config-$(uname -r) .config
    $ make -j4 all
    $ sudo su -c "make modules_install install"

    and if it is successful then update the grub and reboot

  • dipsonu10
    dipsonu10 Posts: 13

    so, in a nutshell the localmodconfig can't be used when the 2-kernel version are very distinct from each other in a sense

  • My preferred approach is - cp /boot/config-$(uname -r) .config

  • coop
    coop Posts: 782

    The main problem with doing it this way, is that it may take hours to compile. If you are using a .config from a distribution kernel it will have every network card, every sound card, and enormous amounts of hardware you don't have, compiled as modules. Literally I have seen this take hours to compile when a slimmed down configuration, such as that from localmodconfig, will take 5-20 minutes depending on variables. At a minimum you should go through menuconfig after the copy to eliminate totally irrelevant hardware. Or just keep busy doing something else. Doing it this way has always been an act of desperation for me if you care about how long it takes. Also some distributions do not always keep the config file in /boot and /proc/config.gz may not been there either depending on the kernel configuration itself.

    And none of this says why make localmodconfig did not give a working setup, which it should, so there is no guarantee this will work either if your system is missing some ingredient for compilation. Been there, done that.

  • dipsonu10
    dipsonu10 Posts: 13

    So what commands should I use :)

  • coop
    coop Posts: 782

    make menuconfig -- either turn off the option or use the full config and turn thiings off. Or just hit make and go for a long walk

  • thescientist
    thescientist Posts: 3
    edited November 15

    I'm not sure if @dipsonu10 fixed this issue, however I just ran into the same problem. My solution was as follows.

    I'm going to leave @dipsonu10 with advice on how to ask questions before I start. 'please help' is the laziest approach you can take. Start off by explaining the problem you are having. Tell people what you have tried, what you have looked up and why something didn't work. This makes it easier for people to help you and 99% of the time in doing this you solve your own problem.

    I had to google around a bit to find solutions for these problems, this works on my system. It may or may not work on yours.

    We start by addressing CONFIG_X86_X32

    1)
    linux_stable$ ls /boot | grep config
    config-4.19.0-18-amd64
    config-5.10.0-9-amd64

    2)
    linux_stable$ cp /boot/config-5.10.0-9-amd64 .config

    3)
    linux_stable$ grep CONFIG_X86_X32 .config
    .config:CONFIG_X86_X32=y
    .config:CONFIG_X86_X32_DISABLED=y

    Take note of the following .config:CONFIG_X86_X32=y
    This is our "problem line"

    To fix this we need to type the following, and read it very carefully otherwise we will be cursed with issues like this for the rest of our lives.

    linux_stable$ man sed

    linux_stable$ sed -i 's/CONFIG_X86_X32=y/CONFIG_X86_X32=n/g' .config

    Now, we will address,
    sed: can't read modules.order: No such file or directory
    make[1]: *** [Makefile:1304: modinst] Error 2
    make: *** [Makefile:327: __build_one_by_one] Error 2

    1)
    linux_stable$ grep CONFIG_SYSTEM_TRUSTED_KEYS .config
    .config:CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem"

    Take note of the following:
    .config:CONFIG_SYSTEM_TRUSTED_KEYS="debian/certs/debian-uefi-certs.pem"
    This is the problem line.

    2)
    linux_stable$ sed -ri '/CONFIG_SYSTEM_TRUSTED_KEYS/s/=.+/=""/g' .config

    Now, we just need to follow the instructions.

    inux_stable$ make oldconfig
    inux_stable$ make -j20 all
    inux_stable$ su -c "make modules_install install"
    .....

  • coop
    coop Posts: 782

    Thanks for the help. A couple of concerns though:

    1) editing .config directly is not usually wise as it can cause all kind sof dependency conflicts and in fact your changes can be reversed when you do a make as the kernel build system works very hard to make sure all is consistent and possible

    2) make -j 20 is a bad idea unless you have at least 20 cpus/cores. There are long disputes about the best -j value but it is always safe to use something like the number of cpus, which you can get from make -j $(nproc)

  • @coop said:
    Thanks for the help. A couple of concerns though:

    1) editing .config directly is not usually wise as it can cause all kind sof dependency conflicts and in fact your changes can be reversed when you do a make as the kernel build system works very hard to make sure all is consistent and possible

    2) make -j 20 is a bad idea unless you have at least 20 cpus/cores. There are long disputes about the best -j value but it is always safe to use something like the number of cpus, which you can get from make -j $(nproc)

    Thank you for the reply @coop. I have made notes in my personal 'cheat sheets', this will help me in the future.

  • Editing config files is something you attempt if you know what you are doing. LFD103 walks you through meuconfig and how to enable config options. Following that could be helpful.

  • @ShuahKhanLF said:
    Editing config files is something you attempt if you know what you are doing. LFD103 walks you through meuconfig and how to enable config options. Following that could be helpful.

    Hi @ShuahKhanLF
    Noted, I appreciate your feedback.

  • dipsonu10
    dipsonu10 Posts: 13



    Thank you @ShuahKhanLF @thescientist @coop
    Finally compiled and installed it on my desktop 🎉

  • dipsonu10
    dipsonu10 Posts: 13

    used the commands

    all under sudo su

    cp -v /boot/config-$(uname -r) .config
    make menuconfig # save it as default
    
    make -j4
    make modules_install
    make install
    
    update-grub
    

    the only downside was that I compiled the whole kernel ig

  • dipsonu10
    dipsonu10 Posts: 13

    what does these do in '.config'
    CONFIG_SYSTEM_TRUSTED_KEYS
    CONFIG_SYSTEM_REVOCATION_KEYS

  • "git grep SYSTEM_TRUSTED_KEYS" is your friend for questions like this one.

Categories

Upcoming Training