The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Module rebuild set
Introduction
This page will try to describe a special portage's set, @module-rebuild
. Documentation of this set is missing or incomplete for regular users. This is requested in https://bugs.funtoo.org/browse/FL-3300
Set's core
@module-rebuild
is one of built-in portage package sets and is installed by default on every boxes. Currently, it's very simple one which is consist of following:
root # Installed packages that own files inside /lib/modules. [module-rebuild] class = portage.sets.dbapi.OwnerSet world-candidate = False files = /lib/modules
As we can see this set calls special class called portage.sets.dbapi.OwnerSet
, is special handler for sets, which determines a list of package(s) that owns file(s) installed on users box. Currently this class has only one possible variable -- files
, which defines what directories or files to look for package that owns that directory/file. One may guess that @module-rebuild
gives a list of packages that installed anything into /lib/modules
.
A common case for packages that installing into above mentioned directory are 3-rd-party kernel modules, such as x11-drivers/nvidia-drivers
or net-misc/r8168
and many more.
Use case
Let's have a look when and why user should use @module-rebuild. So far, it's main aim is to rebuild the packages after kernel updates. Now that if such kernel module as x11-drivers/nvidia-drivers
installed against older kernel version and newer kernel update has happened and newer ker nel is selected, blindly rebooting will result in nvidia module will not start and consequently your X start will fail too. You need to rebuild x11-drivers/nvidia-drivers
and also any other modules installed against newly built and selected kernel. Such bulk rebuilds is what this particular set performs. Real example, update debian-sources happened and now running emerge -1 -av @module-rebuild
:
w520 nvidia-drivers # emerge -1 -av @module-rebuild These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R #] sys-kernel/debian-sources-4.11.11:4.11.11::core-kit USE="binary" 0 KiB [ebuild U ] sys-power/bbswitch-0.8-r1::nokit [0.8::gentoo] 0 KiB [ebuild U ] sys-power/acpi_call-1.1.0-r2::nokit [1.1.0-r1::gentoo] 0 KiB [ebuild R ] x11-drivers/nvidia-drivers-381.22:0/381::xorg-kit [381.22:0/381::funtoo-overlay] USE="X driver gtk3 kms (multilib) tools uvm -acpi -compat -pax_kernel -static-libs -wayland" ABI_X86="(64) -32 (-x32)" 0 KiB Total: 4 packages (2 upgrades, 2 reinstalls), Size of downloads: 0 KiB Would you like to merge these packages? [Yes/No]
But we have some interesting result which is that this set trying to rebuild fresh kernel. This is special case on Funtoo Linux systems because default sys-kernel/debian-sources
installed a lot of modules into /lib/modules
. This seems unnecessary, so when using default kernel, a more correct way would be:
w520 / # emerge -1 -av @module-rebuild --exclude debian-sources These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild U ] sys-power/bbswitch-0.8-r1::nokit [0.8::gentoo] 0 KiB [ebuild U ] sys-power/acpi_call-1.1.0-r2::nokit [1.1.0-r1::gentoo] 0 KiB [ebuild R ] x11-drivers/nvidia-drivers-381.22:0/381::xorg-kit [381.22:0/381::funtoo-overlay] USE="X driver gtk3 kms (multilib) tools uvm -acpi -compat -pax_kernel -static-libs -wayland" ABI_X86="(64) -32 (-x32)" 0 KiB Total: 3 packages (2 upgrades, 1 reinstall), Size of downloads: 0 KiB Would you like to merge these packages? [Yes/No]
Hopefully, you now armed with knowledge on how to mange kernel updates and kernel modules with portage features.