Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

[solved] How to use LOCALVERSION effectively?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

[solved] How to use LOCALVERSION effectively?

  • Quote

Post by pjp » Wed Nov 12, 2025 7:12 pm

To begin, my understanding of how the kernel / modprobe finds the correct modules to use is from uname -r, as in /lib/modules/6.6.101-gentoo. After trying to configure a LOCALVERSION and doing some research, I expect uname -r excludes LOCALVERSION.

Presuming that is correct, what I was wanting to achieve is having modules built and installed in the appropriate directory based on LOCALVERSION so that a working version could co-exist with testing and potentially broken versions, such as /lib/modules/6.6.101-gentoo and /lib/modules/6.6.101-gentoo-c1.

For /boot files, I have a custom installkernel script which receives the appended LOCALVERSION (-c1 here):

Code: Select all

$ ls -1 linux-6.6.101-gentoo/install.path/boot/*-c1
linux-6.6.101-gentoo/install.path/boot/System.map-6.6.101-gentoo-c1
linux-6.6.101-gentoo/install.path/boot/config-6.6.101-gentoo-c1
linux-6.6.101-gentoo/install.path/boot/vmlinuz-6.6.101-gentoo-c1
However, modules_install does not seem to automatically handle appending LOCALVERSION, seemingly indicating that it is excluded from the /lib/modules path (from the build output location):

Code: Select all

$ ls -1 linux-6.6.101-gentoo/install.path/lib/modules/
6.6.101-gentoo
In this case, I had already built the "non -c1" version which created this directory. Subsequent use of 'make modules_install' has nothing to do (I anticipated it would have created the -c1 directory structure and rebuilt everything). As it isn't doing that, it seems the kernel would not find the correct location for modules where it seems most useful, from the -c1 location.

Documentation/kbuild/modules.rst under 5. Module Installation states: Modules which are included in the kernel are installed in the directory: /lib/modules/$(KERNELRELEASE)/kernel/, seemingly excluding LOCALVERSION. I see no other references to modifying the path (only adding a prefix) or to LOCALVERSION.

That would seem to make LOCALVERSION minimally useful as it would still require manual or custom means to manage build and final destinations for /lib/modules/<LOCALVERSION> files.

Am I mistaken? Is there a better approach?
Last edited by pjp on Thu Nov 13, 2025 5:10 pm, edited 1 time in total.
Quis separabit? Quo animo?
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Wed Nov 12, 2025 8:18 pm

Unsure if I understand your point correctly...

Anyhow LOCALVERSIONed kernels have been used here extensively (if not exclusively) for years to be booted by grub/UEFI.
Most modules are "magically" loaded at startup time. Some may be loaded later upon need.

However no modules are explicitly loaded from hardcoded /etc/modules-load.d/modules.conf, /etc/conf.d/modules or alike.

EDIT:

Code: Select all

grep LOCALVERSION /usr/src/linux/.config
CONFIG_LOCALVERSION="-std"
# CONFIG_LOCALVERSION_AUTO is not set

uname -r;ls /lib/modules/$(uname -r)
6.17.7-gentoo-std
build              modules.builtin.alias.bin  modules.order
extra              modules.builtin.bin        modules.softdep
kernel             modules.builtin.modinfo    modules.symbols
modules.alias      modules.dep                modules.symbols.bin
modules.alias.bin  modules.dep.bin            modules.weakdep
modules.builtin    modules.devname
Sorry if my report doesn't clarify how things should work in your use case.

Thks 4 ur attention, interest & support.
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Nov 12, 2025 9:05 pm

pjp,

LOCALVERSION appears in the directory name where the modules are stored, so that achieves you aim.

Here be dragons though. Not all out of tree modules respect LOCALVERSION.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

  • Quote

Post by CaptainBlood » Wed Nov 12, 2025 10:53 pm

NeddySeagoon wrote:Not all out of tree modules respect LOCALVERSION.
That must right indeed...

As a side note both

Code: Select all

sys-fs/vhba
net-misc/r8168
are working fine here.

Thks 4 ur attention, interest & support
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Wed Nov 12, 2025 11:22 pm

CaptainBlood wrote:Unsure if I understand your point correctly...
For this package: sys-kernel/gentoo-sources-6.6.101:6.6.101::gentoo

During the build process (make ... modules_install), files are installed in the build environment directory <BUILD_ROOT>/lib/modules/6.6.101-gentoo. With the LOCALVERSION set to "-c1" the modules are installed into <BUILD_ROOT>/lib/modules/6.6.101-gentoo. Instead, I expect them to be installed to BUILD_ROOT/lib/modules/6.6.101-gentoo-c1. So I'm wondering what is "supposed" to happen.
CaptainBlood wrote:Most modules are "magically" loaded at startup time. Some may be loaded later upon need.
I'm partially trying to understand the "magic" parts.
CaptainBlood wrote:uname -r;ls /lib/modules/$(uname -r)
6.17.7-gentoo-std
build modules.builtin.alias.bin modules.order
extra modules.builtin.bin modules.softdep
kernel modules.builtin.modinfo modules.symbols
modules.alias modules.dep modules.symbols.bin
modules.alias.bin modules.dep.bin modules.weakdep
modules.builtin modules.devname[/code]
Sorry if my report doesn't clarify how things should work in your use case.
That clarifies that uname -r includes LOCALVERSION. In my case, LOCALVERSION isn't being used for the module directory name. That would seem to indicate I'm doing something wrong, or 'make ... modules_install' won't update the directory if existing modules don't need to rebuilt. That it isn't creating the LOCALVERSION directory seems like a bug, but I can test.

Thanks for the info.
Quis separabit? Quo animo?
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Wed Nov 12, 2025 11:25 pm

NeddySeagoon wrote:pjp,

LOCALVERSION appears in the directory name where the modules are stored, so that achieves you aim.

Here be dragons though. Not all out of tree modules respect LOCALVERSION.
Thanks. For me, it isn't in the directory name. But at least now I know it should be.

I'm guessing that out of tree modules refer to things like Nvidia and ZFS. At least for now I'm not using any of those. I"ll have to make a note about that.

Thanks.
Quis separabit? Quo animo?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Nov 13, 2025 11:04 am

pjp,

nvidia was certainly a problem a few years ago.
I stopped buying nvidia when the kept dropping support for my video cards. That solved the problem for me :)

It may be fixed now. I have no reason to test any longer.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Thu Nov 13, 2025 5:10 pm

I was just listing what I thought were examples of out of tree modules.

While I do have an old nvidia I still use, it's only used for a console. I don't mess with any binary drivers for it, and it just works.


Anyway, back to the LOCALVERSION issue, 'make mrroper' before rebuilding did build modules recognizing the LOCALVERSION directory. It would be nice if that could be done simply because LOCALVERSION was changed, but at least it works. I don't often build multiple versions of the same kernel.
Quis separabit? Quo animo?
Top
skellr
Veteran
Veteran
User avatar
Posts: 1035
Joined: Sat Jun 18, 2005 1:34 am
Location: The Village, Portmeirion

  • Quote

Post by skellr » Fri Nov 14, 2025 12:01 am

pjp wrote:Anyway, back to the LOCALVERSION issue, 'make mrroper' before rebuilding did build modules recognizing the LOCALVERSION directory. It would be nice if that could be done simply because LOCALVERSION was changed, but at least it works. I don't often build multiple versions of the same kernel.
I ran a test and added LOCALVERSION. Rebuilt the kernel without cleaning for the 2nd time and it installed modules in a new directory with localversion in the directory name.

This "should" also work as you were expecting it to. Not sure what is going on.
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Sat Nov 15, 2025 2:52 am

Hah! Thanks. I have another system to upgrade, so I'll try to do it this weekend and post the results.

I can't imagine what I could have done wrong. As I mentioned, my installkernel script used the correct LOCALVERSION name that gets passed to it: https://www.kernel.org/doc/html/latest/ ... build.html

It was only the modules themselves that didn't get installed correctly. That's why I presumed something was "stuck," not having forced an update.

EDIT:

I had already built the other kernel, so that made it easier. After adding a LOCALVERSION, modules_install used the LOCALVERSION.

I have no idea what went wrong with the other system.
Quis separabit? Quo animo?
Top
Post Reply

10 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy