# Cannot upgrade kernel

## SP2340

Hello,

I'm hoping someone here might be able to help me.

I have kernel 4.9.16 running on my system and everything seems to be fine.  I recently did a system update and kernel 4.9.34 was installed.

I figured I would install it and start using it.

I set the kernel to 4.9.34

```
log # eselect kernel list 

Available kernel symlink targets:

  [1]   linux-4.9.16-gentoo

  [2]   linux-4.9.34-gentoo *
```

I copied my working config file from 4.9.16 in to /usr/src/linux

I run 'make oldconfig' in /usr/src/linux

I next run 'genkernel all'

listing /boot I see everything looks to be installed.

```

log # ll /boot/

total 82M

 16K drwxr-xr-x  4 root root  16K Dec 31  1969 ./

1.0K drwxr-xr-x 22 root root 1.0K Jun 25 20:08 ../

8.0K drwxr-xr-x  3 root root 8.0K Jun 24 03:19 EFI/

3.1M -rwxr-xr-x  1 root root 3.1M Jun 27 20:46 System.map-genkernel-x86_64-4.9.16-gentoo*

3.1M -rwxr-xr-x  1 root root 3.1M Jul  1 23:36 System.map-genkernel-x86_64-4.9.34-gentoo*

8.0K drwxr-xr-x  6 root root 8.0K Jul  1 08:50 grub/

 33M -rwxr-xr-x  1 root root  33M Jun 27 20:48 initramfs-genkernel-x86_64-4.9.16-gentoo*

 33M -rwxr-xr-x  1 root root  33M Jul  1 23:44 initramfs-genkernel-x86_64-4.9.34-gentoo*

5.2M -rwxr-xr-x  1 root root 5.1M Jun 27 20:46 kernel-genkernel-x86_64-4.9.16-gentoo*

5.2M -rwxr-xr-x  1 root root 5.2M Jul  1 23:36 kernel-genkernel-x86_64-4.9.34-gentoo*

```

Boot into new kernel and I get CLI and no X.  running startx only errors out dropping me to the cli once again.

What am i missing here?  System is up to date.

Thanks for your help.

----------

## ian.au

SP2340,

Pretty hard to diagnose from the info supplied. What is in dmesg / boot log?

----------

## SP2340

You are correct.

DMESG https://pastebin.com/3u1EgJzp

Kern.log https://pastebin.com/mCGz5zCf

Messages https://pastebin.com/F6uBFEuR

Syslog https://pastebin.com/4H22b98e

Xorg.log https://pastebin.com/uHEuEHHy

----------

## NeddySeagoon

SP2340,

```
[    47.412] (II) Module glx: vendor="NVIDIA Corporation"  
```

You are using the nvidia binary blob driver.  Its in two parts. A kernel part (which is now missing) and an Xorg part.

Run 

```
emerge @module-rebuild
```

to rebuild all of your out of kernel modules against the new kernel.

That should pull in nvidia-drivers and any other out of kernel bits and pieces you have.

----------

## SP2340

Thnx NeddySeagoon.  So if I'm understanding you correctly every time I install a new kernel I need to  run the module-rebuild.

Should I boot into the new kernel and do this or can I do thins while still in the old one?

Also how will this effect the system if I would ever fall back to an older version of kernel, would I have to run this command?

----------

## Naib

 *SP2340 wrote:*   

> Thnx NeddySeagoon.  So if I'm understanding you correctly every time I install a new kernel I need to  run the module-rebuild.
> 
> Should I boot into the new kernel and do this or can I do thins while still in the old one?
> 
> Also how will this effect the system if I would ever fall back to an older version of kernel, would I have to run this command?

 you can do it from the old. The key is what /use/src/Linux points to (symlink manaully set or set via eselect kernel). Emerge nvidia-drivers will build for whatever this points to

----------

## NeddySeagoon

SP2340,

The nvidia kernel module and its Xorg partner need to be the same versions.

Providing that a kernel upgrade does not get a new nvidia-drivers, switching kernels is as easy as choosing a different kernel at boot time.

When you have not used an older kernel for a while, nvidia-drivers may get updated in the normal course of your updates.

When you go back to the old kernel, the versions won't match and Xorg will fail in just the same way as you have seen.

The fix is to eselect the old kernel, or revert the /usr/src/linux symlink to point to the old kernel, then rebuild nvidia drivers.

This updates the kernel module in the old kernel.  The sign that you need to do this is that Xorg doesn't work.

There will all we version mismatch errors in your logs. 

Put the symlink back to the new kernel when the rebuild is complete.

----------

## SP2340

I'm now running 4.9.34 thanks to everyone advice here.

So here are the steps I used to upgrade my kernel in case someone else stumbles across this post with similar issues.

1. Upgrade the system, I use emerge --update --deep --with-bdeps=y @world

2. Point the system to use the new kernel with eselect kernel set #

3. Copy .config file from the old kernel tree into the new kernel tree

4. Use make oldconfig to import your old config into the new kernel

5. Install the new kernel with genkernel all

6. Rebuild all modules for the new kernel with emerge @module-rebuild

----------

## NeddySeagoon

SP2340,

A detail,

3. Copy .config file from the old kernel tree into the new kernel tree

4. Use make oldconfig to import your old config into the new kernel 

5. Install the new kernel with genkernel all

This depends on how your genkernel is configured.  By default, genkernel all uses its own configuration, not the one you have just moved from the old kernel.

----------

## Juippisi

 *SP2340 wrote:*   

> 
> 
> 1. Upgrade the system, I use emerge --update --deep --with-bdeps=y @world
> 
> 2. Point the system to use the new kernel with eselect kernel set #
> ...

 

You can skip steps 3 and 4 if you give genkernel right parameters, like genkernel --kernel-config=/etc/kernels/your_current_kernel_config or point it to old /usr/src/linux-current/.config

----------

## SP2340

Soory for the late replies.  Life can get in the way at times.

 *NeddySeagoon wrote:*   

> SP2340,
> 
> A detail,
> 
> 3. Copy .config file from the old kernel tree into the new kernel tree
> ...

 

From what I was told if I do the above step genkernel should be using the config file I added as it imports all the settings from my config into it's config file.  I'm also under the assumption that genkernel uses the .config file in the /usr/src/linux directory.

----------

## SP2340

 *Juippisi wrote:*   

>  *SP2340 wrote:*   
> 
> 1. Upgrade the system, I use emerge --update --deep --with-bdeps=y @world
> 
> 2. Point the system to use the new kernel with eselect kernel set #
> ...

 

I'll have to keep this in mind for the next kernel build.  Thnx.

----------

