Installing a custom kernel in Arch Linux
Tagged:  •    •    •  

In the past I have experienced quite some annoyances with running Arch Linux on VirtualBox.

Before VirtualBox 2.0 there was something horribly wrong with the disk drivers. If you did slightly more disk I/O than average there was a fair chance you would end up with a kernel panic. Besides, VirtualBox does some spurious logging, trying to tell you that the disk does not work properly. It was very easy to lose gigabytes of host disk space because of the ever-growing logfiles.

This problem magically disappeared since when I tried VirtualBox 2.1.2. However, I started to notice a new problem: it was much slower than I was used to in VirtualBox 1.6. Again it seemed I/O related: high CPU usage and high system loads when using the disk a little.

Both problems above got fixed by replacing the stock kernel shipped with Arch Linux with something lighter. There are a few pages written about installing a custom kernel on the Arch Linux Wiki.

Among those pages there are two articles providing a custom PKGBUILD file which takes care of configuring and building the kernel. Unfortunately it didn't really work out that well. When installing the resulting packages I got file conflicts or I messed something up with naming the packages. Instead I chose to take a simpler route, use the PKGBUILD from ABS and supply it with my own configuration file. Here's what I did:

  1. Copy the kernel26 folder from ABS to a place in your personal diskspace:
    cp -r /var/abs/core/kernel26 /home/bram/kernel26
  2. For this particular case with VirtualBox, you can use the configuration with this article. It's a stripped down configuration with only the necessary stuff. Note I disabled sound in this configuration, since I didn't need it. Make sure to update the md5sums afterwards:
    cp /home/bram/vbox-archlinux-kernelconfig /home/bram/kernel26/config
    makepkg -g

    and replace the resulting checksums in your PKGBUILD.

  3. If you want to customize the existing configuration, you can uncomment a line in the PKGBUILD in order to configure your kernel in the process:
    # Configure the kernel. Replace the line below with one of your choice.
    #make menuconfig # CLI menu for configuration
    #make xconfig # X-based configuration
    #make oldconfig # using old config from previous kernel version
  4. Build the package:
    makepkg
  5. And install the new kernel:
    pacman -U ./kernel26-2.6.x.y-1-i686.pkg.tar.gz

    Replace the package name above with the package name in your case.

  6. Restart the virtual machine, and it should feel much more responsive afterwads.