Welcome to the Community Site!

You've been redirected here from forum.linode.com. This is your new place to find answers, ask questions, and help others.

Join our Community
X

howto install a custom kernel

hi all,

i'm setting up heartbeat using three linodes. it needs kernel support for ipvs.

so i got the source from http://linode.com/src/2.6.18.8-linode10.tar.bz2 and compiled enabling ipvs.

now i have linux-xenu-2.6.18.8-linode10custom.1.0i386.deb in usr/src, could somebody show me how to install this permanently as my kernel in this xen node?

many thanks

7 Replies

I think you can't put your own kernel on the linode, you can only select from those available on the dashboard. But I hear you can create your own kernel modules and insert them into the kernel.

I haven't done this, but I think it goes something like this:

  • get the source for the kernel that you are running

  • build the module in question (I think I read that you need to use the same compiler as was used to build the kernel that you are running, but this might be wrong)

  • load (modprobe) the module

  • if it works, set it up so that the module loads at boot (maybe in /etc/modules - that's where it is in debian and relatives anyway)

Have a look at this thread:

http://www.linode.com/forums/viewtopic.php?t=3389

I was interested in this question and the thread I posted a link to because I also wanted a kernel feature that wasn't provided. For me it was cifs. And now I have it, so it can't be too hard.

My system is Debian, you need to keep that in mind if you can't find stuff where I found it. But most of this is pretty low level, so there shouldn't be too many variations.

[EDIT]Note that you have to redo this whole procedure if you change to a different kernel.[/EDIT]

Here's what I did.

  • found out what kernel I'm using
$ uname -r
2.6.18.8-linode10
  • went to /usr/src and became root user
cd /usr/src
su

got the appropriate source, decompressed it

# wget http://linode.com/src/2.6.18.8-linode10.tar.bz2
# tar -xvjf 2.6.18.8-linode10.tar.bz2

made a link to the source directory, went in, got the current config

# ln -s 2.6.18.8-linode10 linux
# cd linux
# cp /proc/config.gz config.gz

unpacked config file, renamed it

# gunzip config.gz
# mv config .config

configured the kernel

# make clean
# make menuconfig

(I got held up here for a while as I was missing a dependency for menuconfig - in my case it was the libncurses-dev package - I think. Anyway, if you get errors when you're trying to make menuconfig, check for missing dependencies)

So this is the kernel configuration, and I knew that what I wanted was support for a filesystem (cifs), so that's where I looked. Whatever it is that you want (ipvs) will be somewhere else. If you hit the '/' key in menuconfig, you can search for stuff, but I couldn't find ipvs, so I still don't know what it is.

When I found cifs, I selected it with M, so it would be built as a module, then exited from menuconfig, saving my new configuration.

Then, to finish off I did

# make modules
# make modules_install
# depmod
# modprobe -f cifs

Like it was said in that other thread I linked to, modprobe would not work without the -f option, as the compiler versions are different. I don't know what implications this will have for trying to load the module automatically at boot, maybe I'll just have to write a custom startup script to load the module with the -f option.

Good luck. As the geeks say, your mileage may vary.

Nice post, bernied. Good info.

My only variation would be to point out that there's no need to work in /usr/src; all this can be done in your home directory, which means you only need to be root for the last three steps ('make module_install; depmod, modprobe cifs'). Avoiding root access is, IMO, a Good Thing.

Oh, and this only works for Xen linodes. UML can't load modules, IIRC.

thank you all for the helpful replies.

ipvs is under network options.

i achieved some success, but again stuck in last two steps.

when i issue..

li23-66:/usr/src/linux# make modules_install

INSTALL fs/cifs/cifs.ko

INSTALL net/ipv4/ipvs/ipvsdh.ko

INSTALL net/ipv4/ipvs/ipvsftp.ko

INSTALL net/ipv4/ipvs/ipvslblc.ko

INSTALL net/ipv4/ipvs/ipvslblcr.ko

INSTALL net/ipv4/ipvs/ipvslc.ko

INSTALL net/ipv4/ipvs/ipvsnq.ko

INSTALL net/ipv4/ipvs/ipvsrr.ko

INSTALL net/ipv4/ipvs/ipvssed.ko

INSTALL net/ipv4/ipvs/ipvssh.ko

INSTALL net/ipv4/ipvs/ipvswlc.ko

INSTALL net/ipv4/ipvs/ipvswrr.ko

if [ -r System.map -a -x /sbin/depmod ]; then /sbin/depmod -ae -F System.map 2.6.18.8-linode10; fi

li23-66:/usr/src/linux# modprobe ipvs

FATAL: Module ipvs not found.

but modinfo cifs gives all information about it

i'm successful till this.. then in my dmesg says.. for all ipvs mods..

ipvswlc: version magic '2.6.18.8-linode10 SMP modunload Xen PENTIUM4 REGPARM gcc-3.4' should be '2.6.18.8-linode10 SMP modunload Xen PENTIUM4 REGPARM gcc-4.0'

is this my gcc version is different with what existing gcc used? i tried gcc4.1 and then tried lowering it to gcc3.4. it seems like gcc4.0 .deb is not available to install in debian.

could somebody show me the things which i have to correct?

@ceynet:

ipvswlc: version magic '2.6.18.8-linode10 SMP modunload Xen PENTIUM4 REGPARM gcc-3.4' should be '2.6.18.8-linode10 SMP modunload Xen PENTIUM4 REGPARM gcc-4.0'

is this my gcc version is different with what existing gcc used? i tried gcc4.1 and then tried lowering it to gcc3.4. it seems like gcc4.0 .deb is not available to install in debian.

could somebody show me the things which i have to correct?

# modprobe -f ipvs

It still might not work with the gcc version mismatch, but this will force the module to load so you can at least try it out.

thank you all..

managed to compile and load the kernel. but one more issue left..

when i insert it in /etc/modules it failed loading..

is there a way i can load the module with -f when my linode boots up?

sorry.. for being this dumb.. :)

the following line in /etc/modules loaded the module at boot

-f ip_vs

a big thank to community

Reply

Please enter an answer
Tips:

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