openSUSE and Installing New Linux Kernel Versions

I have found installing the latest version of the the Linux Kernel to be very fascinating. This is likely very curious to many as the Linux Kernel is just the underlining Operating System that drives our Linux Distribution we call openSUSE. It pretty much does its thing under the radar of most users. It has grown in complexity since the first release of Linux version 0.01 in September 1991 by Linus Torvalds. You can read the details about it here if you wish, Linux kernel - Wikipedia, the free encyclopedia. The Linux [size=3]Kernel is considered to be monolithic with all main OS services being run from the kernel. [size=3]However, the Linux kernel is modul[size=3]ar with core functions located in the main [size=3]kernel file [/size][/size][/size][/size][size=3][size=3][size=3][size=3][size=3][size=3][size=3]in /boot named [/size][/size][/size][/size][/size][/size]vmlinuz-version while optional drivers are built as separate modules (as in *.ko files) in the folder called /lib/modules [size=3]and grouped by kernel version. [/size]

When you tell someone you are using openSUSE Linux, what does that really mean you are doing? Well, openSUSE is our flavor of Linux distribution (Linux distribution - Wikipedia, the free encyclopedia) which you can read about here, https://en.opensuse.org/openSUSE-istribution_platform_strategy and Linux is the Operation system kernel you can read about here, Linux kernel - Wikipedia, the free encyclopedia. Ultimately, the ability to work with and on our computer, no matter its make or model, all comes down to the Linux Kernel Operating System. It is very true that the Linux distribution that you select can greatly effect the speed, reliability and usability of your total Linux installation, but in the end, all power comes from the Linux Kernel.

OK, so I like to work with the latest Linux Kernel because it effects how hardware and software work properly on my computer. If I buy some new piece of computer hardware, say a new sound card, it may not work with my default openSUSE kernel version. Yet, we all have the power to install the very latest kernel version into our installed copy of openSUSE. During the lifetime of your installed openSUSE version, it is possible to use the very latest version or select any kernel version in between its original released kernel version and the latest kernel release candidate.

The Linux kernel includes almost all hardware drivers for your PC, but not all. Some drivers are supplied externally and must be compiled into your present running kernel. The reason this is true is because not all companies provide information on how their product works for inclusion into the Linux kernel. Such examples include the VirtualBox VM drivers, the proprietary nVIDIA and AMD video drivers. It is important to realize that every time you update your kernel version, drivers such as these three mentioned here must be recompiled and reloaded before they will work again. This fact of how they work and install is outside the scope of this kernel document, but consider what I have said on this before you proceed any further.

[/size]There are four basic ways to install a newer kernel version. First and foremost, the most common way to install a newer kernel is when you get a kernel update from YaST. Kernel updates in openSUSE stay with the same major released kernel version, but the sub-release number changes. For instance, openSUSE 12.3 comes with kernel 3.7.10 with its sub-release version being 10 of kernel 3.7. Security and bug fixes come down from YaST as updates to kernel 3.7 in openSUSE, giving us the most common kernel version update.

The next most common way to get anew kernel version is to use a kernel repository, added to YaST / Software / Software Repositories. The kernel repositories come in two flavors, kernel head, the very latest kernel version released from www.kernel.org and the latest stable kernel.

  1. openSUSE 13.1 comes with[size=3] Kernel: linux-3.11.9 (Updated for you from YaST)

2[/size]) Latest Stable version is at: linux-3.12.3 [size=3](Works with VirtualBox 4.3.2)
[/size][size=3][size=3]
[/size] [/size][size=3]3) Kernel Head version is at: linux-3.13-rc3
[/size]
For info on getting openSUSE kernels, please have a look here: Portal:Kernel - openSUSE Wiki

[size=3]For more info on configur[size=3]ing your[size=3] kernel have a look here: menuconfig - Wikipedia, the free encyclopedia[size=3].
[/size][/size][/size]
You already get the latest kernel update (now at version 3.7.10) when you allow YaST to run and update your openSUSE installation. To get the Stable Kernel, add this repository into YaST [/size][size=3](Terminal C[size=3]ommand Shown)[/size]:

[/size]

sudo zypper ar http://download.opensuse.org/repositories/Kernel:/stable/standard/ Kernel-Stable
sudo zypper refresh
sudo zypper in --from Kernel-Stable kernel-desktop

To get the kernel Head, add this repository into YaST (Terminal Command Shown):

sudo zypper ar http://download.opensuse.org/repositories/Kernel:/HEAD/standard/ Kernel-Head
sudo zypper refresh
sudo zypper in --from Kernel-Head kernel-desktop

This is also called the kernel of the day: openSUSE:Kernel of the day - openSUSE Wiki

So, That covers three ways to get a new kernel, what is the forth way to get a new kernel version you might ask? Well, it is to download the kernel version you want from www.kernel.org and then compile it yourself on your PC. Before you attempt to compile your own kernel, please perform the following task:

Open YaST / Software / Software Management - Select the View Button on the top left and pick Patterns. Now, you will see several Patterns listed and you want to select:

   Development 

[X] Base Development
[X] Linux Kernel Development
[X] C/C++ Development

Then Press the Accept button on the bottom right and allow these applications to install.

The basic procedure to compile your own kernel is as followings:

  1. Download the selected kernel version (www.kernel.org) as a file linux-version.tar.xz, a compressed file tarball

  2. Decompress the file in a folder of your choice using the terminal command:

tar -Jxf  linux-version.tar.xz
  1. Change to the new linux folder:
cd linux-version
  1. Fetch the present kernel configuration for your running kernel:
zcat /proc/config.gz >.config
  1. Configure your new kernel before compile:
make oldconfig

OR

make menuconfig 
  1. Compile your new kernel ([size=3]where (n+1) = number of CPU cores plus one used to speed up the compile. For four cores use make -j5):
make -j(n+1) 
  1. Install your new Kernel:
sudo make modules_install install

And that is it. Never compile a kernel as root, but you must be root to install the compiled kernel…Compile times can vary a lot, but can range from 10 minutes to over one hour, depending on the speed of your PC. One issue with compiling and installing your own kernel, outside of using YaST, is there is (normally) no automatic way for the new kernel to be removed for you. On the plus side, when you compile your own kernel, it does not remove or modify the default kernel installed by YaST in any way and both exist to be selected from your Grub selection menu at boot time.

Now as luck would have it, I have spent considerable time and effort to automate the ability to install, remove, and other wise locate any kernel version, released since the year of 2005. This ability comes as three different bash scripts you can find here:

  1. S.A.C.K Kernel Compiler: S.A.K.C. - SUSE Automated Kernel Compiler

  2. S.A.K.R. Kernel Remover: S.A.K.R. - SUSE Automated Kernel Remover

  3. S.G.T.B. Kernel Tarball Creator : S.G.T.B. - SuSE Git Kernel Tarball Creator

Its my suggestion you visit each blog, read through the subject, do as required to install and use the bash script. It is my hope that you will find installing and configuring your own kernel is a blast, just as I do.

In the Grub 2 selection menu, the very latest kernel version is always the default. If you prefer the old version or any installed version,

[/size]For kernel boot parameters you can add using Grub 2, please look here: https://www.kernel.org/doc/Documentation/kernel-parameters.txt

All comments are welcome.

Thank You,

Thanks~~~~~~~~~~~~~~~~~

Made a good read . Thanks
It would be awesome if we include
==> pre installation steps like https://en.opensuse.org/SDB:Keep_multiple_kernel_versions
==> post installation steps like re-installing the GPU drivers etc…I think,i have seen some people suggest this in these forums.

**You are limited to small size for your submission here. Attempting to add the following text, sends me over the edge:
**
Before you install a new [size=3]Linux Kernel into YaST, be aware that you have the [size=3]option to set your configuration to allow the installation of multiple kernel versions. Up until openSUSE 12.3, this ability was turned off by default. Now it is turned on by default in openSUSE 12.3 and i[size=3]n general, this is a good thing. If you install a new Kernel using YaS[size=3]T (not compiling your own kernel as I talk about later) you can elect to keep the new kernel version and the old kernel version. At first, this is a good th[size=3]ing, but as time goes on and if many kernel updates [size=3]should exist, those old kernels can buil[size=3]d up and add some confusion at startup should you look through a long list. [size=3]The Grub 2 default will be to select the highest kernel version you have installed[/size][/size][/size][/size][/size][/size][/size]. The behavior of keeping multiple kernel version on hand and [size=3]selectable at boot time is determined by the configuration text file /etc/zypp/zypp.conf which can only be edited by root. Y[size=3]ou can edit this file as root with one of the following commands:

[/size][/size][/size][size=3][size=3][size=3][size=3][size=3][size=3][size=3][size=3][size=3][size=3]

In KDE do Alt-F2: kdesu kwrite /etc/zypp/zypp.conf 

[/size][/size][/size][/size][/size][/size][/size][/size][/size]
OR

[/size]

[size=3][size=3][size=3][size=3]In[size=3] Gnome do Alt-F[size=3]2: [size=3]gnomesu gedit [/size][/size][/size][/size][/size][/size][size=3][size=3][size=3][size=3][size=3][size=3][size=3]/etc/zypp/zypp.conf  [/size][/size][/size][/size][/size][/size][/size]

Search for the line that says “multiversion = provides:multiversion(kernel)” and place a comment # in from to NOT keep multiple kernels and ha[size=3]ve NO comment in from to keep multiple kernel versions. Wh[size=3]en multiple kernels are [size=3]enabled, you must explicitly remove each added kernel version, one at a time. If you make a change, YaST should you select the next time it is run. It will not go out and fetch kernels [size=3]gone by and must be setup before you need it and not after when it is too late.[/size][/size][/size][/size]

Thank You,

[/size]

Thanks for reply
>>>>>>> You are limited to small size for your submission here. Attempting to add the following text, sends me over the edge:
Did not realise that . Sorry for asking the technically impossible stuff.
>>>>>>> At first, this is a good thing, but as time goes on and if many kernel updates should exist, those old kernels can build up and add some confusion at startup should you look through a long list.
It is keeping only three(3) from what i read.Then again i might be reading it wrong :frowning:
multiversion.kernels = latest,latest-1,running
>>>>>>>you must explicitly remove each added kernel version, one at a time
So all we need to do is fire up YaST,identify the relevant “correct” package and zap it ? Will YaST complain ?

[QUOTE=vazhavandan;bt733]Thanks for reply
>>>>>>> You are limited to small size for your submission here. Attempting to add the following text, sends me over the edge:
Did not realise that . Sorry for asking the technically impossible stuff.
>>>>>>> At first, this is a good thing, but as time goes on and if many kernel updates should exist, those old kernels can build up and add some confusion at startup should you look through a long list.
It is keeping only three(3) from what i read.Then again i might be reading it wrong :frowning:
multiversion.kernels = latest,latest-1,running
>>>>>>>you must explicitly remove each added kernel version, one at a time
So all we need to do is fire up YaST,identify the relevant “correct” package and zap it ? Will YaST complain ?[/QUOTE]

To remove a kernel, search for kernel, go to the versions tab and uncheck the kernel version you do not want to keep. When I look at openSUSE 12.3 default it has an addition line set that says:

multiversion.kernels = latest,latest-1,running

Which as I read it would keep two unless running was not either the latest or latest -1, which could be three versions. I remember seeing this talked about many moons ago, but did not pay that much attention at the time.

Thank You,

Very clear and useful article. lol!
One question, though.
Whwn I install a new kernel-desktop from the stable repository, do I have to install the correspondent kernel-devel and kernel-desktop-devel, plus the kernel-firmware from the same repository?
I already have those package installed (related to the stock openSUSE 12.3 kernel), because I’ve installed the Nvidia driver.
Many thanks …

[QUOTE=PiElle;bt740]Very clear and useful article. lol!
One question, though.
Whwn I install a new kernel-desktop from the stable repository, do I have to install the correspondent kernel-devel and kernel-desktop-devel, plus the kernel-firmware from the same repository?
I already have those package installed (related to the stock openSUSE 12.3 kernel), because I’ve installed the Nvidia driver.
Many thanks …[/QUOTE]

The short answer is no. If you install a new kernel, you will get the other files to match your development and source setup. If you compile your own kernel, you will get the new source, but nothing else will get updated. I have not found this to be a problem. Let me say that there are exceptions, though not a lot. For instance, I can’t get the nVIDIA driver to auto reload using dkms when using YaST installed source, but it works fine if I compile my own code. So, there are some differences. One thing is for sure with nVIDIA and that is, if you install the nVIDIA driver from YaST, you should stick with updating kernel versions using the repository method in YaST and do not compile your own kernel. On the other hand, I do have bash scripts to install the nVIDIA driver using dkms when you compile your own kernel, but it all happens outside of YaST. When in doubt, stick with YaST for all duties you do not yet understand fully.

Thank You,

I have configured and installed new kernel, but my monitor colour depth was reduced somehow. How can I find out what I did wrong or possibly revert this change?

Ok, I figured out where I was wrong(I set some options for legacy hardware).
Anyway I have another question,which one is better: to put vga drivers into kernel or build them as a loadable modules?

[QUOTE=m1losh;bt752]Ok, I figured out where I was wrong(I set some options for legacy hardware).
Anyway I have another question,which one is better: to put vga drivers into kernel or build them as a loadable modules?[/QUOTE]

Well using loadable kernel modules is a very accepted way of doing business. I can say if you wish to take advantage of the Turbo Mode is SAKC, making all required modules built-in is a way to go and reduce compile times, but in the end, as long as the required module does get loaded, it should not matter to the running kernel, something where you spend most of your time.

Thank You,

Thanks for that info, I will try turbo mode soon and see if it works for my hardware configuration. In the meantime, I have some problems configuring my graphic support on kernel. Monitor is loosing signal and turns off whenever i get out of X(on boot, on ctrl+alt+F1). I dont know which part of kernel is responsible for that. I have tried comparing journal logs from two different kernel, and found a few diferences, vgaarb and vesafb are present in kernel that works normally. I spent two days trying to figure out what is going on and no luck. Any clue on this matter?
I must mention that the kernel which causes problems is 3.9.0-rc6 from kernel.org so maybe that’s some bug in it.

[QUOTE=m1losh;bt756]Thanks for that info, I will try turbo mode soon and see if it works for my hardware configuration. In the meantime, I have some problems configuring my graphic support on kernel. Monitor is loosing signal and turns off whenever i get out of X(on boot, on ctrl+alt+F1). I dont know which part of kernel is responsible for that. I have tried comparing journal logs from two different kernel, and found a few diferences, vgaarb and vesafb are present in kernel that works normally. I spent two days trying to figure out what is going on and no luck. Any clue on this matter?
I must mention that the kernel which causes problems is 3.9.0-rc6 from kernel.org so maybe that’s some bug in it.[/QUOTE]

When your monitor shuts off, there is no video signal being sent to it. I am not sure how to answer your other questions except to say the default video drivers are included in the Linux kernel. The newer the kernel the newer the driver, but there is more to the story. In openSUSE, the mesa and xorg applications also affect how video works and new kernels can have bugs for sure. Finally, both AMD and nVIDIA provide proprietary video drivers you can load into your selected kernel. There are so many video chips sets out there and most are only concerned that they work in Windows. Basically you purchase a computer without regard to if the video system works with Linux or not. Most can be persuaded to work, but it may take some effort to reach that point of operation.

Thank You,

I did diff between configs of the kernel which works and this one which doesn’t and managed to discover where the problem was. The problem was that i didn’t include vesafb in the config of a new kernel. Now it works like charm. Thanks.

I got you. So how did you compile your kernel and what tool did you use to add in the kernel module? Forgive me if I missed this response already.

Thank You,

[QUOTE=jdmcdaniel3;bt762]I got you. So how did you compile your kernel and what tool did you use to add in the kernel module? Forgive me if I missed this response already.

Thank You,[/QUOTE]
Well I added few modules which were present in the old kernel config and it somehow worked. I can’t specify which module directly was responsible for this problem. I have used qconfig because I’m quite new in this compiling things.

Will there be some tutorial about patching kernels? I saw that there is patch-3.9-rc7 released so I want to add it to my kernel. I downloaded the patch, unziped it, copied to the /usr/src dir, entered the folder linux-3.8.6-1 and executed patch -p1 < …/patch-3.9-rc7 but it didnt worked.
It prints some error like:

can’t find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff --git a/CREDITS b/CREDITS
|index 2346b09ca8bb…afaa7cec6ea5 100644
|— a/CREDITS

+++ b/CREDITS

and then asks for a file to patch…

[QUOTE=m1losh;bt765]Will there be some tutorial about patching kernels? I saw that there is patch-3.9-rc7 released so I want to add it to my kernel. I downloaded the patch, unziped it, copied to the /usr/src dir, entered the folder linux-3.8.6-1 and executed patch -p1 < …/patch-3.9-rc7 but it didnt worked.
It prints some error like:

can’t find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff --git a/CREDITS b/CREDITS
|index 2346b09ca8bb…afaa7cec6ea5 100644
|— a/CREDITS

+++ b/CREDITS

and then asks for a file to patch…[/QUOTE]

So, for my first question, why do you want to patch the kernel 3.9-rc7? Kernel 3.9-rc7 is the very latest kernel 3.9 release candidate and patching it would only be required by someone with more than a passing wish to test the Linux kernel. My thoughts if you want to use the latest kernel get it here: https://www.kernel.org/pub/linux/kernel/v3.x/testing/linux-3.9-rc7.tar.xz and use SAKC to install it: S.A.K.C. - SUSE Automated Kernel Compiler - Version 2.60 - Blogs - openSUSE Forums .

As for patching the kernel, patches assume you are located at a specific Linux folder location. That patch file is given in relation to some default place to find the file or files to be patched. I look at the patch file contents and the uncompressed kernel to determine this. In SAKC, I have no provisions to install a patch. You would follow my manual procedure to uncompressed the kernel file, then install your patch and proceed on with the manual kernel compile and install. Because kernel release candidates come out just about every week, but no longer than three weeks between releases, I just use the latest kernel and if it don’t work, I drop back to the latest stable release. Most bad bugs get fixed before the next kernel release comes out.

Thank You,

[QUOTE=jdmcdaniel3;bt766]So, for my first question, why do you want to patch the kernel 3.9-rc7? Kernel 3.9-rc7 is the very latest kernel 3.9 release candidate and patching it would only be required by someone with more than a passing wish to test the Linux kernel. My thoughts if you want to use the latest kernel get it here: https://www.kernel.org/pub/linux/kernel/v3.x/testing/linux-3.9-rc7.tar.xz and use SAKC to install it: S.A.K.C. - SUSE Automated Kernel Compiler - Version 2.60 - Blogs - openSUSE Forums .

As for patching the kernel, patches assume you are located at a specific Linux folder location. That patch file is given in relation to some default place to find the file or files to be patched. I look at the patch file contents and the uncompressed kernel to determine this. In SAKC, I have no provisions to install a patch. You would follow my manual procedure to uncompressed the kernel file, then install your patch and proceed on with the manual kernel compile and install. Because kernel release candidates come out just about every week, but no longer than three weeks between releases, I just use the latest kernel and if it don’t work, I drop back to the latest stable release. Most bad bugs get fixed before the next kernel release comes out.

Thank You,[/QUOTE]

I wanted that patch because I already have 3.9.0.rc-6 kernel installed and it works quite well for me(no crashes or critical errors in the logs).
But if I get you right, better solution is to install this as a separate kernel, because that way i will still have my 3.8.8 stable kernel if something goes wrong with this two -rc kernels.

[QUOTE=m1losh;bt769]I wanted that patch because I already have 3.9.0.rc-6 kernel installed and it works quite well for me(no crashes or critical errors in the logs).
But if I get you right, better solution is to install this as a separate kernel, because that way i will still have my 3.8.8 stable kernel if something goes wrong with this two -rc kernels.[/QUOTE]

Using SAKC, you can install as many kernels as you like. That is, you can install every kernel 3.9 release candidate you like and you select between them from your Grub 2 Advanced menu selection. Now, you may not want to have 24 different kernels to select from, if you decided to install that many. On occasions, the Grub menu system has acted up on me after installing 12 different kernel versions. And in any event, there is little need to keep kernel 3.9-rc1 if you have successfully installed and run kernel 3.9-rc7. So using SAKC, you can install as many kernels as you like. Using my bash script SAKR, you can remove any kernel you no longer need. In openSUSE 12.3, I keep the latest original 3.7.10 kernel, kernel 3.8.8 and kernel 3.9-0-rc7 and delete all the rest with SAKR and I find no need to patch any installed kernel.

Thank You,