Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[upgrading kernel] What does module-rebuild do?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Sir No
Apprentice
Apprentice


Joined: 01 May 2005
Posts: 159
Location: Poland

PostPosted: Fri Oct 07, 2005 8:01 pm    Post subject: [upgrading kernel] What does module-rebuild do? Reply with quote

I've just found this little diamond in the abundant portage tree,
and I just wanted to raise the awareness about this nice tool:

module-rebuild

I already know what it does.
And do you?
_________________
The geeks | Recommended Packages fOr Desktop & Server | Read BBCode Guide!


Last edited by Sir No on Tue Oct 11, 2005 11:47 am; edited 1 time in total
Back to top
View user's profile Send private message
wuzzerd
Guru
Guru


Joined: 05 Jan 2005
Posts: 466
Location: New Mexico

PostPosted: Fri Oct 07, 2005 10:47 pm    Post subject: Re: [Question] What does module-rebuild do? Reply with quote

Sir No wrote:

I already know what it does.
And do you?

Well there is no man page. module-rebuild --help doesn't give me any clear info.

What does it do?
Back to top
View user's profile Send private message
tlailax
Apprentice
Apprentice


Joined: 22 Feb 2004
Posts: 187

PostPosted: Fri Oct 07, 2005 10:51 pm    Post subject: Reply with quote

finds packages that installed modules and rebuilds them for the currently installed kernel. very useful.
Back to top
View user's profile Send private message
coriolan
Apprentice
Apprentice


Joined: 21 Apr 2005
Posts: 273

PostPosted: Sat Oct 08, 2005 8:13 am    Post subject: Reply with quote

Is there a relation to modules-update?
Back to top
View user's profile Send private message
Sir No
Apprentice
Apprentice


Joined: 01 May 2005
Posts: 159
Location: Poland

PostPosted: Tue Oct 11, 2005 11:32 am    Post subject: Reply with quote

coriolan wrote:
Is there a relation to modules-update?

Well, not really.

Suppose that you emerge nvidia binary drivers, out of kernel alsa-drivers, ndiswrapper for wi-fi card, and some other packages that depend on the current kernel. Then you are quite likely to forget over time that ALL of them need to be recompiled in case of kernel upgrade. Of course, it's possible to write down the names of such packages, or even create an "upgrade-kernel" script in bash. But it's a bit of burden, to say politely.

The solution to the above problem (which I already faced) is simple:
Code:
# emerge -av module-rebuild
# module-rebuild list
# module-rebuild rebuild

In short: just run this tool after every kernel upgrade. As simple as that.

You can see in the Gentoo Bugzilla (in the bug #104877) the original discussion on the above topic. And I'm pleased to say, that as the net result the Gentoo Linux Kernel Upgrade Guide has been enhanced with the information on this tool.


@wuzzerd: The lack of the real documentation is (yet) understandable. As one can see in ChangeLog:
Code:
less /usr/portage/sys-kernel/module-rebuild/ChangeLog
...
  18 Aug 2005; Jason Wever <weeve@gentoo.org> module-rebuild-0.5.ebuild:
  Added ~sparc keyword.

  05 Jul 2005; John Mylchreest <johnm@gentoo.org> module-rebuild-0.5.ebuild:
  Marking stable to push new database change. No known, or expected bugs.

*module-rebuild-0.5 (05 Jul 2005)
...
*module-rebuild-0.1 (03 May 2005)

The tool is rather fresh. But it should of course include some documentation, even if it's a distro-specific program.
(Similar to the glsa-check... But let's be nice to the developers ;))

EDIT:
corrected the module-rebuild parameters in the example
_________________
The geeks | Recommended Packages fOr Desktop & Server | Read BBCode Guide!


Last edited by Sir No on Sat Oct 15, 2005 12:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
coriolan
Apprentice
Apprentice


Joined: 21 Apr 2005
Posts: 273

PostPosted: Tue Oct 11, 2005 11:48 am    Post subject: Reply with quote

Sir No wrote:


Suppose that you emerge nvidia binary drivers, out of kernel alsa-drivers, ndiswrapper for wi-fi card, and some other packages that depend on the current kernel. Then you are quite likely to forget over time that ALL of them need to be recompiled in case of kernel upgrade. Of course, it's possible to write down the names of such packages, or even create an "upgrade-kernel" script in bash. But it's a bit of burden, to say politely.


Well, that's what I have been doing anyway. :D

Quote:
The solution to the above problem (which I already faced) is simple:
Code:
# emerge -av module-rebuild
# module-rebuild -p
# module-rebuild

In short: just run this tool after every kernel upgrade. As simple as that.


I have to try that.
Back to top
View user's profile Send private message
Aonoa
Guru
Guru


Joined: 23 May 2002
Posts: 589

PostPosted: Thu Oct 13, 2005 10:05 pm    Post subject: Reply with quote

Thanks for this little piece of candy. I didn't know about it. Will make kernel upgrades somewhat easier. :)
Back to top
View user's profile Send private message
feminista
Apprentice
Apprentice


Joined: 25 Mar 2005
Posts: 182

PostPosted: Fri Oct 14, 2005 7:01 am    Post subject: Reply with quote

Wow. Now there's no reason for me to not upgrade to the newest version of the kernel whenever one comes out. Yay.
Back to top
View user's profile Send private message
xenoscr
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2003
Posts: 123
Location: Indianapolis, IN

PostPosted: Fri Oct 14, 2005 1:43 pm    Post subject: Reply with quote

Sounds handy. Thanks for the tip.

XeNoSCR
Back to top
View user's profile Send private message
Sir No
Apprentice
Apprentice


Joined: 01 May 2005
Posts: 159
Location: Poland

PostPosted: Sat Oct 15, 2005 12:39 pm    Post subject: Reply with quote

Weee... today was the kernel upgrade time :)
And I've found that I must have misled some people. Sorry!!!!

:oops: :oops: :oops: :oops:

The old example of module-rebuild invocation I wrote was incorrect. It really should be:
Code:
# module-rebuild list
# module-rebuild rebuild

I just was a bit too quick with the answer to the coriolan's question...
The original code snippet is now corrected.
_________________
The geeks | Recommended Packages fOr Desktop & Server | Read BBCode Guide!
Back to top
View user's profile Send private message
phsdv
Guru
Guru


Joined: 13 Mar 2005
Posts: 372
Location: Europe

PostPosted: Sun Oct 16, 2005 8:18 am    Post subject: Reply with quote

nice tool indeed, but it seems not to list 'lirc' when I do a
Code:
module-rebuild list
Lirc really needs to be recompiled too!
Back to top
View user's profile Send private message
gerard27
Advocate
Advocate


Joined: 04 Jan 2004
Posts: 2377
Location: Netherlands

PostPosted: Sun Oct 16, 2005 1:50 pm    Post subject: Reply with quote

When I do
Code:
module-rebuild list

it gives me nvidia,alsa and svgalib.
None of them needs re-install.
Back to top
View user's profile Send private message
John-Boy
Guru
Guru


Joined: 23 Jun 2004
Posts: 442
Location: Desperately seeking moksha in all the wrong places

PostPosted: Sun Oct 16, 2005 4:16 pm    Post subject: Reply with quote

Just had a go here and it doesn't list lm_sensors - I'm fairly sure that needs to be rebuilt, (or I've been rebuilding it without need for the past year or so :wink: )
_________________
Like the Roman, I seem to see "the River Tiber foaming with much blood"
Back to top
View user's profile Send private message
Sir No
Apprentice
Apprentice


Joined: 01 May 2005
Posts: 159
Location: Poland

PostPosted: Sun Oct 16, 2005 6:09 pm    Post subject: Reply with quote

Luckily, the creators of module-rebuild already have thought about that functionality.

Just run the program without arguments to see what it is capable of doing:

Code:
# module-rebuild
module-rebuild [options] action [category/package]
Version: 0.5

Where options are:
        -X       - Emerge based on package names,
                   not exact versions.
        -C       - Disable all coloured output.

Where action is one of:
        add      - Add package to moduledb.
        del      - Delete a package from moduledb.
        toggle   - Toggle auto-rebuild of Package.
        list     - List packages to auto-rebuild.
        rebuild  - Rebuild packages.
        populate - Populate the database with any
                   packages which currently install
                   drivers into the running kernel.


So, you can:
  • register a package by hand
    Code:
    # module-rebuild add category/package-name-version-X.Y.Z

  • turn on and off rebuilding for package already registered
    Code:
    # module-rebuild toggle category/package-name-version-X.Y.Z

  • auto-populate the database with installed packages
    Code:
    # module-rebuild populate

Hint:
If you think a package should be included in the module-rebuild's database by default, and it isn't, then file a bug in the bugzilla. As this is a new program, I'm positively sure that such a package would be added quickly (if your request is valid, of course).
_________________
The geeks | Recommended Packages fOr Desktop & Server | Read BBCode Guide!


Last edited by Sir No on Wed Oct 26, 2005 10:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sir No
Apprentice
Apprentice


Joined: 01 May 2005
Posts: 159
Location: Poland

PostPosted: Sun Oct 16, 2005 6:28 pm    Post subject: Reply with quote

@phsdv:
Make sure you know which version of lirc you want to be rebuilt. Then add it to the database:
Code:
# equery list lirc
# module-rebuild add app-misc/lirc-<your_version_here>


@Gerard van Vuuren:
You should try the following for each package you don't want to be rebuilt:
Code:
# module-rebuild toggle <package_to_ignore>


@John-Boy:
I don't think lm_sensors are really needed to be rebuilt. Look at the corresponding ebuild file and search for the word 'kernel':
Code:
# less $(equery which lm_sensors)

If you have a good eye, you'll notice that the ebuild only CHECKS if your 2.6 kernel supports lm_sensors, or if the lm_sensors-modules is installed for 2.4 kernel. Decide yourself ;)


@everybody else:
Ok people, now you are on your own.
Try experimenting with the options and/or post reports in bugzilla.
I've just announced the tool and the rest is up to you :mrgreen:
_________________
The geeks | Recommended Packages fOr Desktop & Server | Read BBCode Guide!
Back to top
View user's profile Send private message
moixa
n00b
n00b


Joined: 02 May 2003
Posts: 20

PostPosted: Mon Oct 24, 2005 1:15 pm    Post subject: Difference to kernelmod-rebuild? Reply with quote

Anyone knows the difference of module-rebuild to app-portage/kernelmod-rebuild?
Two similar utils in the tree?
_________________
--
GPG-Key: 0xEF37FF28 (1024/4096 - DSA/ELG-E)
Fingerprint: 3C4B 155F 2621 CEAF D3A6 0CCB 937C 9597 EF37 FF28
Back to top
View user's profile Send private message
amne
Bodhisattva
Bodhisattva


Joined: 17 Nov 2002
Posts: 6378
Location: Graz / EU

PostPosted: Mon Oct 24, 2005 3:05 pm    Post subject: Re: Difference to kernelmod-rebuild? Reply with quote

moixa wrote:
Anyone knows the difference of module-rebuild to app-portage/kernelmod-rebuild?
Two similar utils in the tree?

app-portage/kernelmod-rebuild doesn't seem to be in the tree (any more?).
_________________
Dinosaur week! (Ok, this thread is so last week)
Back to top
View user's profile Send private message
johnm
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 14
Location: Isle of Man, UK

PostPosted: Tue Oct 25, 2005 10:20 am    Post subject: Reply with quote

I'm glad to see this has been so useful for people. Of course any enhancement requests are welcome through bugzilla (and private mail).

Just to quickly address a few concerns:
The moduledb is actually a flat file database, which is mostly managed through the linux-mod eclasses.
Almost every kernel module is using this eclass already, and those that aren't should be. If you find any packages which dont automatically add themselves (assuming they were recently installed) to the moduledb, then that is a package bug which needs fixing.

Recently I have noticed: svga & lirc and thats about it and I will sort these accordingly.
RE: the documentation. There wont be much of it, but if you find a man page useful then I can sort that out for you.

Good so see it helping people.
Back to top
View user's profile Send private message
St. Joe
Apprentice
Apprentice


Joined: 13 Apr 2005
Posts: 242
Location: USA

PostPosted: Wed Oct 26, 2005 7:41 pm    Post subject: Reply with quote

Sir No wrote:

  • auto-populate the database with installed packages
    Code:
    # module-update populate


Maybe this should be?:

Code:
# module-rebuild populate


Sir No wrote:
And I'm pleased to say, that as the net result the Gentoo Linux Kernel Upgrade Guide has been enhanced with the information on this tool.


It says in that guide:

"Reinstalling external modules...To ensure these packages will build against the source tree at /usr/src/linux, first uninstall the packages, then re-emerge them. If old sources for these packages are kept by portage, this uninstall/re-emerge procedure will make sure that they are rebuilt to work with the new kernel.

We provide you with an easy tool (sys-kernel/module-rebuild) which rebuilds all the kernel modules you have installed using separate ebuilds."


When would I not need to ensure the packages get built against /usr/src/linux?
Only if there are old applicable portage sources?
_________________
For every hammer there is a nail.
For every nail there is a thumb.
Back to top
View user's profile Send private message
makomk
n00b
n00b


Joined: 15 Jul 2005
Posts: 46
Location: Not all there

PostPosted: Wed Oct 26, 2005 8:20 pm    Post subject: Reply with quote

This is quite neat. I'm not sure if I'm going to use it though, because I already have a kernel module rebuild script lying around which I use (from the forums somewhere) - and that handled lirc out-the-box (whereas this currently requires you to run "module-rebuild populate" or it won't rebuild it). On the plus side, module-rebuild is in portage and should in theory be faster.

(The script is the following; no idea where I got it from, but it seems to work. Basically, it rebuilds all the packages that installed files to /lib/modules, rather than using the moduledb like module-rebuild.)
Code:
grep -l '^dir /lib/modules' /var/db/pkg/*/*/CONTENTS | \
sed -e 's/\/var\/db\/pkg\//=/' -e 's/\/CONTENTS//' -e \
's/^=.*\///' -e 's/-[0-9]*\..*$//' | sort -u | xargs emerge -1
Back to top
View user's profile Send private message
Sir No
Apprentice
Apprentice


Joined: 01 May 2005
Posts: 159
Location: Poland

PostPosted: Wed Oct 26, 2005 10:34 pm    Post subject: Reply with quote

St. Joe wrote:
Sir No wrote:

  • auto-populate the database with installed packages
    Code:
    # module-update populate


Maybe this should be?:

Code:
# module-rebuild populate



You're right! I've edited my post to fix that.
_________________
The geeks | Recommended Packages fOr Desktop & Server | Read BBCode Guide!
Back to top
View user's profile Send private message
derelict
n00b
n00b


Joined: 18 Mar 2006
Posts: 2
Location: Switzerland

PostPosted: Sat Mar 18, 2006 2:43 pm    Post subject: Reply with quote

just my two cents here:

module-rebuild didn't get any of my kernel dependent packages while populating its database. So i just did the following:
Code:
equery depends virtual/linux-sources

in order to get a list of all ebuilds requiring kernel sources.

After that i made the following script to update the module-rebuild database each time i upgrade my (custom) kernel:
Code:
#!/bin/bash
for foo in $(equery depends virtual/linux-sources); do module-rebuild add $foo; done
module-rebuild rebuild


Allthough i'm not quite sure if this is "the way of doing things right" since i've switched to gentoo just a few days ago ;-)

But maybe it's of any use for anybody

Cheers

Marcel
Back to top
View user's profile Send private message
slycordinator
Advocate
Advocate


Joined: 31 Jan 2004
Posts: 3065
Location: Korea

PostPosted: Sat Mar 18, 2006 8:44 pm    Post subject: Reply with quote

Gerard van Vuuren wrote:
When I do
Code:
module-rebuild list

it gives me nvidia,alsa and svgalib.
None of them needs re-install.


YES THEY DO!

When you installed those they built the module and copied it into that kernel-version's module directory.
And when you install a new kernel... those modules must be built again and put into the directory for that new kernel's modules.

edit:
Though "module-rebuild list" actually just lists all kernel module ebuilds you have installed, regardless of if they were already reinstalled.

So like if I did "module-rebuild rebuild && module-rebuild list" the ones that were rebuilt would still be listed. So if that's what you're referring to then yes you're right.
Back to top
View user's profile Send private message
nowinter
Tux's lil' helper
Tux's lil' helper


Joined: 30 Apr 2006
Posts: 90

PostPosted: Tue May 23, 2006 12:26 pm    Post subject: Reply with quote

very nice of you to post this explanation. i looked for a tool like that and suspected this was it, but, as said, no man page/--help of any clearness are there, so i just google'd on 'modules-update'. guess what was the first result? :D :P thanks again
_________________
All In All Is All We All Are
Back to top
View user's profile Send private message
96140
Retired Dev
Retired Dev


Joined: 23 Jan 2005
Posts: 1324

PostPosted: Tue May 23, 2006 1:13 pm    Post subject: Reply with quote

How'd you miss it? I added a section on it to the Kernel Upgrade Guide. It really is a handy utility. :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum