# Installing a newer Kernel

## WeirDave

Okay I have seen the FAQ and I have read "How do I install a new kernel while still keeping my current one around so that I can use it if necessary?" and I am still lost. I have several folders under /usr/src/ with the last being linux-2.4.26-gentoo-r9. I have not recompiled the kernal in forever and the earliest folder showing is linux-2.4.23_pre8-gss. Anyway what the heck do I do to start the process. I am so very nervous about wrecking my working system I want to be clear but I do want to take advantage of new developments. can someone please advise.

----------

## BWoso

I would copy your .config file from /usr/src/linux to /boot and then 

```
cd /usr/src

rm -frv linux

ln -s name.of.new.kernel linux

cd linux

make menuconfig

make . . . I'm not sure what the command is for the 2.4.x kernel anymore

mount /boot

cp arch/i386/boot/bzImage /boot/name.of.new.kernel

nano -w /boot/grub/grub.conf               --> (add another boot option for the new kernel with the name you put in /boot)

umount /boot

reboot
```

if you can't get the new kernel to work, just boot to the old boot option from grub.   Sorry if you are using lilo and not grub,  I'm not very good with lilo.

----------

## gnac

Some info about my journey to 2.6 (and back).

First, be aware that if you are not using alsa, you will pretty much be forced to use it now.  I have a creative Audigy (emu10k1), and I was using the emu10k1 module (oss), so I had to remerge everything (emerge -uDv --newuse world) to include alsa, (and maybe arts if you are using kde).  This took over a day on my amd 2600.   Unfortunatly I have NOT been able to get sound working after working on it for over a week (and reading all the forum postings on similar problems).

If you have an nvidia card, the are several known issues with gentoo-dev-sources 2.6.9-r1 and the nvidia drivers.  There are patches available which you have to manually install.  I prefer my systems to work without having a doctorate in kernel programming thank you.

EDIT: Looking at that patch link above I see that there is now a new nvidia kernel available to fix the problem without the patch.  You will still need to accept keywords "~ARCH"

Finally, for some reason, the 2.6 kernels didn't list my cdrom in its normal spot, /dev/scsi/host0/bus0/target0/lun0/cd.  I see a device as /dev/hdc, but my /dev/cdrom links are broken.  I haven't even bothered troubleshooting that one yet.

Personally, I like it when stuff works.  I don't mind having to manually configure stuff, but this experience had me booting my windows laptop just to plug my speakers into it so that I could play music.  (ahh, plugnplay) I fortunately kept copies of my 2.4 kernels in /boot so it was easy switching back.  Just keep a copy of your latest 2.4 kernel info in /boot and keep an entry in you lilo.conf to point to that kernel in case 2.6 gives you problems.

I did make the mistake of un-USEing oss, and then rebuilding world with --newuse, but for now I simply rebuilt XMMS with OSS turned on again so at least I can hear music and games.  I'm not in such a rush to rebuild KDE again.

Hopefully, you wont have all these problems, there are many that haven't.  I've spent over a week trying to get alsa working, and I even moved back to an older version (2.6.8 ) of the kernel to avoid the nvidia bug.  I never even got around to looking at the cdrom issue.

I don't want to be a harbinger of bad news, but be prepared for the potential for issues, and backup important files (kernels, /etc/...) before continuing.  Its pretty easy in this case to turn back if necessary.

Good Luck!

----------

## WeirDave

 *gnac wrote:*   

> Some info about my journey to 2.6 (and back).
> 
> First, be aware that if you are not using alsa, you will pretty much be forced to use it now.  I have a creative Audigy (emu10k1), and I was using the emu10k1 module (oss), so I had to remerge everything (emerge -uDv --newuse world) to include alsa, (and maybe arts if you are using kde).  This took over a day on my amd 2600.   Unfortunatly I have NOT been able to get sound working after working on it for over a week (and reading all the forum postings on similar problems).
> 
> If you have an nvidia card, the are several known issues with gentoo-dev-sources 2.6.9-r1 and the nvidia drivers.  There are patches available which you have to manually install.  I prefer my systems to work without having a doctorate in kernel programming thank you.
> ...

 

Thanks for this advice but it does raise a question for me which I had been reluctant to ask until now. I just recently added KDE to this box and when I did I lost my sound. I am a relative newb and have tried tinkering to no avail. It is not that important to me as this box just servers up a web based game. Any suggestions? I was thinking that it was time I upgraded my kernel thinking that it would address such issues but perhaps this is not the answer I seek.

[Edit]

One other question it has been so long since I compiled this kernel I don't remember what will happen as the end result and right now I am looking at a BAsh prompt with the last command being:

find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia

if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.4.26-gentoo-r9; fi

I am pretty certain this is a blow out of the compile but... and if it is it poses another question and that is why does it appera to be including pcmcia stuff on a desktop? I must of selected something wrong in my config?

----------

## gnac

 *WeirDave wrote:*   

> I just recently added KDE to this box and when I did I lost my sound.

 

Are you using Alsa?  If so, maybe we have a common problem centered around alsa and KDE that is not necessarily a kernel issue.  I had been using KDE for a while (switch from gnome a while back) and  had never had a problem until I was forced to use ALSA with this new kernel.

 *WeirDave wrote:*   

> find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia
> 
> if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.4.26-gentoo-r9; fi

 

It looks like you (or something) was trying to find pcmcia modules.  I don't think the kernel compile would register commands in your bash history, but maybe if you accidentally copied and pasted into it.

Are you using genkernel?  If so, it would explain any pci stuff.  AFAIK, genkernel pretty much compiles every option in the kernel as a module, and then lets hotplug figure out which ones to actually use.

I think the bottom line is that you should be able to try 2.6.  Just make sure you keep a copy of a 2.4 kernel in your lilo or grub conf so you can go back to it.

First, emerge the 2.6 kernel of you choice, e.g.

```
emerge -av gentoo-dev-source
```

This will create a new directory in /usr/src/ for example

```
/usr/src/linux-2.6.9-gentoo-r1
```

Then copy the .config file from your current kernel (linux-2.4.26-gentoo-r9) to the new kernel location e.g (your directories may differ)

```
cp /usr/src/linux-2.4.26-gentoo-r9/.config /usr/src/linux-2.6.9-gentoo-r1
```

Make a link to the new kernel directory, you make have to remove the old "linux" link. e.g

```
rm /usr/src/linux // (a link to linux-2.4.26-gentoo-r9

ln -s /usr/src/linux-2.6.9-gentoo-r1 /usr/src/linux
```

Then cd to the /usr/src/linux directory and "make oldconfig".

```
make oldconfig
```

  This will read your old .config file, copy over relevant settings and prompt you when an option needs attention (for example if it didn't exist in the 2.4 config)

Then 

```
make menuconfig // or xconfig or whatever
```

, and go through the options making sure everything is good for your system.  Pay attention to the ALSA section.  It is built into the kernel now.  You can pretty much turn off all OSS modules unless you need them for some reason.  Of course if you are using genkernel you can skip this step, (and maybe the previous one) and let genkernel do its stuff.

Then you can do a 

```
make && make modules_install
```

  This step is greatly reduced. no need to make dep or make modules by themselves.  An extra step saver is to mount boot and the do a "make install". 

```
mount /boot

make install
```

  This has the added benefit of automatically copying you kernel, System map and config files to /boot.  You just have to modify your boot loader to point to "vmlinuz" and "vmlinuz.old" as a backup.  Then, future "make installs" will replace the vmlinuz links to point to the newest kernel.  You will still have to do a "make modules_install" after the make install.  Finally, if you are using an nvidia driver, you will have to remerge the driver after building your modules.

Be sure you read the gentoo handboook section dealing with the kernel.  Pay attention to the 2.6 parts, but building the kernel is not that hard.  The hard part is going back to figure out what options were incorrect if something goes wrong  :Twisted Evil:    Of course thats why we made sure we kept a copy of the 2.4 kernel around in /boot.

Good luck.

----------

## BWoso

That's a little bit better than what I wrote  :Smile: 

----------

## dblaci

I haven't use 2.4 on my desktop (only on servers), so my first kernel on my recent comp. was 2.6.5.

Now i use 2.6.10-rc1.

I have an integrated nforce soundcarc, and an SBLive.

Both working with alsa. In fact i have some problems with mixer, but they are working fine, if they are set.

I use alsa, kde (since this moment arts, but i disabled it today).

I use my dvd drive as /dev/hdc i didn't even checked it is accessible other ways  :Smile: 

Conclusion:

i don't say 2.6 is better, because i didn't even try 2.4 on this machine, but it works for me.

----------

## WeirDave

 *gnac wrote:*   

> Make a link to the new kernel directory, you make have to remove the old "linux" link. e.g
> 
> ```
> rm /usr/src/linux // (a link to linux-2.4.26-gentoo-r9
> 
> ...

 

Okay I stopped here because I don't understand. Am I removing the old directory? like such: 

```
rm /usr/src/linux-2.4.23_pre8-gss
```

 then and am I issuing these commands from root?

```
ln -s /usr/src/linux-2.6.9-gentoo-r1 /usr/src/linux
```

I want to make sure I am clear and I don't want to delete something I need.

----------

## BWoso

you remove /usr/src/linux

How everything here works is that some programs need to know what kernel you use, so instead of having the program do some amazing things and guess which one you are using it looks at /usr/src/linux  So for that to work you need to have a link setup so that /usr/src/linux has your latest kernel in it.  The easiest way to do this is to make the sim link.  So when you rm /usr/src/linux you are not really deleting your kernel.

EDIT . . .   yes, you need to be root to do this stuff.

----------

## monkeyhead

multiple kernels are really easy to do once you get the hang of it.

basically your kernels are stored on /boot (make sure you mount it before copying your kernel there - one of my mistakes when i was learning). so if you compile a new kernel you can copy it here without affecting the kernel your currently using.

then add an entry to your grub or lilo configuration.

the next time you reboot you can choose your new kernel. if it doesn't work, then you reboot choose your old kernel and keep working on your new one till you get it right.

this isn't step by step, but just the basic idea. i suggest reading over the kernel and lilo/grub sections of the gentoo handbook. it's an excellent source, and provides all the step by step details.

----------

## WeirDave

Well I did something wrong and I can't even get the old kernel to boot I get an error on any selection I pick in grub that says:

root (hd0,0)

Filesystem type is ext2fs, partition type 0x83

kernel (hd0,0)/kernel-2.4.23_pre8-gss root=/dev/hda3

[Linux-bzImage, setup=0x1400, size0x126aa4]

kernel (hd0,0)/kernel-2.6.9-gentoo-r1 root=/dev/hda3

Error 15: File not found

Press any key to continue...

And that just brings me back to the grub selection screen. Can I fix this or am I hosed?

----------

## Lajasha

Try booting from the cd and verify the path and names of your kernels.

----------

## WeirDave

 *maletek wrote:*   

> Try booting from the cd and verify the path and names of your kernels.

 

Well I know how to boot to the CD but I don't know how to check the path and names once I do...

----------

## Lajasha

 *Quote:*   

> Grub error 15 
> 
> After hitting return in the grub prompt you get something similar to this one? 
> 
> Code: 
> ...

 

Pulled this from here.

----------

## WeirDave

 *maletek wrote:*   

> Grub error 15 
> 
> After hitting return in the grub prompt you get something similar to this one? 
> 
> Code: 
> ...

 

Well, this did not make any sense which is why I asked for directions to begin with but using the install manual I *think* I mounted the hard drive boot section (although incorrectly) and discovered I have the following files/directories (I don't know how to tell):

System.map

config

lost+found

System.map-2.4.23_pre8-gss

config-2.6.9-gentoo-r1

vmlinuz

System.map-2.6.9-gentoo-r1

grub

vmlinuz-2.6.9-gentoo-r1

System.map.old

initrd-2.4.23_pre8-gss

boot

kernel-2.4.23_pre8-gss

So now what do I do (lol)?

----------

## Lajasha

post the contents of your grub.conf please.

----------

## WeirDave

 *maletek wrote:*   

> post the contents of your grub.conf please.

 

As much as I hate to admint this I have no idea how to get to the file to display it. I tried booting with the livecd and then mounting but I can't figure it out. I don't really understand the whole mounting thing to begin with. I am sorry. I am trying...

----------

## Lajasha

 *WeirDave wrote:*   

>  *maletek wrote:*   post the contents of your grub.conf please. 
> 
> As much as I hate to admint this I have no idea how to get to the file to display it. I tried booting with the livecd and then mounting but I can't figure it out. I don't really understand the whole mounting thing to begin with. I am sorry. I am trying...

 

Ok well a normal boot and mount would go.

1) boot the cd

2) mount /dev/hdaX /mnt/gentoo - Where X is the partition number for your boot partition

3) then you should be able to get to the config file.

----------

## WeirDave

 *maletek wrote:*   

> 
> 
> Ok well a normal boot and mount would go.
> 
> 1) boot the cd
> ...

 

Okay I have it! Thanks. I can't cut and paste so I have to type it. 

# Which listing to boot to default...

default 0

# How many seconds...

timeout 10

# nice fat splash image...

splashimage=(hd0,0)/grub/splash.xpm.gz

# Name of box

title=WeirDave's AATraders Server

# Partition where the kernel...

root (hd0,0)

# Kernel version and location

kernel (hd0,0)/kernel-2.4.23_pre8-gss root=/dev/hda3

kernel (hd0,0)/kernel-2.6.9-gentoo-r1 root=/dev/hda3

# use the next line only if you used genkernel...

# initrd (hd0,0)/initrd-2.4.23_pre8-gss

# The next 3 lines are for windows ...

# In this case windows is hosted...

# title=Windows XP

# root (hd0,5)

# chainloader +1

[edit] I changed the grub line for the 2.6 kernel to vmlinuz and it did boot but it is missing a bunch of modules according to what I saw flash up on the screen. I am going to try to boot to the old kernel and try again I guess. Is the 2.6 kernel supposed to be listed as vmlinuz? How come some modules worked and others did not? Home come some files started like normal and stuff like ntupdate did not?

[edit2] Okay I discovered the stuff that did not start program wise revolved around the lack of a network connection. Somehow that part got hosed. Also Alsa did not start either. And I got multiple modules.dep errors

----------

