# Upgrading kernel 2.4 -> 2.6

## CyTG

Fist off, dont rtfm or "use search" me... been there dont that  :Wink:  .. still havent found what im looking for (u2-style) ..

Wich is a current howto im comfortable following ? Bear in mind that, yes, im a newbie, still not an ignorant though .. I just really really dont wanna end up with an unbootable system, neither wanna do a clean install to get to 2.6.x ..

If there's allready written a good howto on the subject, then please, linkage ? Then only stuff i've found is either ½-way done (or ppl reporting problems with the steps) or like 1-year old ...  Questions like; What sources do i emerge ? (development-sources i suspect) and how do i build it etc (like in the7c. section of the documentation ? and do i just do it from within a console from X)... Stuff like that.... How to backup the old kernel, howto switch back if the new fails! ... I've used the lived to chroot back to the hd installation to save my ass a few times...

I'd just like some "idiots guide to updating the kernel" ... or whatever...

Any ideas ?   :Very Happy: 

----------

## SuperSheep

The kernel is only a tiny little part of your Gentoo install, that sits on /boot and runs below every other app, dealing with their requests.

So there's no need to do a clean install to get a 2.6.x kernel at all, you just need to replace the 2.4.x kernel you already have.

EDIT: you can do this in X, or at a console - it doesn't make a blind bit of difference.

1) emerge gentoo-dev-sources: this is the 2.6.5 kernel source tree.

2) you need a symbolic link pointing to your new kernel source tree, so do this:

```
cd /usr/src

rm linux

ln -s linux-2.6.5-gentoo-r1/ linux
```

Now you've got a your new kernel sources at /usr/src/linux.

3) 

```
cd /usr/src/linux
```

4) At this point, you need to know what hardware you have in your system.  You can type "lspci" to see a list of pci devices in your box, but you're gonna have to know.

5) 

```
make menuconfig
```

Work your way through the kernel options, setting the correct ones for your hardware.  Make sure you enable the options specified here.

6) Once you've finished configuring the kernel, exit and save your new kernel configuration.  Now you have to build it and install any modules you made:

```
make && make modules modules_install
```

7) For various reasons, /boot is not mounted on boot, so you'll have to mount it - this is where your kernel lives:

```
mount /boot
```

 :Cool:  Now copy the kernel across:

```
cp arch/i386/boot/bzImage /boot/kernel-2.6.5-gentoo-r1

cp System.map /boot/System.map-2.6.5-gentoo-r1
```

9) If you run grub as your bootloader, you will have to edit grub.conf to add an entry to your menu for the new kernel - that way, if it doesn't work, you can just select your old kernel from the list.  Find out the filename of your old kernel by looking in /boot.  This code will back up your existing grub.conf and start editing:

```
cp /boot/grub/grub.conf /boot/grub/grub.conf.bak

nano -w /boot/grub/grub.conf
```

This is only a guideline to a grub.conf, I can't really guess what yours looks like - if you want me to look at it, post it up.  It assumes you followed the Gentoo install guide to the letter - your boot partition /dev/hda1, and your root partition is /dev/hda3, and you are NOT dualbooting.  Make sure you change <oldkernelname> for your actual old kernel name.

```
timeout 30

default 0

fallback 1

title Old kernel 2.4.x

root (hd0,0)

kernel /<oldkernelname> root=/dev/hda3

title New kernel 2.6.x

root (hd0,0)

kernel /kernel-2.6.5-gentoo-r1 root=/dev/hda3
```

10) Okay, now we've configured grub, we can unmount the boot partition:

```
cd /

umount /boot
```

11) Phew.  You're ready to reboot now - on booting up, a menu should come up with two choices - "Old kernel" and "New kernel".  Your system shouldn't ever become unbootable then.

12) If you decide you like your new kernel, you can change grub.conf to only have one entry (by deleting the lines relating to the old kernel) and change the timeout line to something small, so it'll just boot the new kernel right away.

Hope this helps.

----------

## CyTG

damn nice, ill get right on it, thanks alot!   :Very Happy:   :Very Happy:   :Very Happy: 

If this works out, i'd recommend that it would be made a sticky .. i cant imagine im the only n00b outthere with 'second thoghts' on the subject ...

----------

## SuperSheep

I don't mind making this a proper howto, if you forums folks would like a basic kernel upgrade howto.

I've also got a howto for nvidia drivers, since I've spent hours playing with them.  Are there any requirements for howtos?

----------

## Admiral LSD

You can save a bit of time when upgrading by taking the .config out of your 2.4 source directory, copying it into your 2.6 directory and running make oldconfig instead of menuconfig. This will only prompt you for the options that have changed between your old kernel and the new. There was talk about complications with this when 2.6 first came out but I never had any real trouble. I use make oldconfig for all my kernel upgrades now, it's a hell of a lot easier than wading through all the menus taime and time again.

----------

## CyTG

Finally got back to this ...

So i did as written, no probs, I use lilo, but thats cool too ... Booted 2.6.5 and seemed fine, besides a couple of things...

I got a warning that i hadnt compiled devfs in kernel (and a 15 second count down), but i still got to the logon prompt... logged in at started X .. wich couldnt find my mouse, so exited ... 

Fine i thought, back and recompile the kernel, i must have missed something (its a scumbag laptop nx9010).. rebooted, booted old 2.4.22, started X, started konquerer to get to here ... NO DICE ... networking was gone!!! from old install too (wtf) ... pinging around, i could only ping localhost.. nothing else.... weird science... back to bootitem 3 -windowsxp, and here i am! Printing the steps in post one and getting back to menuconfig ..  :Cool: 

(how on earth could i fubar the 2.4.22 install ?)

----------

## CyTG

Back at it, and a few kernel compiles later, here i am  :Surprised: ) ... nice... i'd totally recommend this as a howto !!!

I still need to get a few things going, like sound, and double-click emulation on the touchpad (pad twice) .... but its cool, im getting there   :Very Happy:   .... and now ill be compiling new kernels like theres no tomorrow... yiihaaaa

----------

## TobiWan

 *CyTG wrote:*   

> Fist off, dont rtfm or "use search" me... been there dont that  .. still havent found what im looking for (u2-style) ..
> 
> Wich is a current howto im comfortable following ? Bear in mind that, yes, im a newbie, still not an ignorant though .. I just really really dont wanna end up with an unbootable system, neither wanna do a clean install to get to 2.6.x ..
> 
> If there's allready written a good howto on the subject, then please, linkage ? Then only stuff i've found is either ½-way done (or ppl reporting problems with the steps) or like 1-year old ...  Questions like; What sources do i emerge ? (development-sources i suspect) and how do i build it etc (like in the7c. section of the documentation ? and do i just do it from within a console from X)... Stuff like that.... How to backup the old kernel, howto switch back if the new fails! ... I've used the lived to chroot back to the hd installation to save my ass a few times...
> ...

 

Hi there,

my experience with 2.6:

don't mix 2.4 and 2.6 on the same system. Alsa is inside 2.6 now and if you're still having a 2.4 around which depends on the alsa script from /etc/init.d then you've got a little problem...

Same goes for nvidia-kernel if you've got to use it. It's easier to have only one branch.

Go for development-sources first since this is the stable Vanilla tree. I have some problems though with 2.6.6:

https://forums.gentoo.org/viewtopic.php?t=182719

If in doubt, try gentoo-dev-sources.

I've got very good experience with ck-sources-2.6.4-ck2 as well. Very stable.

Maybe this is a good hint too: Try the Mandrake sources from Mandrake 10. I've found them to be the easiest to set up since they include a working .config for any system and you can easily adapt it to your needs. It's not in Portage though. You have to extract it from the RPM. I'm running them and there's simply no other source tree that is so complete in terms of hardware compatibility.

When compiling a 2.6 kernel, you need to issue "make all && make modules_install". That's all. No more "make dep" or "make clean".

Check this thread too:

https://forums.gentoo.org/viewtopic.php?t=180075

Anyhow, in contrast to your statement there are numerous threads already discussing the issue.

My only advice on switching is to get rid of 2.4 totally. That's the easiest way. Take my advice on trying Mandrake's linux-2.6.3-13mdk too if you're rather unfamiliar with configuring a proper kernel.

regards,

Tobias

----------

## grahn

And what about udev when migrating to 2.6? Do I really have to replace devfs?

Alex

----------

## bennettp

 *grahn wrote:*   

> And what about udev when migrating to 2.6? Do I really have to replace devfs?
> 
> Alex

 Nope, devfs is still fine. IIRC, its only deprecated because the devfs maintainer stopped working on it, and so udev became the preferred choice by default. Its got some pretty cool features (for example, my usb pen drive is *always* symlinked to /dev/stick -- regardless of whether its sda, sdb, sdc, etc. (So now I can use autofs on it  :Smile: .

However its still got a few problems... for example, I need to compile my alsa drivers directly into the kernel (not as modules) or else my mixer always starts up muted.

In short, udev is cool, but it takes time to get it working. Devfs still works fine, and you don't need to do anything to get it to work.

----------

## Sabbie

 *CyTG wrote:*   

> Finally got back to this ...
> 
> So i did as written, no probs, I use lilo, but thats cool too ... Booted 2.6.5 and seemed fine, besides a couple of things...
> 
> I got a warning that i hadnt compiled devfs in kernel (and a 15 second count down), but i still got to the logon prompt... logged in at started X .. wich couldnt find my mouse, so exited ... 
> ...

 

Yeah, probbely to late, but you could have done this:

```

cd /usr/src/

rm linux

ln -s linux-2.4.22-gentoo/ linux

```

for linux-2.4.22-gentoo offcourse insert the right name..

I got scared to cause I lost my network, my tv-card-audio and sound-card modules.. This solved it for me though..

----------

## mpn

Great job, SuperSheep! This was exactly what I was looking for.

I definitely recommend making this a sticky.

----------

## dark_priest

 *TobiWan wrote:*   

> 
> 
> Anyhow, in contrast to your statement there are numerous threads already discussing the issue.
> 
> Tobias

 

as he said, its either a year old or very incomplete whats out there on teh forum (or has weird titles you'd never look for)

i'll try whats in  this thread tomorrow tho', looks like a real treat.

(screwed around with 2.6 but my NIC wont hork in it so far, had no Nvidia issues but that may be cause i compiled riva/nvidia options into the kernel, somewhere)

----------

## dark_priest

 *SuperSheep wrote:*   

> 
> 
> ```
> timeout 30
> 
> ...

 

Where did initrd go?

 *damn sure he followed 2.4.0 install guide to the letter* 

----------

## nick_downing

If you want to use initrd, you should compile your kernel thru genkernel ... It's very easy, you basically put your custom .config as /etc/kernels/kernel-config-x86-2.6.6 or whatever, and then:

```
genkernel all

```

Of course you've previously installed genkernel by typing:

```
emerge genkernel

```

And you've got your /usr/src/linux symlink pointing to linux-2.6.6 or whatever.  Then after the kernel upgrade, fix up your /usr/include/linux, /usr/include/asm-generic, /usr/include/asm symlinks [NOTE: EVERYONE, DON'T USE SYMLINKS AFTER ALL.. I WAS WRONG.. PLEASE SEE the way Linus recommends here: http://www.uwsg.iu.edu/hypermail/linux/kernel/0007.3/0587.html SINCE SOMEONE POINTED IT OUT IN ANOTHER FORUM TOPIC] and re-emerge important stuff like iptables since that will be broken after the kernel upgrade.

cheers,

Nick

PS.  Use the latest genkernel, I think a working reliable one is only recently available in portage.

PPS.  See /usr/share/genkernel/README for instructions about what to put in your grub.conf!Last edited by nick_downing on Wed Jun 30, 2004 6:20 am; edited 2 times in total

----------

## dark_priest

 *nick_downing wrote:*   

> .  Then after the kernel upgrade, fix up your /usr/include/linux, /usr/include/asm-generic, /usr/include/asm symlinks and re-emerge important stuff like iptables since that will be broken after the kernel upgrade.
> 
> 

 

say WHAT?

----------

## nick_downing

Oh sorry, it turns out that official Gentoo policy is that you don't make symlinks in /usr/include but instead, you emerge the latest kernel-headers package, in this case kernel-headers-2.6 ... it seems like this has been recommended practice for years, but silly n00bs like me, keep using symlinks and messing it up for everyone.  Sorry.  On Gentoo, you have to use the kernel-headers package if you want some apps (eg. samba) to compile, this is because some small fixes have been incorporated into the headers that aren't reflected in the actual kernel source.

cheers,

Nick

ps.  It is still necessary to re-emerge iptables after the kernel upgrade, this is a direct result of the kernel headers changing (some fields were added, some were removed, in "struct" definitions).

----------

## dark_priest

```
Eileen root # emerge kernel-headers-2.6 -p

These are the packages that I would merge, in order:

Calculating dependencies

!!! Problem in null/kernel-headers-2.6 dependencies.

!!! "Specific key requires an operator (null/kernel-headers-2.6) (try adding an '=')"

Eileen root # emerge kernel-headers-2.6 -s

Searching...

[ Results for search key : kernel-headers-2.6 ]

[ Applications found : 0 ]

```

 :Sad: 

----------

## dark_priest

By the way, my sound is now also FUBAR, i have sb 5.1 EMU10K1 

and compiled both alsa and OSS into the kernel :S

anyone got a clue?

(maybe i should unmerge the old 2.4 alsa/oss packages?)

----------

## nick_downing

I tried the following:

```
ACCEPT_KEYWORDS='~x86' emerge =linux-headers-2.6.6

```

But this didn't work:

 *Quote:*   

> Calculating dependencies
> 
> !!! all ebuilds that could satisfy "=linux-headers-2.6.6" have been masked.
> 
> - sys-kernel/linux-headers-2.6.6 (masked by: -* keywords)
> ...

 

I also tried various keywords such as '-x86' and '-*' but that doesn't fix the problem.  When someone does figure it out, you can make it permanently unmasked by doing this:

```
mkdir -p /etc/portage

echo "sys-kernel/linux-headers-2.6.6 ~x86" >>/etc/portage/package.keywords

emerge =linux-headers-2.6.6

```

Of course, it still wouldn't work, until we figure out why it's masked in such a strange way.

cheers,

Nick

ps. I still have my symlinks... sigh.  Oh well, it's working, though as Linus points out, I might have upgrade issues.  Solution:  Wait another 6 months before emerge --update world  :Wink: 

----------

## Tun

 *dark_priest wrote:*   

> By the way, my sound is now also FUBAR, i have sb 5.1 EMU10K1 
> 
> and compiled both alsa and OSS into the kernel :S
> 
> anyone got a clue?
> ...

 

Have a search you should find lots of other threads dedicated to this.

First thing to do is run alsamixer, if it runs check the master volume level (muted ?)

----------

## Sabbie

 *nick_downing wrote:*   

> ...a bunch of stuff

 

You should just do this:

```

echo "sys-kernel/linux-headers -*" >> /etc/portage/package.keywords

emerge -u linux-headers

```

And there ya go, 2.6.7 headers  :Smile: 

----------

## The Archangel

Thanks Supersheep, that was a helpful guide.  

I just upgraded from 2.4.25 to 2.6.7 here.  I compiled the kernel and copied the image over to /boot.  After editing GRUB to have the option of 2 kernels I rebooted and selected the new kernel.  It finds it and then just says "Ok, booting the kernel"  There it sits for all eternity and I have to force shutdown.  Is there a more detailed output I could get to see what the issue is?  

As a side note: I did see a lot of errors regarding ACPI funtions at the end of the kernel compile, but I'm not sure how to remedy them so I just copied over the  kernel and rebooted.  I saw a lot of ACPI posts in searching this issue, so maybe that might cause the hang?  If so, which option(s) do I disable to disable the feature?  I looked in menuconfig and the only one I found was already disabled.  Thanks!

----------

## The Archangel

Uhhh, gee.  Just went back into menuconfig and ACPI was right there...

Sorry about the anxious post, but I can say that did fix it.  Booted into 2.6.7 now  :Smile: 

----------

## dark_priest

 *Tun wrote:*   

>  *dark_priest wrote:*   By the way, my sound is now also FUBAR, i have sb 5.1 EMU10K1 
> 
> and compiled both alsa and OSS into the kernel :S
> 
> anyone got a clue?
> ...

 

yes i have

part of my problem (i think) is that i also have an onboard soundcard which it now suddenly(since 2.6) recognizes :S

----------

## nick_downing

By the way everyone, on the subject of Linux headers I found out from plasmaroo the proper way to emerge your headers:

emerge <full-ebuild-pathname>

eg:

```
emerge /usr/portage/sys-kernel/linux-headers-2.6.6

```

this is how you get around the -* masking.  Alternatively you can do this:

```
mkdir -p /etc/portage

echo 'sys-kernel/linux-headers -*' >> /etc/portage/package.keywords

```

(the above was from memory so I hope it's right).

cheers all,

Nick

----------

## dark_priest

didnt do jack for me, sorry  :Sad: 

----------

## dark_priest

also, if you do emerge -s linux-headers it sais theyre only for 2.4.21

```

Eileen sys-kernel # emerge linux-headers -s

Searching...

[ Results for search key : linux-headers ]

[ Applications found : 1 ]

*  sys-kernel/linux-headers

      Latest version available: 2.4.21-r1

      Latest version installed: 2.4.21-r1

      Size of downloaded files: 27,864 kB

      Homepage:    http://www.kernel.org/ http://www.gentoo.org/

      Description: Linux 2.4.21 headers from kernel.org

      License:     GPL-2

```

----------

## MrPixel

For users of Lilo: remember to run /sbin/lilo after updating lilo.conf to apply the changes.

----------

## eccerr0r

another difference that has cropped up with at least the stock 2.6.x kernels - Has anyone noticed that devfs's ptys keep on increasing in 2.6, but 2.4.x does not?

I just artificially allocated and deallocated ptys till I reached 1000 and things look OK, so I suppose things work allright and my friend's box that's having problems is an isolated case.

Anyway, the no-longer-used ptys don't show up in /dev/pts, just that the next used pty number keeps on increasing and never reuses closed pseudoterminals.  This looks like it's not causing any problems though, so it's fine...

EDIT: Clarified

EDIT^2: New data...

----------

## odegard

Great writeup! My PSU blew up some time ago and I didn't get a replacement before now and I'll celebrate by reformatting, repartitioning and reinstalling Gentoo with the latest kernel   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## corprew

I found that when I moved from 2.4.x -> 2.6.x and installed the headers, that X started randomly crashing, usually after a few seconds idle.  Re-emerging xfree helped with this problem.

--Corprew

----------

## evoweiss

 *bennettp wrote:*   

> Nope, devfs is still fine. IIRC, its only deprecated because the devfs maintainer stopped working on it, and so udev became the preferred choice by default. Its got some pretty cool features (for example, my usb pen drive is *always* symlinked to /dev/stick -- regardless of whether its sda, sdb, sdc, etc. (So now I can use autofs on it 

 

This is a pretty informative thread, but, when I tried booting after installing the new kernel (vanilla 2.6.6), I got a ton of errors about there not being devfs support or something similar. In the end, I was dumped into the terminal.

I heard that you need something checked under "code maturity options" and I have everything checked. 

What am I missing?

Best,

Alex

----------

## dark_priest

```
Automount at boot
```

hehe, its turned off in vanilla sources, and on in gentoo-dev  :Very Happy: 

(missed it too, gave me loads of headaches)

----------

## evoweiss

EDIT: Success! I've figured out all the bugs via the forums and other sources. I am stunned at the increase in speed gained from the better kernel and the implementation of the SMP kernel. I am not having many problems at all from what I can tell.

 *evoweiss wrote:*   

> This is a pretty informative thread, but, when I tried booting after installing the new kernel (vanilla 2.6.6), I got a ton of errors about there not being devfs support or something similar. In the end, I was dumped into the terminal.

 

Ok, I actually was able to solve the problem; the configuration option I needed was in a different place (pseudofile systems)  :Smile: . The 2.6.6 kernel is now playing nice with devfs.

Also, with respect to the e100 drivers, I chose to have them compiled in the kernel and that seems to be working. Am I right in that I no longer need to specify e100 or loop in the /etc/modules.autoload.d/kernel-2.6 file?

Best,

Alex

----------

