注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Module rebuild set"

From Funtoo
Jump to navigation Jump to search
Line 2: Line 2:
This page will try to describe a special portage's set, <code>@module-rebuild</code>. Documentation of this set is missing or incomplete for regular users. This is requested in https://bugs.funtoo.org/browse/FL-3300
This page will try to describe a special portage's set, <code>@module-rebuild</code>. 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 ==
== Set's core ==
<code>@module-rebuild</code> is one of built-in portage package sets and is installed by default on every boxes. Currently, it's very simple set which is consist of following:
{{c|@module-rebuild}} is one of built-in portage package sets and is installed by default on every boxes. Currently, it's very simple set which is consist of following:


{{console|body=
{{console|body=
Line 11: Line 11:
files = /lib/modules
files = /lib/modules
}}
}}
As we can see this set calls special class called <code>portage.sets.dbapi.OwnerSet</code> a special handler for sets, which determines list of package(s) that owns file(s) installed on users box. Currently, this class has only one possible variable -- <code>files</code>, which defines what directories or files to look for package that owns that directory/file. One may guess that <code>@module-rebuild</code> gives a list of ebuilds that installed anything into <code>/lib/modules</code>.
As we can see this set calls special class called {{c|portage.sets.dbapi.OwnerSet}} a special handler for sets, which determines list of package(s) that owns file(s) installed on users box. Currently, this class has only one possible variable -- <code>files</code>, which defines what directories or files to look for package that owns that directory/file. One may guess that {{c|@module-rebuild}} gives a list of ebuilds that installed anything into {{c|/lib/modules}}.
A common case for packages that installing into above mentioned directory are 3-rd-party kernel modules, such as <code>x11-drivers/nvidia-drivers</code> or <code>net-misc/r8168</code> and many more.
A common case for packages that installing into above mentioned directory are 3-rd-party kernel modules, such as {{c|x11-drivers/nvidia-drivers}} or {{c|net-misc/r8168}} and many more.


== Use case ==
== 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  <code>x11-drivers/nvidia-drivers</code> installed against older kernel version and newer kernel update has happened and newer kernel is selected, blindly rebooting will result in nvidia module will not start and consequently your X start will fail too. You need to rebuild <code>x11-drivers/nvidia-drivers</code> and also any other modules installed against newly built and selected kernel. Such bulk rebuilds is what this particular portage set allows to do. Real example, update to debian-sources happened and now running <code> emerge -1 -av @module-rebuild</code>:
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  {{c|11-drivers/nvidia-drivers}} installed against older kernel version and newer kernel update has happened and newer kernel is selected, blindly rebooting will result in nvidia module will not start and consequently your X start will fail too. You need to rebuild {{c|x11-drivers/nvidia-drivers}} and also any other modules installed against newly built and selected kernel. Such bulk rebuilds is what this particular portage set allows to do. Real example, update to debian-sources happened and now running {{c|emerge -1 -av @module-rebuild}}:
{{console|body=
{{console|body=
w520 / # emerge -1 -av @module-rebuild
w520 / # emerge -1 -av @module-rebuild
Line 30: Line 30:
Would you like to merge these packages? [Yes/No]
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 because default <code>sys-kernel/debian-sources</code> installed a lot of modules into <code>/lib/modules</code>. This seems unnecessary, so when using default kernel, a more correct way would be:
But,  we have some interesting result which is that this set trying to rebuild fresh kernel. This is special case on Funtoo Linux because default {{c|sys-kernel/debian-sources}} installed a lot of modules into {{c|/lib/modules}}. This seems unnecessary, so when using default kernel, a more correct way would be:


{{console|body=
{{console|body=
w520 / # emerge -1 -av @module-rebuild --exclude debian-sources
w520 / # emerge -1 -av @module-rebuild --exclude debian-sources-lts


These are the packages that would be merged, in order:
These are the packages that would be merged, in order:

Revision as of 19:13, December 4, 2018

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 set 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 a special handler for sets, which determines 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 ebuilds 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 11-drivers/nvidia-drivers installed against older kernel version and newer kernel update has happened and newer kernel 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 portage set allows to do. Real example, update to debian-sources happened and now running emerge -1 -av @module-rebuild:

w520 / # 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 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-lts

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 manage kernel updates and kernel modules rebuilds with portage features.