LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-15-2009, 01:34 AM   #1
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
automating module rebuilds on kernel upgrades - for the computer illiterate


I built my sister a newer computer recently. It's already set up with Ubuntu 8.10, but I've been sitting on it for a while, waiting for a good time to get it to her. With Lenny's release I'm thinking about installing Debian instead, there are a number of bugs in Intrepid and I'm thinking Lenny -once set up well enough- would be a more reliable and long-term solution for her needs.

The only thing that's stopping me is the occasional need to rebuild kernel modules, which I expect my sister would have a difficult time with. There's an Nvidia card and Virtualbox(which isn't strictly necessary). I know how to easily rebuild Virtualbox's module with one command, and I can easily determine how to rebuild Nvidia's blob with module-assistant. Is there a way I can automatically run "/etc/init.d/vboxdrv setup" after kernel updates, and module-assistant/depmod after kernel and/or nvidia driver updates?

Or am I going about this the wrong way?

edit: what about dkms? I found this seemingly offical page, but it doesn't look too promising.

Last edited by lurko; 02-15-2009 at 01:39 AM.
 
Old 02-15-2009, 09:28 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
I think you're going about it the wrong way. You've completely written your sister off as incapable of learning relatively simple tasks. If she is learning disabled or simply apathetic(like my ex-wife), then there will be problems with anything, of course. If you think it necessary to put up an idiot-proof system for her, then I suggest you write a shell script and print out the instructions for running the shell script for her. Of course, if she's anything like my ex, she'll call you and ask for step-by-step help in running it. I'd suggest you try to get her interested, instead. It will consume far less of your time in the long run.
 
Old 02-16-2009, 01:32 AM   #3
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Original Poster
Rep: Reputation: 35
Oh what a wonderful world that would be eh! Where people utterly lacking in geek tendencies take any interest in how their computers work. Just think how weak the botnets would become! It would surely be a paradise! :P

I haven't completely written her off - I think she could probably manage running a script that would get the job done. It's not difficult, even on the console, to login and enter one command, however I'm not so sure I'll be able to help her understand when she'd need to run it, apart from the times she turns on her computer and gets dumped on VT1 because X won't start. I don't think she'll take too kindly to using the console at all though. The problem is she just doesn't care to know about this stuff. I couldn't even help her to understand what a package was (I'm surely partly to blame for sucking so bad at explaining anything - but only a small part!) so I'd really like to to automate this kind of thing for her.

A bit of googling revealed the /etc/kernel-img.conf file to me. It seems I can, probably quite easily, get the blob rebuilt on kernel updates using the same postinst-hook as is used for grub. The manpage seems to indicate I can do a postinst-hook for source packages as well, but I'm not sure if it will work in practice, the way I'm expecting it too.

The manpage says:
Quote:
src_postinst_hook -- Unlike the other hook variables, this is meant for a script run during the post inst of a docs, headers or a source package. --irrelevancy re: deprecated behaviour and script path info snipped-- This script shall be called with two arguments, the first being the name of the package being installed (could be kernel-source-X.X.XX or kernel-headers-X.X.XX), and the second argument being the version of the package being installed. Errors in the script shall cause the postinst to fail.
So if I use a line like...:
src_postinst_hook = /path/to/script/with/m-a/commands

...and I use nvidia-kernel-source for the first variable in the script, that script be called every time a source package is installed? Is there no way I can specify to only run during the post-installation for nvidia-kernel-source? And where does the version number fit into it?

And if I use a line like this also...:
postinst_hook = /path/to/script/with/m-a/commands

...is that compatible with the existing postinst_hook line (= update-grub)? Or would I need to put both scripts on the same postinst_hook line? Or would I need to make a new script that calls update-grub at the end? Would this build a module for the newly installed/updated kernel or for the currently running kernel?

Or is holding my sister's hand through running a script herself everytime still a better solution? Surely if Debian can automatically run a script to update grub, there must be a way to setup similar behaviour for the nvidia blob.
 
Old 02-16-2009, 07:50 AM   #4
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Install Lenny but make sure the dummy packages are not installed for the kernel (such as linux-image-2.6-686 ). if the dummy package is there uninstall it and just leave the actual kernel package linux-image-2.6.26-1-686. Then your sister can safely accept any regular security updates from Debian without worrying about the kernel being updated and breaking the modules.
 
Old 02-16-2009, 11:07 AM   #5
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Original Poster
Rep: Reputation: 35
That's another possibility I was thinking of, in a roundabout kind of way. Specifically though I was thinking of just building a .27 kernel, so hibernate/suspend has a chance at working, and to set the ondemand governor as default. How risky would foregoing kernel updates be though?

I've just remembered that some X updates will break the blob too. Even if I knew the specific packages whose updates necessitate rebuilding modules, I have even less of an idea how to deal with that than I thought I had about kernel and nvidia updates. Perhaps a basic "rebuild the blobs" script is my best bet. I'd be a lot happier though, with something that didn't mean X failing to start is how she'll know she has to do something.
 
Old 02-22-2009, 04:19 PM   #6
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Original Poster
Rep: Reputation: 35
Here's what I wound up doing, if anyone's interested:

placed "nvidia-rebuilder" in /usr/local/bin:
Code:
#!/bin/sh
sudo /etc/init.d/kdm stop
sudo modprobe -r nvidia
sudo m-a clean,a-i -i -f nvidia-kernel-source
sudo depmod -a
sudo /etc/init.d/kdm start
exit
and then I made an alias so that the script would logout of the console after X starts:
alias fixit="exec nvidia-rebuilder"

So all she has to do if her computer boots to the console is login and run "fixit". Time will if that's enough to conquer her utterly depressing helplessness WRT computers.

---
WRT what I posted earlier re: building a newer kernel: suspend worked out of the box with 2.6.26 on her system, and ondemand is already the default governor.

I was so impressed with how well suspend worked that i decided to do a fresh install on my computer too (it's very similar to hers). Afterwards it worked great, but only long enough for me to deduce that my PCI PATA/SATA card still gets reduced to around 3MB/s after an S3 suspend, but not after an S1 suspend. I figured OK, that'll do, it's no worse than before at least. Only it is worse because suspend never worked again, it looks like it's working just fine all through suspending and powering down, and upon resume, it sees the image and starts to resume from it, but when it finishes reading the image, it just stops. I never get X back, I can't VT switch anyhwere, I just get a flashing cursor in the top corner, and most of the time the MagicSysReq keys are no help either. Installing uswsusp doesn't help at all, exactly the same behaviour but instead of a flashing cursor I'm taunted by the message "s2disk returned to userspace". *sigh*. [/lament]
 
Old 02-22-2009, 05:28 PM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
If you need to do something only when a newer version of something appears, you have exactly the situation that make was devised for. It knows how to follow rules you provide in a makefile, and those rules are triggered when a certain dependent file is newer than a specified target file. If you know how to identify when you need to run some re-building procedure, you should be able to codify that in a Makefile. Just run make against you Makefile once on each boot. If there is nothing to do, it will do just that; nothing.
--- rod.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No module error message when kernel upgrades....... East Linux - Newbie 3 04-14-2008 07:32 AM
LXer: Automating Web site and WordPress upgrades with Subversion, mirrorlinks and bash LXer Syndicated Linux News 0 11-11-2006 10:33 AM
Desktop Environment for the Computer illiterate Hydroksyde General 10 10-21-2005 06:41 PM
KDM & KDE setup for computer ILliterate people ZX_SA Linux - General 3 10-28-2004 11:37 AM
Kernel upgrades... Pyroknight Linux - General 4 02-07-2003 01:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration