TIP: Building Modules in Xen

If you are going to build any modules on a Xen Linode, you will need BOTH the kernel sources AND an Ubuntu 6.06 distro on which to compile the modules. I found that when I tried to compile modules on my CentOS 4.4 system, I would get "Invalid module format" errors when trying to load them.

You'll need to deploy a 6.06 profile, log in, and then use:

apt-get update

apt-get upgrade

apt-get install build-essential

Then, go to /usr/src, grab the kernel source, and untar it:

wget http://linode.com/src/

tar xvfj

Create a symbolic link:

ln -s linux

You should now be ready to compile and test your modules. Once you have done so, go back to the dashboard, change your normal boot profile to connect the Ubuntu image to a virtual device, and boot back into your original system. You can then mount that image somewhere (let's say /dapper for this example), and copy your Ubuntu /lib/modules/ tree to your original system.

cp -ax /dapper/lib/modules/2.6.18-domU-linode7 /lib/modules

If you want to rebuild modules, you can just use chroot to bring up a shell in the Ubuntu environment instead of rebooting:

chroot /dapper /bin/bash

1 Reply

The invalid module formats happen because the gcc that you used to build the modules was different then what Linode uses to build the kernels ( SMP mod_unload Xen PENTIUM4 REGPARM gcc-4.0). The –force options outlined in modprobe(8) will overcome that if you don't mind tainting your kernel.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct