Personal tools
You are here: Home Team Members Jason Farrell Using akmods

Using akmods

by zcat last modified Jun 24, 2010 05:25 PM

How & why to use rpmfusion's "automagical" source akmods instead of regular binary kmods (kernel modules).

akmods (similar to dkms) is a solution to the problem of some kernel modules depending on specific versions of a kernel. If you want to use a custom kernel, or a test kernel -- e.g. from updates-testing or koji -- or if there is a very new kernel in the updates repo, then you must either wait for rpmfusion to rebuild binary kmods to match, or you must yumdownload and rpmbuild the source rpm manually. Enter a better way: automatic kmod rebuilding.

Using akmods, as soon as you install a new kernel, if a matching kmod version does not already exist, it will automatically be rebuilt from the akmod source rpm and immediately installed.

Applicable to Fedora Versions

  • Fedora 9+

Requirements

  • kernel-devel must also be installed for each kernel version, because kernel-devel is only brought in as an akmods dependency the first time it's installed, and only if it's available in a repo (e.g. in updates-testing)

    NOTE: If you neglect to install kernel-devel at the same time as the kernel, then the post-install akmod rebuild will FAIL, so make sure to do: yum --enablerepo updates-testing install kernel kernel-devel kernel-headers OR yum --nogpg localinstall kernel* (in this case you don't escape the '*' wildcard). If you did forget, but then subsequently installed kernel-devel AFTER the kernel, you can still force the akmod to be rebuilt now, without rebooting, for the specific kernel version just installed (rather than the current running kernel) by doing, for example: akmods --kernels 2.6.33.5-124.fc13.i686

Doing the Work

Summary: install the akmod-foobar which gets autobuilt into kmod-foobar, then reboot, or rebuild it now for the current kernel, by running "service akmods restart".

  1. Configure yum to use RPMFUSION, if it is not already configured.
  2. Determine which pre-built kmods you already have installed, if any. It's important to note that the rpmfusion-built kmods in the rpmfusion repo will eventually take precedence and update your locally-built akmods for the same kernel version as soon as they're made available, so your akmod only served to fill in the gap while it was unavailable. For custom kernels, where no regular rpmfusion kmod will ever be made available, your akmod kmod will always reign supreme.

    (So, it's pointless to remove "kmod-nvidia" and then install "akmod-nvidia", because a subsequent yum update will eventually update your locally-built "kmod-nvidia-kernelversion" to rpmfusion's version and bring in the kmod-nvidia meta-package dependency as well.)

  3. [root@f13 ~]# rpm -qa kmod-\*
    kmod-nvidia-195.36.24-2.fc13.1.i686
    kmod-nvidia-2.6.33.5-124.fc13.i686-195.36.24-2.fc13.1.i686
  4. Determine the available akmod kernel modules you want to use. For this howto, we'll be using the nvidia kmod for example:
    [root@f13 ~]# yum list akmod-\*
    akmod-VirtualBox-OSE.i686 3.1.8-1 rpmfusion-free
    akmod-em8300.i686 0.18.0-1.fc13.5 rpmfusion-free
    akmod-kqemu.i686 1.4.0-0.2.pre1.fc13.21 rpmfusion-free
    akmod-ndiswrapper.i686 1.54-4.fc13.20 rpmfusion-free
    akmod-nvidia.i686 1:195.36.24-2.fc13 rpmfusion-nonfree-update
    akmod-omnibook.i686 2.20090714-0.4.svn288.fc13.5 rpmfusion-free
    akmod-open-vm-tools.i686 0.0.0.243334-1.fc13.5 rpmfusion-free
    akmod-rt2860.i686 2.3.0.0-1.fc13.1 rpmfusion-free
    akmod-rt2870.i686 2.1.2.0-6.fc13.5 rpmfusion-free
    akmod-rt3070.i686 2.1.1.0-3.fc13.12 rpmfusion-free
    akmod-west-chamber.i686 0.0.1-4.20100405svn.fc13.5 rpmfusion-free
    akmod-wl.i686 5.60.48.36-1.fc13.5 rpmfusion-nonfree
    akmod-xtables-addons.i686 1.27-1.fc13 rpmfusion-free-updates
  5. Install the akmod. The first time you install an akmod it will also install the dependencies necessary to build and manage them (kmodtool and akmods from rpmfusion; the rest from fedora):
    [root@f13 ~]# yum install akmod-nvidia...
    =======================================================================================
    Package Arch Version Repository Size
    =======================================================================================
    Installing:
    akmod-nvidia i686 1:195.36.24-2.fc13 rpmfusion-nonfree-updates 6.2 M
    Installing for dependencies:
    akmods noarch 0.3.6-3.fc12 rpmfusion-free 16 k
    cloog-ppl i686 0.15.7-1.fc12 fedora 81 k
    cpp i686 4.4.4-2.fc13 fedora 3.3 M
    fakeroot i686 1.12.4-1.fc13 fedora 74 k
    fakeroot-libs i686 1.12.4-1.fc13 fedora 51 k
    gcc i686 4.4.4-2.fc13 fedora 8.1 M
    glibc-devel i686 2.12-2 updates 960 k
    glibc-headers i686 2.12-2 updates 599 k
    kernel-devel i686 2.6.33.5-124.fc13 updates 6.3 M
    kernel-headers i686 2.6.33.5-124.fc13 updates 764 k
    kmodtool noarch 1-18.fc11 rpmfusion-free 13 k
    livna-config-display noarch 0.0.23-1.fc11 rpmfusion-nonfree 68 k
    nvidia-settings i686 1.0-4.fc13 rpmfusion-nonfree 657 k
    nvidia-xconfig i686 1.0-2.fc13 rpmfusion-nonfree 74 k
    ppl i686 0.10.2-10.fc12 fedora 1.1 M
    rpm-build i686 4.8.0-14.fc13 fedora 125 k
    rpmdevtools noarch 7.8-1.fc13 fedora 109 k
    system-config-display i686 2.2-1.fc12 fedora 184 k
    xorg-x11-drv-nvidia i686 1:195.36.24-1.fc13 rpmfusion-nonfree 1.6 M
    xorg-x11-drv-nvidia-libs i686 1:195.36.24-1.fc13 rpmfusion-nonfree 13 M

    Transaction Summary
    =======================================================================================
    Install 21 Package(s)
    Upgrade 0 Package(s)

    Total download size: 43 M
    Installed size: 124 M
    Is this ok [y/N]: y
  6. Normally, your akmods are automatically rebuilt into kmods when you 1) install a NEW kernel for which no kmod yet exists, or 2) reboot into an old kernel for which no kmod yet exists, or 3) reboot and there's an updated akmod version to be rebuilt for the same (or newer) kernel version.

    You can either reboot now to have the kmod rebuilt by the "akmods" service scripts, or, you can force it to rebuild now:

    [root@f13 ~]# service akmods restart
    Checking kmods exist for 2.6.33.5-124.fc13.i686 [WARNING]
    Building and installing nvidia-kmod [ OK ]

    The "[WARNING]" is to inform you that the kmod doesn't exist, so it's being rebuilt and installed. It should take less than a minute to build on decent hardware. If it just says "[OK]" then you either already have the rpmfusion kmod installed, or have already rebuilt the akmod previously. If it says "[FAILED]", then something went horribly wrong, but the first thing to check is that you have also installed "kernel-devel".

    To verify that your kmod was built and installed locally, check the rpm info. The "Build Host" should match your hostname, not rpmfusion's, and the "Build Date" should be very recent:
    [root@f13 ~]# rpm -qai kmod-nvidia-$(uname -r)
    Name : kmod-nvidia-2.6.33.5-124.fc13.i686 Relocations: (not relocatable)
    Version : 195.36.24 Vendor: (none)
    Release : 2.fc13 Build Date: Thu 24 Jun 2010 05:19:22 PM EDT
    Install Date: Thu 24 Jun 2010 05:19:47 PM EDT Build Host: ion
    Group : System Environment/Kernel Source RPM: nvidia-kmod-195.36.24-2.fc13.src.rpm
    Size : 13257320 License: Redistributable, no modification permitted
    Signature : (none)
    URL : http://www.nvidia.com/
    Summary : nvidia kernel module(s) for 2.6.33.5-124.fc13.i686
    Description :
    This package provides the nvidia kernel modules built for the Linux
    kernel 2.6.33.5-124.fc13.i686 for the i686 family of processors.

 

That's it. Leave it on autopilot. No more kmod headaches.


More Information

How does it work (in general)?

An akmod is actually just a regular RPM which contains a SRC.RPM + a spec file to bring in the deps necessary to build it. The source RPMs are expected to be found in /usr/src/akmods/ by the akmodsbuild script. If the version found there is newer than the kmod installed, it will be rebuilt, or if the kmod does not exist (/lib/modules/KERNELVERSION/extra/nvidia/nvidia.ko), it will be rebuilt.

How does the kmod get rebuilt immediately after a kernel is installed? By the postinstall script in /etc/kernel/postinst.d/akmods (note: the only other postinst script currently is supplied by "dkms")

Disclaimer

We test this stuff on our own machines - really we do - but you may run into problems; if you do, come to #fedora on irc.freenode.net

Added Reading

Document Actions
Log in


Forgot your password?
New user?