# FAQ: kernel upgrade (and how to avoid unresolved symbols)

## jay

I am posting this because this question has been asked a few times, so here's the Frequently Given Answer. Please feel free to add more informations, if you have any.

First: Here's a little step-by-step instruction:

1. Backup your old kernel - The first thing you should be aware of, is backing up your old kernel, just in case something gets wrong, so you're able to boot back into your gentoo system.

```

# mount /dev/hda1 /boot

# cp /boot/bzImage /boot/bzImage.r1

# nano -w /boot/grub/menu.lst

```

First you're mounting your boot partition, in our case hda1, then we copy the kernel image into a new location and add a boot option in nano:

```

title=Gentoo Linux 

root(hd0,0)

kernel /boot/bzImage root=/dev/hda3 hdc=ide-scsi

title=Gentoo Linux (Backup kernel)

root(hd0,0)

kernel /boot/bzImage.r1 root=/dev/hda3

```

2. Download the kernel you want. Normally this is the latest, so you type:

```

emerge gentoo-souces

```

If you prefer a unpatched kernel, then the vanilla-sources are the right option. 

3. Change the Symlink The kernels will be placed into /usr/src and the directory tree of /usr/src/linux still points to your old kernel.

```

bash-2.05a# ls -l /usr/src

total 16

lrwxrwxrwx    1 root     root           22 May 30 14:50 linux -> linux-2.4.19-gentoo-r1

drwxr-xr-x   14 root     root         4096 May 30 14:36 linux-2.4.18

drwxr-xr-x   15 root     root         4096 May 30 14:55 linux-2.4.19-gentoo-r5

drwxr-xr-x   15 root     root         4096 May 23 17:50 linux-2.4.19-r1

drwxr-xr-x    7 root     root         4096 May 24 02:47 pc

bash-2.05a#

```

In our case we have three kernels, 2.4.18 (the vanilla sources) and 2.4.19-rc1 and rc5. We have to change the symlink to the new rc5 kernel. It should look like this then:

```

bash-2.05a# ls -l /usr/src

total 16

lrwxrwxrwx    2 root     root           22 May 30 14:50 linux -> linux-2.4.19-gentoo-r5

drwxr-xr-x   14 root     root         4096 May 30 14:36 linux-2.4.18

drwxr-xr-x   15 root     root         4096 Jun  1 18:34 linux-2.4.19-gentoo-r5

drwxr-xr-x   15 root     root         4096 Jun  1 18:41 linux-2.4.19-r1

drwxr-xr-x    7 root     root         4096 May 24 02:47 pc

bash-2.05a#

```

4. Clean the directory then compile the kernel to avoid unresolved symbols later.

```

#cd /usr/src/linux

#cp .config ../

#make mrproper

#cp ../.config ./

#make menuconfig

#make dep && make clean bzImage modules modules_install

#copy /usr/src/linux/arch/i386/boot/bzImage /boot

```

This copies your kernel configuration out of the way, before cleaning up module dependencies. When compiling the kernel I recommend to disable in "Processor Types and Features" the Option "Symmetric Multiprocessor Support" unless you have more than one processor in your system, because this causes problems with nvidia drivers very often.

5. Re-Emerge everything that has added modules to your kernel. This is especially true for the nvidia drivers and alsa sound - if you forget this you'll run again into unresolved symbols.

```

#emerge nvidia-kernels

#emerge alsa

#umount /dev/hdb1

```

Then reboot and test if your new kernel works.

Most common problems:

Q: I have emerged the gentoo-sources and when I try to compile I get this error at the end. 

```

init/main.o: In function `smp_init':

init/main.o(.text.init+0x59e): undefined reference to `skip_ioapic_setup'

arch/i386/kernel/kernel.o: In function `broken_pirq':

arch/i386/kernel/kernel.o(.text.init+0x3252): undefined reference to `skip_ioapic_setup'

make: *** [vmlinux] Error 1 

```

A: This happens when you try to disable SMP and have used this kernel with SMP before. Do a make mrproper first, before recompiling the kernel.

Q:  I get the message "unresolved symbol in module nvnet" and modprobe nvnet fails with the same error message. 

A: This is an external driver from nvidia for nforce motherboards. If you recompile ther kernel you have recompile this as well, but make sure that the old modules are removed.

```

make clean

make

make install

```

should do the trick.

Q: I recently upgraded my kernel to r5, which has been working fine. I decided to recompile with the pre-empt patch and low latency, and now when I boot I get many  messages like this: 

```

Calculating module dependencies ...

Calculating module dependencies failed !!

# depmod

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/adm1021.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/adm1024.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/adm1025.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/adm9240.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/bt869.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/ddcmon.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/ds1621.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/eeprom.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/fscpos.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/fscscy.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/gl518sm.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/gl520sm.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-ali1535.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-ali15x3.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-amd756.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-hydra.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-i801.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-i810.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-isa.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-piix4.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-sis5595.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-via.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-viapro.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/i2c-voodoo3.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/it87.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/lm75.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/lm78.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/lm80.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/lm87.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/ltc1710.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/matorb.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/maxilife.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/mtp008.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/pcf8574.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/pcf8591.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/sis5595.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/thmc50.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/via686a.o

depmod: *** Unresolved symbols in /lib/modules/2.4.19-gentoo/misc/w83781d.o  

```

A: This happens when you forget to change the symlink, but compile the new kernel. This will cause to the situation that you boot with the new kernel but loading the old modules from your previous kernel. Change the symlink and recompile the kernel, before copying into the boot partition.

Q:  I receive errors that modprobe cannot locate nls_cp437 and nls_iso8859-1 or other modules.

A: This may happen, when you forget to mount your boot partition, before copying your bzImage over. As a result you will have your old kernel booting,  and then having your /etc/modules.autoload script trying to load modules that have been compiled only into the new kernel 

Q: When i try to emerge nvidia-kernel or compile the sources off of nvidia's website, i can copmile ok but when modprobe tries to load NVdriver, it spits out an error message stating

```

/lib/modules/2.4.18-xfs/kernel/drivers/video/NVdriver: unresolved symbol _mmx_memcpy

/lib/modules/2.4.18-xfs/kernel/drivers/video/NVdriver:

Hint: You are trying to load a module without a GPL compatible license

and it has unresolved symbols. Contact the module supplier for

assistance, only they can help you.

/lib/modules/2.4.18-xfs/kernel/drivers/video/NVdriver: insmod /lib/modules/2.4.18-xfs/kernel/drivers/video/NVdriver failed

/lib/modules/2.4.18-xfs/kernel/drivers/video/NVdriver: insmod NVdriver failed 

```

A: This happens, when you try to compile NVDriver on your own before removing the previous nvidia drivers. Do an emerge -unmerge nvidia-kernel, then follow the make mrproper recipe, recompile the kernel and then try to compile the nvidia drivers on your own.

Q: My X server fails to start, and my XFree86 log file contains the error:

"(EE) NVIDIA(0): Failed to initialize the NVdriver kernel module!" 

A: If you do a lsmod you'll see that the module NVdriver is not loaded. Either you forgot to add it to the /etc/modules.autoload file, or it cannot loaded due to unresolved symbols.

Q: My x server freezes on start and the logfile has following error:

"(WW) NVIDIA(0): Failed to verify AGP usage!"

A: You have compiled your kernel with SMP support. The nvidia drivers however only support kernels that have this option disabled.

More resources in the net can be found at:

http://www.linuxfromscratch.org/view/3.3/chapter08/kernel.html

http://www.tldp.org/HOWTO/Kernel-HOWTO.html

----------

## T2

Instead of just copying bzImage to /boot one can rename it to some more meaningful name like

```
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-pre9_with_apic
```

So you can put many different kernel configurations in boot dir, also don't forget to update grub's menu.lst.

----------

## spendabuck

what's the code for the symbolic link to change the kernels?

----------

## spendabuck

https://forums.gentoo.org/viewtopic.php?t=3913&highlight=alsa

what's the code for the symbolic link to change the kernels?

----------

## leej

If your new kernel source is:

/usr/src/linux-2.4.19-gentoo-r5

Then you would do a:

```
ln -s /usr/src/linux-2.4.19-gentoo-r5 /usr/src/linux
```

I hope I understood your question correctly!  :Smile: 

----------

## spendabuck

yes you did thanks.

----------

## fghellar

Did you have a reason to post your question twice within 10 minutes?

----------

## jay

You have to remove first the previous symbolik link. For instance

```
 rm /usr/src/linux 
```

if linux is the link to your kernel directory

and then set up the new symlink: 

```
ln -s /usr/src/linux-2xxx /usr/src/linux
```

Replace 2xxx with the appropriate numbers for your kernel - ie. 2.4.19-gentoo-r5.

----------

## rew

jay wrote,

 *Quote:*   

> Q: My x server freezes on start and the logfile has following error: 
> 
> "(WW) NVIDIA(0): Failed to verify AGP usage!" 
> 
> A: You have compiled your kernel with SMP support. The nvidia drivers however only support kernels that have this option disabled. 
> ...

 

I will have to disagree there. I am running the nVidia drivers fine with kernel SMP support enabled.

kernel: vanilla-sources 2.4.19

nvidia-kernel: 1.0.2960-r1

nvidia-glx: 1.0.2960-r1

----------

## milothurston

 *Quote:*   

> 
> 
> I will have to disagree there. I am running the nVidia drivers fine with kernel SMP support enabled. 
> 
> 

 

So am I, with dual Xeons and a GeForce4 PCI, also on an older machine with PIII 600s and a TNT2.

I'd be interested to know if the patch below, or an equivalent, is included in the gentoo kernel:

```

--- linux/arch/i386/kernel/setup.c-pre10        Sun Jun 16 21:34:48 2002

+++ linux/arch/i386/kernel/setup.c      Sun Jun 16 21:50:53 2002

@@ -71,6 +71,11 @@

  *  CacheSize bug workaround updates for AMD, Intel & VIA Cyrix.

  *  Dave Jones <davej@suse.de>, September, October 2001.

  *

+ *  Short-term fix for a conflicting cache attribute bug in the kernel

+ *  that is exposed by advanced speculative caching on new AMD Athlon

+ *  processors.

+ *  Richard Brunner <richard.brunner@amd.com> and Mark Langsdorf

+ *  <mark.langsdorf@amd.com>, June 2002

<snip rest of code>

```

Thanks,

Milo.

----------

## jay

You're both right. I think the problem appears only if you are using the SMP kernel with only one processor.  At least it was mentioned several times in this forum and mailing list and it happened to me too. So I thought that it wouldn't  work on a dual processor system as well. But I'm happy to hear that this is wrong.

----------

## kybber

 *jay wrote:*   

> You're both right. I think the problem appears only if you are using the SMP kernel with only one processor.

 

Nah, I've had SMP enabled since I installed Gentoo a couple of months ago, and I only have one CPU. My nvidia card was working flawlessly using this configuration. A couple of days ago I disabled SMP to fix some APM troubles regarding shutdown, and nvidia still works. The only thing I had to do was to unmerge nvidia-kernel before compiling the new kernel, otherwise I would get an error at make modules_install. Oh, and of course reemerge nvidia-kernel after compiling the kernel. 

I am using the newest nvidia-kernel (2960-r1).  Maybe the guys at NVidia have fixed this problem in one of the later releases?

----------

## rac

Also note that as of 1.0.2960-r1, you no longer need to reemerge nvidia-kernel after compiling a new kernel.  See this thread for details.

----------

## kybber

Ah, that's very nice indeed - thanks for the tip  :Smile:  However, this is only valid if you don't do any 'serious' changes to your kernel which require a recompilation of the nvidia-kernel against the other modules/libraries etc., right?

----------

## rac

 *kybber wrote:*   

> Ah, that's very nice indeed - thanks for the tip  However, this is only valid if you don't do any 'serious' changes to your kernel which require a recompilation of the nvidia-kernel against the other modules/libraries etc., right?

 

True.  I haven't examined the nvidia sources closely enough to comment on exactly what would be considered "serious", but I would expect if you have done something like changing module versioning, SMP, MTRR, or something of that ilk, you would probably be better off remerging nvidia-kernel afterwards.  Basically, remerge it if you have problems.

----------

## RayVan

The step where you move the /usr/src/linux symlink is incorrect, despite the fact that nearly even distribution gets it wrong. Linus' comments on this point are here.

The brief (and less technical) version is this. The /usr/src/linux symlink is /not/ supposed to point at the current kernel version, and has not been supposed to point there since 1.x versions of the kernel. The /usr/src/linux symlink exists so that gcc can find the kernel headers that glibc was compiled against. 

IOW, leave the /usr/src/linux symlink alone unless you recompile glibc against the new kernel version.

----------

## rac

 *RayVan wrote:*   

> The step where you move the /usr/src/linux symlink is incorrect, despite the fact that nearly even distribution gets it wrong. Linus' comments on this point are here.

 

This quote is only relevant when /usr/include/linux and /usr/include/asm were symlinks to directories in /usr/src/linux.  QFingers and I had a discussion about this in here.  Linus' quote is not relevant to Gentoo, because in Gentoo, /usr/include/asm and /usr/include/linux are separate directories, maintained by the linux-headers package.

 *Quote:*   

> The brief (and less technical) version is this. The /usr/src/linux symlink is /not/ supposed to point at the current kernel version, and has not been supposed to point there since 1.x versions of the kernel. The /usr/src/linux symlink exists so that gcc can find the kernel headers that glibc was compiled against.

 

Not true for Gentoo, as noted above.  /usr/include/asm and /usr/include/linux contain the kernel headers against which libc was compiled.  /usr/src/linux does not enter into the equation - symlink or not.

 *Quote:*   

> IOW, leave the /usr/src/linux symlink alone unless you recompile glibc against the new kernel version.

 

I disagree with this.  All ebuilds I have looked at that make kernel modules (alsa and nvidia) explicitly require that /usr/src/linux be containing (or pointing to) the sources for the running kernel.  I agree with Jay's original advice.

----------

## rac

zatalian's kernel compilation question has been split into its own thread here.

----------

## rac

bkv's question about keeping old kernel sources around has gone here.  Please don't post support questions to threads in Documentation, Tips, & Tricks.

----------

## iKiddo

 *jay wrote:*   

> You have to remove first the previous symbolik link. For instance
> 
> ```
>  rm /usr/src/linux 
> ```
> ...

 

Can't this be included in the faq of the first post ?!?! otherwise it's very confusing

```
#cd /usr/src/linux

#cp .config ../

#make mrproper

#cp ../.config ./

#make menuconfig

#make dep && make clean bzImage modules modules_install

#copy /usr/src/linux/arch/i386/boot/bzImage /boot 
```

This is also quite confusing: you're trying to copy .config out of the new /usr/src/linux ?? It gives a "file doesn't exist" error here  :Sad: 

(I understood what you meant s to do in both cases, but it's not very clear)

----------

## ilovenina

Hi, I am getting unresolved symbols, but I have not upgraded my kernel. this is a fresh install of 1.4. 

see my topic

for more info.

Is there anything I can do? Remove my current kernel sources and emerge again? How would I do this safely? Please help...

----------

## nbrown

This guide says that unresolved symbols are a symptom of forgetting to set the symlink correctly, but mine points to my new sources (vanilla) and somehow I'm getting unresolved symbols in my old sources (gentoo).  Any ideas on why this is happening?  Thanks

Nate

----------

## rac

Please don't post questions to threads in the Documentation, Tips and Tricks forum.  This is not a support forum.  Ask your question somewhere else.  I would split it out myself, but it lacks enough context to make sense on its own in its current form.

----------

