How to load a kernel module automatically?

Ville Skyttä ville.skytta at iki.fi
Sun Apr 1 18:27:17 UTC 2007


On Sunday 01 April 2007, Till Maas wrote:

> When updating a kernel module, 
> unloading it in %preun and loading the new one in %post seems to me to be
> the desired behaviour.

As with all packages on upgrades, %post of the new package is run 
before %preun of the old.

> > The scriptlets above also
> > don't take into account if the package being installed/upgraded/erased
> > contains modules for the currently running kernel in the first place; if
> > not, they're not desirable.
>
> As far as I understand the scriptlets, they will silently fail when one
> installs the wrong kernel-module, but why should this happen in reality?

What's "wrong kernel module"?  And it happens every time one updates a kernel 
and installs module packages for it while still running some other kernel + 
modules.  Or erasing an old kernel and some module packages for it while 
running a newer kernel + modules.

> Also you did not explain what is going wrong 
> with these scriptlets except that they would do nothing in some cases.

You got it backwards, the simplistic scriptlets posted would do things in 
situations where they shouldn't be doing anything (this depends on the 
packaging scheme used - I'm assuming you're using the 
http://fedoraproject.org/wiki/Packaging/KernelModules one).

Example: running kernel version X and foo modules for it.  Install kernel 
version Y and corresponding foo modules for it -> the installation would try 
to insmod the foo module _for kernel X_.  Remove kernel version Y and foo 
modules for it while still running kernel X -> the erase would try to remove 
the modules _from the running kernel X_.




More information about the Fedora-maintainers mailing list