# How do I update my kernel? [SOLVED]

## Maheriano

I searched and couldn't find it. I'm trying to emerge ivman and it says I need a 2.6.13 or newer kernel to run the package. I currently have 2.6.12-gentoo-r10.

----------

## _loki_

```

emerge --sync && emerge gentoo-sources

```

then change /usr/src/linux pointing to the new kernel sources

```

ln -sf /usr/src/linux/linux-2.6.16-gentoo-version /usr/src/linux

```

you can use your old .config, but go through the config as there where some changes in menu in 2.6.16..

```

cp /usr/src/linux-2.6.12-gentoo-r10/.config /usr/src/linux && cd /usr/src/linux && make menuconfig

```

when everything is okay, run

```

make && make modules_install

```

and copy the image to /boot

```

cp /usr/src/linux/arch/yourarch/boot/bzImage /boot/kernel-2.6.16-gentoo-version

```

and edit /boot/grub/grub.conf pointing to the new image..

When the new kernel is up and runnig, get rid of the old sources..

```

emerge -C gentoo-sources-2.6.12-r10

```

----------

## dsd

http://www.gentoo.org/doc/en/kernel-upgrade.xml

----------

## Maheriano

What happened?

```
localhost ~ # ln -sf /usr/src/linux/linux-2.6.16-gentoo-version /usr/src/linux

localhost ~ # cp /usr/src/linux-2.6.12-gentoo-r10/.config /usr/src/linux && cd /usr/src/linux && make menuconfig

cp: `/usr/src/linux-2.6.12-gentoo-r10/.config' and `/usr/src/linux/.config' are the same file

localhost ~ # make && make modules_install

make: *** No targets specified and no makefile found.  Stop.

```

----------

## mikegpitt

I think the problem is with your symlink.  It should read

```
ln -sf /usr/src/linux-2.6.16-gentoo-version /usr/src/linux 
```

not

```
ln -sf /usr/src/linux/linux-2.6.16-gentoo-version /usr/src/linux 
```

(note the extra /linux in the version you posted)

----------

## Maheriano

 *mikegpitt wrote:*   

> I think the problem is with your symlink.  It should read
> 
> ```
> ln -sf /usr/src/linux-2.6.16-gentoo-version /usr/src/linux 
> ```
> ...

 

```
localhost ~ # ln -sf /usr/src/linux-2.6.16-gentoo-version /usr/src/linux

localhost ~ # cp /usr/src/linux-2.6.12-gentoo-r10/.config /usr/src/linux && cd /usr/src/linux && make menuconfig

cp: `/usr/src/linux-2.6.12-gentoo-r10/.config' and `/usr/src/linux/.config' are the same file

localhost ~ # make && make modules_install

make: *** No targets specified and no makefile found.  Stop.

```

----------

## Mickael

Hello,

 *Maheriano wrote:*   

> 
> 
> ```
> localhost ~ # ln -sf /usr/src/linux-2.6.16-gentoo-version /usr/src/linux
> 
> ...

 

look here : ls /usr/src/, and find the version of your kernel version = r*, where the star is a number. After that, replace version inside your line by this number : ln -sfn /usr/src/linux-2.6.16-gentoo-r* /usr/src/linux,

You can do this for exemple : 

#cd /usr/src

# ln -sfn linux-2.6.16-gentoo-r3 linux

 *Quote:*   

> 
> 
> and for reusing your old config do this : 
> 
> Code Listing 10.1: Reusing your old config
> ...

 

----------

## Paapaa

 *Maheriano wrote:*   

> What happened?

 

You didn't follow the official guide but followed incorrect steps posted to this thread. Always use an official guide if it is available! The problems:

1. You wrote "version" to the commands but you should've replaced that string with the actual version suffix: "r3" for example. You can find all the installed kernel versions by looking at /usr/src/.

2. You didn't specify "-n" option with ln. Official guide states that you have to use "ln -sfn...". _loki_'s advice was false and you really didn't change your symlink if the previous wasn't deleted beforehand. With -n you don't need to delete the old link first. 

3. Never chain your commands with && if you are not sure all the steps work. Do one step at a time and proceed after you know it worked.

Please follow the official guide and report back if you can't upgrade your kernel.

----------

## _loki_

 *Quote:*   

> 
> 
> ln -sf /usr/src/linux/linux-2.6.16-gentoo-version /usr/src/linux
> 
> 

 

sorry that is my fault, version of course implicates the version you're using.

For ln..

 *Quote:*   

> 
> 
> -f, --force                 remove existing destination files
> 
> -n, --no-dereference        treat destination that is a symlink to a
> ...

 

I guess that means -f replaces the old symlink?! I never use -n though..

Anyway you're right with the official guide, if I knew that there was one I'd just posted the location.

----------

## Maheriano

Everything worked except I don't know what my architecture is. I followed the guide for x86 because I have a Celeron 2.9ghz processor, how do I find out what my machine is compiled as?

```
localhost linux # cd /usr/src/linux/arch

localhost arch # ls

alpha  cris   i386  m68k       parisc  s390  sparc    v850

arm    frv    ia64  m68knommu  ppc     sh    sparc64  x86_64

arm26  h8300  m32r  mips       ppc64   sh64  um

```

----------

## cartpullerjack

For the purposes of the linux kernel, you're running an i386.

Technically, though, you have an i686 processor.

----------

## Maheriano

 *cartpullerjack wrote:*   

> For the purposes of the linux kernel, you're running an i386.
> 
> Technically, though, you have an i686 processor.

 

Something I should change?

----------

## Maheriano

And does this look like a proper grub.conf for me now? I also changed the init line, not sure if I should have done that. I'm afraid to reboot.

```
kernel /kernel-genkernel-x86-2.6.16-gentoo-r3 acpi=off root=/dev/ram0 init-/lin$

initrd /initramfs-genkernel-x86-2.6.16-gentoo-r3

```

----------

## _loki_

well you should be..

this would work if you kernel image was kernel-genkernel-x86-2.6.16-gentoo-r3, being in /

supposing it is in /boot, please add the partition you choose for /boot, if there is no extra partiton add /boot/;  should look like:

```

kernel (hdx,x)/kernel-genkernel-x86-2.6.16-gentoo-r3

```

for having a boot-partition that is hd(x,x) where hd(0,0) would be hda1

or

```

kernel /boot/kernel-genkernel-x86-2.6.16-gentoo-r3

```

for not having a seperat boot-partition..

the same is true for your initrd line, I guess your image is in /boot also..

please also post the rest of the kernel line..

----------

## cartpullerjack

 *Maheriano wrote:*   

>  *cartpullerjack wrote:*   For the purposes of the linux kernel, you're running an i386.
> 
> Technically, though, you have an i686 processor. 
> 
> Something I should change?

 

No, not unless you're really hot for a multicore Atlhon64.

As far as the kernel is concerned, there are several different classes of processor.  Linus Torvalds originally wrote the kernel on a 386 machine, so for compatibility purposes, to run Linux on a 32-bit x86 machine, you would compile your kernel for the i386 class, however, you can still change the particular processor you're compiling for in the config options.  It's just that if your kernel is compiled for a 386, its gauranteed to run on any 32-bit x86 processor.

The rest of those directories in linux/arch contain specific code for specific classes of processors, ie, alpha for the DEC Alpha, arm for the ARM processors commonly found in things like PDAs, ia64 for Itanium, ppc if you have a powerpc chip, or ppc64 if you have a 64-bit powerpc chip, etc....  And of course, x86_64 if you were compiling for your hot Athlon64.

----------

## Maheriano

Better?

```
dan@localhost /boot $ ls

System.map-genkernel-x86-2.6.12-gentoo-r10

boot

grub

initramfs-genkernel-x86-2.6.12-gentoo-r10

kernel

kernel-2.6.16-gentoo-r3

kernel-genkernel-x86-2.6.12-gentoo-r10

linux-2.6.12-gentoo-r10

lost+found

```

```
kernel /boot/kernel-2.6.16-gentoo-r3 acpi=off root=/dev/ram0 init$

initrd /boot/initramfs-genkernel-x86-2.6.12-gentoo-r10

```

----------

## sundialsvc4

This bears repeating:  always make a backup of your .config files!

I have a directory in /root just for this purpose.  Before and after making any kernel changes, I copy the file into this directory, giving it an appropriate non-hidden name.  I also place copies of this directory periodically on a removable USB drive.

Aside from the usual "  :Shocked:  protection," it is extremely handy to be able to diff two files to see exactly what is the difference between them!  (I caught at least one instance where a config-variable disappeared when the source code actually still referred to it.  It would have been a very obscure bug to diagnose, otherwise.)

----------

## Maheriano

 :Question: 

----------

## _loki_

yes it's better unless you don not have a separat partition for /boot

also there still seems to be not everything visible in your post:

 *Quote:*   

> 
> 
> kernel /boot/kernel-2.6.16-gentoo-r3 acpi=off root=/dev/ram0 init$ 
> 
> 

 

$ impilcates that there is something more in that line..

----------

## Paapaa

 *_loki_ wrote:*   

> yes it's better unless you don not have a separat partition for /boot

 

"make menuconfig" has (or had?) a funny feature that searches an old config from /boot. If it is named properly it uses that old config but doesn't mention it to the user. It also doesn't go through new options like "make oldconfig". This should be kept in mind. Or better: don't have /boot mounted while building new kernels.

----------

## Maheriano

I updated my kernel, changed my /boot/grub/grub.conf to 

```
default 0

timeout 30

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

title=Gentoo Linux 2.6.12-r10

root (hd0,0)

kernel /boot/kernel-2.6.16-gentoo-r3 acpi=off root=/dev/ram0 init-/linuxrc ramdisk=8192 real_root=/dev/hda3 udev

initrd /boot/initramfs-genkernel-x86-2.6.12-gentoo-r10

```

and rebooted. Now when I try to 

```
emerge ivman
```

 I still get the error 

```
 * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found sources for kernel version:

 *     2.6.12-gentoo-r10

!!! ERROR: sys-apps/hal-0.5.5.1-r3 failed.

!!! Function pkg_setup, Line 50, Exitcode 1

!!! You need a 2.6.13 or newer kernel to run this package

!!! If you need support, post the topmost build error, NOT this status message.

```

Why is it doing that?

----------

## Paapaa

 *Maheriano wrote:*   

> I updated my kernel, changed my /boot/grub/grub.conf...

 

I have to ask a few questions to verify a few things:

1. Did you use Genkernel or did you update your kernel manually ("make menuconfig, "make" etc.)? It looks like you used Genkernel when you installed Gentoo the first time and now you used the manual way.

2. If you did it manually, are you sure you have all the correct options/modules enabled in the kernel? Did you type "make oldconfig" at any point?

3. If you did it manually, you shouln't use Genkernel options for grub.conf, but rather those for manually compiled kernel. See these links for more:

Genkernel guide

Configuring the Bootloader

4. If you'd rather do this automated way with Genkernel, you should start over.

----------

## Maheriano

 *Paapaa wrote:*   

> 
> 
> I have to ask a few questions to verify a few things:
> 
> 1. Did you use Genkernel or did you update your kernel manually ("make menuconfig, "make" etc.)? It looks like you used Genkernel when you installed Gentoo the first time and now you used the manual way.
> ...

 

Ya I used Genkernel to do it originally and yesterday I updated it manually using the steps in the second post with the make menuconfig and stuff. Not correct?

 *Paapaa wrote:*   

> 
> 
> 2. If you did it manually, are you sure you have all the correct options/modules enabled in the kernel? Did you type "make oldconfig" at any point?
> 
> 

 

I don't know what I have enabled in my kernel, it doesn't make a lot of sense to me. But it's working perfect now except for the fact it's not updating. And I never typed make oldconfig at all.

 *Paapaa wrote:*   

> 
> 
> 3. If you did it manually, you shouln't use Genkernel options for grub.conf, but rather those for manually compiled kernel. See these links for more:
> 
> Genkernel guide
> ...

 

So I have to rewrite my grub.conf I guess?

 *Paapaa wrote:*   

> 
> 
> 4. If you'd rather do this automated way with Genkernel, you should start over.
> 
> 

 

uh oh

----------

## Paapaa

 *Maheriano wrote:*   

> 
> 
> Ya I used Genkernel to do it originally and yesterday I updated it manually using the steps in the second post with the make menuconfig and stuff. Not correct?

 

Yes, but only if you are sure all the needed device drivers and other options are correct - you have to go through each device you have. If you are 100% sure, then you can go on and alter grub.conf as stated in the "Configuring the Bootloader" link I gave. See the code listing 3 for an example. And never ever destroy your previous kernel and the grub.conf entry which works! You must always have a working kernel which you can start no matter what errors you make with a newer kernel.

If you are not sure how to manually configure a kernel, then you should probably use Genkernel as you did when installing Gentoo. You should then do as you did when installing (look at the Handbook "Configuring the Kernel"), just use the newer kernel sources. And when you have built all the needed images and copied them to /boot/ you have to add an entry to grub.conf. Now look at the code listing 4 in my link and edit it to suite your needs. 

The best thing, IMO, would be to actually learn how to manually configure the kernel and to learn what various kernel options mean. You have to know exactly what hardware your computer has. Then you have to enable them all in your kernel. I don't use modules but I build everything I need within the kernel. That way I can see all the possible error messages with "dmesg". If you use modules, you have to search error messages elsewhere. Both ways have advantages. I also think you can use genkernel to give you a (probably) working .config. Then you can edit/compile it manually and proceed with a manual way. Someone else might help you with that.

----------

## dsd

 *Maheriano wrote:*   

> and rebooted. Now when I try to 
> 
> ```
> emerge ivman
> ```
> ...

 

did you update the /usr/src/linux symbolic link to point at 2.6.16?

see http://www.gentoo.org/doc/en/kernel-upgrade.xml

----------

## Maheriano

So I'm going to try the genkernel to see how that goes but I have a few questions first.

Will I have to backup anything on my drive? I know it's a stupid question for Gentoo but I have a Microsoft background and you never know what that'll do.

Can I just make a folder to store all my old kernels in and then boot from one if I mess something up?

Otherwise I'm good to go I guess.

----------

## Daxtar

reading this brings me again to a problem I have, or perhaps just a misunderstanding about the Gentoo concept...

I'm used to download the kernel sources highly up-to-date from kernel.org, and I download every patch to be up-to-date with the current stable main line, and additionly I try the latest prepatch, like 2.6.17-rc3-git15 today... (if you are asking why: because of driver development I want to keep in touch with current developments...)

so far so good, I never miss any kernel sources  :Wink: 

how can Gentoo be informed : "I have kernel sources!" "no, I do not need any genkernel!"

there are many ebuilds wich need to install genkernel sources, by their dependencies wich is kind of annoying for me...

Sorry if I missed something, I'm quite newto gentoo, and I'm very happy with if except that thing...

----------

## dsd

http://gentoo-wiki.com/HOWTO_Install_kernel_sources_manually

----------

## _loki_

Daxtar:

there is no package depending on genkernel.. I never used it and have a running system for some time now. If you want to be on the edge, have a look on beyond-sources or no-sources..

Maheriano:

just do what the HOWTO says.. If you keep your old kernel image untill the new one is really runnig you cannot destroy anything, you can always change grub.conf on the fly by pressing "e" on the entry while booting, just write down the name of the old image and nothing can be lost. If you don't feel comfortable with compiling the kernel manually just stay with genkernel, I guess there is nothing wrong about that, a lot of people use it. If you still have probelems with grub have a look in the gentoo handbook http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?full=1#grub

----------

## Daxtar

Loki, Dsd: Thanks a lot.

thats the trick :

echo "sys-kernel/vanilla-sources-2.6.99" >> /etc/portage/profile/package.provided

echo "virtual/alsa sys-kernel/vanilla-sources" >> /etc/portage/profile/virtuals

echo "virtual/linux-sources sys-kernel/vanilla-sources" >> /etc/portage/profile/virtuals

now my hapiness increased to bliss  :Smile: 

----------

## _loki_

in that case portage will never ask you to update you kernel again (unless there is no 2.7 release).. or? Is that what you wanted? Still I think you just have to do nothing but 

```

emerge --sync && emerge vanilla-sources

```

to get the lastest release, there is NO dependancy on genkernel, so you can just care about the kernel as if you have downloaded it manually. Anyway having the kernel integrated in portage or not is not such a difference.. So your workaround is completly allright I guess!

----------

## Daxtar

ok, it was not genkernel, but gentoo-sources :

 *Quote:*   

> # equery belongs /usr/src/linux-2.6.16-gentoo-r6/Makefile
> 
> [ Searching for file(s) /usr/src/linux-2.6.16-gentoo-r6/Makefile in *... ]
> 
> sys-kernel/gentoo-sources-2.6.16-r6 (/usr/src/linux-2.6.16-gentoo-r6/Makefile)
> ...

 

so I did 'emerge --unmerge sys-kernel/gentoo-sources-2.6.16-r6'

generally and I do not want to install any kernel sources I do not want on my hard disk just do satisfy ebuild dependencies... but emerging vanilla sources with the ~x86 flag to have the latest vanilla is OK ... I hope having the vanilla source will never mage emerge get any other kernel sources...

----------

## Daxtar

just another question:

is there a way to have the latest stable vanilla up to date by portage?

there is a vanilla slot named "Slot 2.6.16.14: (2.6.16.14)", but what if kernel.org announces 2.6.16.15 ?  that will be maybe tomorror  :Smile: 

is the a slot which makes me follow the 'The latest stable version of the Linux kernel' line automatically?

if I emerge vanilla without the ~x86 mask I get 2.6.15.1, if I use the ~x86 mask, I get the 2.6.17-rc3 ...

hmmm....

thanks a lot, Daxtar

----------

## Paapaa

 *Daxtar wrote:*   

> is there a way to have the latest stable vanilla up to date by portage?

 

It works like with any other program. If you install gentoo-sources (with jost x86, no ~x86), you get the lates stable version, which at the present is 2.6.16-r6:

http://packages.gentoo.org/search/?sstring=gentoo-sources

When you update your machine (emerge -uD world), it will update gentoo-sources if there is a newer stable version available. The same goes with vanilla-kernel. The latest stable is 2.6.15.1 for whatever reason:

http://packages.gentoo.org/search/?sstring=vanilla-sources

Portage will tell you when a newer version is marked stable. You can then install it. If you are using ~x86 keyword, portage will tell when a newer testing version is available. The newest testing version now is 2.6.17_rc3. Just remember that new version don't show up immediately in Portage when they are released. It might take a few hours/days. 

PS. If your computer works, it might not be wise to update a new test kernel (git...) every single day. You really won't gain anything unless you just want to hunt bugs...

----------

## Daxtar

ok, I see, I see....

looks like having an Alibi vanilla source is the best to make portage leave me alone, but not alone at all  :Smile: 

thanks guys !

----------

## _loki_

having vanilla-sources emerged (so that portage know it is there), portage won't ask for installing gentoo-sources.. That happens just when portage thinks there are no kernel sources at all on the system..- standart then would be gentoo-sources. So a simple emerge vanilla-sources would fix your problem- just decide if you like to run on x86 or ~x86..

----------

## dsd

 *Paapaa wrote:*   

> PS. If your computer works, it might not be wise to update a new test kernel (git...) every single day. You really won't gain anything unless you just want to hunt bugs...

 

having users who regularly update to the latest is extremely beneficial to the development community, no matter how pointless it may seem. it means there is a smaller window to look at when a bug is introduced. of course, this relies upon the users contributing to the kernel bugzilla rather than keeping bugs secret.

----------

## Paapaa

 *dsd wrote:*   

> having users who regularly update to the latest is extremely beneficial to the development community, no matter how pointless it may seem. it means there is a smaller window to look at when a bug is introduced. of course, this relies upon the users contributing to the kernel bugzilla rather than keeping bugs secret.

 

You are 100% correct, and that is why I wrote "unless you just want to hunt bugs...". Daxtar, if you someday get interested in reporting bugs, visit Kernel Bugzilla. Before reporting bugs, make sure nobody has reported the same bug before, and give a report that has all the needed information included so that devs can fix and possibly reproduce the bug. You should see other bug reports first, if you are not familiar with them.

----------

## Maheriano

Is this right?

```
localhost ~ # genkernel all

* Gentoo Linux Genkernel; Version 3.3.6

* Running with options: all

* Linux Kernel 2.6.12-gentoo-r10 for x86...

* kernel: >> Running mrproper...

* config: Using config from /etc/kernels/kernel-config-x86-2.6.12-gentoo-r10

*         Previous config backed up to .config.bak

*         >> Running oldconfig...

* kernel: >> Cleaning...

*         >> Compiling 2.6.12-gentoo-r10 bzImage...

*         >> Compiling 2.6.12-gentoo-r10 modules...

* Copying config for successful build to /etc/kernels/kernel-config-x86-2.6.12-gentoo-r10

* initramfs: >> Initializing...

*         >> Creating base_layout cpio archive...

*         >> Creating auxilary cpio archive...

*         >> Creating busybox cpio archive...

*         >> Creating udev cpio archive...

*         >> Creating insmod cpio archive...

*         >> Creating modules cpio archive...

* Merging

*     initramfs-base-layout.cpio.gz

*     initramfs-aux.cpio.gz

*     initramfs-busybox-1.00-rt-mdstart.plasmaroo.cpio.gz

*     initramfs-insmod-0.9.15-pre4.cpio.gz

*     initramfs-udev-054.cpio.gz

*     initramfs-modules-2.6.12-gentoo-r10.cpio.gz

*

* Kernel compiled successfully!

*

* Required Kernel Parameters:

*     real_root=/dev/$ROOT

*

*     Where $ROOT is the device node for your root partition as the

*     one specified in /etc/fstab

*

* If you require Genkernel's hardware detection features; you MUST

* tell your bootloader to use the provided INITRAMFS file. Otherwise;

* substitute the root argument for the real_root argument if you are

* not planning to use the initrd...

* WARNING... WARNING... WARNING...

* Additional kernel cmdline arguments that *may* be required to boot properly...

* add "vga=791 splash=silent" if you use a bootsplash framebuffer

* Do NOT report kernel bugs as genkernel bugs unless your bug

* is about the default genkernel configuration...

*

* Make sure you have the latest genkernel before reporting bugs.

```

It looks like it compiled the wrong kernel.

----------

## Paapaa

 *Maheriano wrote:*   

> It looks like it compiled the wrong kernel.

 

Yes. But first run this:

```
emerge sync

emerge gentoo-sources
```

That will make sure you get the latest sources. Most likely you still have the symbolic link /usr/src/linux pointing to the old directory. You can verify this by typing "ls -l /usr/src/". It shows you where the symbolic link is pointing. It also shows you all the kernel source packages you have installed. Pick up the newest version and update the sybolic link like this:

```
cd /usr/src

ln -sfn linux-2.6.16-gentoo-r7 linux
```

You can now verify the link by typing "ls -l". You should see a line like this:

 *Quote:*   

> lrwxrwxrwx  1 root root   22 2006-05-09 01:15 linux -> linux-2.6.16-gentoo-r7

 

Please report back if you didn't succeed or if you got any error messages. (You might have to use "sudo" in front of the commands to get root priviledges.) If the link is now updated you can proceed. Just remember that all this is explained in the guide:

http://www.gentoo.org/doc/en/kernel-upgrade.xml

----------

## Maheriano

 *Paapaa wrote:*   

>  *Maheriano wrote:*   It looks like it compiled the wrong kernel. 
> 
> Yes. But first run this:
> 
> ```
> ...

 

Wow, it worked. You were a great help, thanks.

----------

