LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   change kernel I'm using (https://www.linuxquestions.org/questions/slackware-14/change-kernel-i%27m-using-651435/)

JosephS 06-24-2008 10:51 PM

change kernel I'm using
 
I want to change the kernel I'm using in /boot
I changed the symlinks: System.map, config and vmlinuz to:

Quote:

System.map -> System.map-huge-2.6.21.5
config -> config-huge-2.6.21.5
vmlinuz -> vmlinuz-huge-2.6.21.5
I ran
Code:

bash-3.1# uname -a
and got this:
Quote:

Linux Slack 2.6.21.5-smp #4 SMP Mon Feb 11 17:13:56 CST 2008 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux
Why am I still running an smp kernel?
I'm assuming there is more I have to do.

My computer can be buggy at times that's why I thought I would try another kernel.

Thanks for help.

sundialsvcs 06-24-2008 11:00 PM

Presumably your distro includes all of these kernels in the distro and allows you to choose between them ... which is something you do at boot time, through the boot loader. Not through symlinks.

Exactly how you do this on your distro depends on your distro. But, surely it is documented.

T3slider 06-24-2008 11:01 PM

You need to reboot first in order for the new kernel to be used, but I'm assuming you already knew that. Check /etc/lilo.conf -- it is possible that it is pointing to the /boot/vmlinuz-huge-smp-2.6.21.5-smp file directly instead of the /boot/vmlinuz symlink. If it is, change it in /etc/lilo.conf to point to the huge non-smp kernel and run `/sbin/lilo` as root to write the changes to the MBR (and then reboot).

I would, however, recommend trying the generic-smp kernel instead of the huge kernel, and if that fails, the generic non-smp kernel. The generic kernel is recommended in CHANGES_AND_HINTS.TXT included on your install CD/DVD or at your favourite mirror. Using the generic-smp kernel requires creating an initrd (initial ramdisk) since the filesystems and some hard drive controllers are built as modules instead of built into the kernel. See /boot/README.initrd for more information. For a nice script that usually outputs the correct mkinitrd command, see here. For more detailed information on switching to the generic-smp kernel, search the forums -- this has been discussed tons of times. Here's why I'm suggesting it:
Quote:

Originally Posted by CHANGES_AND_HINTS.TXT
Use one of the provided generic kernels for daily use. Do not report
bugs until/unless you have reproduced them using one of the stock
generic kernels. You will need to create an initrd in order to boot
the generic kernels - see /boot/README.initrd for instructions.

Quote:

Originally Posted by CHANGES_AND_HINTS.TXT
As stated earlier, it is recommended that you use one of the generic kernels
rather than the huge kernels; the huge kernels are primarily intended as
"installer" and "emergency" kernels in case you forget to make an initrd.
For most systems, you should use the generic SMP kernel if it will run,
even if your system is not SMP-capable. Some newer hardware needs the
local APIC enabled in the SMP kernel, and theoretically there should not be
a performance penalty with using the SMP-capable kernel on a uniprocessor
machine, as the SMP kernel tests for this and makes necessary adjustments.
Furthermore, the kernel sources shipped with Slackware are configured for
SMP usage, so you won't have to modify those to build external modules
(such as NVidia or ATI proprietary drivers) if you use the SMP kernel.

If you decide to use one of the non-SMP kernels, you will need to follow the
instructions in /extra/linux-2.6.24.5-nosmp-sdk/README.TXT to modify your
kernel sources for non-SMP usage. Note that this only applies if you are
using the Slackware-provided non-SMP kernel - if you build a custom kernel,
the symlinks at /lib/modules/$(uname -r)/{build,source} will point to the
correct kernel source so long as you don't (re)move it.

If you decide to use one of the huge kernels anyway, you will encounter
errors like this:
kobject_add failed for uhci_hcd with -EEXIST, don't try to register
These occur because the respective drivers are compiled statically into the
huge kernels but udev tries to load them anyway. These errors should be safe
to ignore, but if you really don't want them to appear, you can blacklist the
modules that try to load in /etc/modprobe.d/blacklist. However, make sure you
remove them from the blacklist if you ever decide to use the (recommended)
generic kernels.

If you do decide to try a non-smp kernel, either the generic or the huge kernel (though I would recommend the generic kernel), you must patch the kernel sources or else things may fail to compile. See here for more information about that.

[edit]I should add that you should probably keep the huge kernel as an option in lilo.conf in case you mess up your initrd, so you can still boot into your system. I personally have two kernel stanzas -- one for the huge-smp and generic-smp kernels. The relevant section of my lilo.conf is shown below:
Code:

image = /boot/vmlinuz-generic-smp-2.6.21.5-smp
  initrd = /boot/initrd.gz
  root = /dev/sda1
  label = Generic
  read-only  # Partitions should be mounted read-only for checking

image = /boot/vmlinuz-huge-smp-2.6.21.5-smp
  root = /dev/sda1
  label = Huge
  read-only

Note that /dev/sda1 above should be changed to point to the root partition of your Slackware installation.[/edit]

T3slider 06-24-2008 11:08 PM

Quote:

Originally Posted by sundialsvcs
Presumably your distro includes all of these kernels in the distro and allows you to choose between them ... which is something you do at boot time, through the boot loader. Not through symlinks.

Exactly how you do this on your distro depends on your distro. But, surely it is documented.

This is almost never true, as far as I know. You can choose a kernel at the bootloader (assuming each desired kernel has an entry in lilo.conf if you use LILO or menu.lst if you use GRUB -- which is not true in Slackware), but in order for that choice to be consistent across reboots (ie the default option, or just an extra option in general if the kernel was not already an option in lilo.conf or menu.lst -- as is the case with Slackware), AT LEAST an edit of lilo.conf or menu.lst is required (or changing a symlink in order for lilo.conf or menu.lst to point to the correct kernel if one of the kernel options points to the symlink). By default, in Slackware, lilo.conf points to /boot/vmlinuz, which is a symlink to /boot/vmlinuz-huge-smp-2.6.21.5-smp. By changing the symlink to /boot/vmlinuz-huge-2.6.21.5, it *is* a valid way to change the kernel that is used upon a reboot. However, the fact that it's not working suggests that lilo.conf is not pointing to the vmlinuz symlink, but instead directly to the kernel image (however, not knowing all of the information, I could be wrong here).

JosephS 06-26-2008 06:47 AM

I made an initrd with the following:

Code:

root@Slack:/boot# mkinitrd -c -k 2.6.21.5-smp -m ext3 -f ext3 -r /dev/hda5
and received the following warning:
Warning: LBA32 addressing assumed

This is what I wrote in lilo.conf:
Quote:

# Linux bootable partition config begins
image = /boot/vmlinuz-generic-smp-2.6.21.5-smp
initrd = /boot/initrd.gz
root = /dev/hda5
label = generic-smp
read-only # Partitions should be mounted read-only for checking

image = /boot/vmlinuz-huge-smp-2.6.21.5-smp
root = /dev/hda5
label = huge-smp
read-only
# Linux bootable partition config ends
When I boot lilo it boots the generic-smp kernel, but it doesn't give an option to boot the huge-smp.
(I am chainloading lilo with grub from my Debian install. Don't think that would make a difference).

Will running the generic kernel limit my access to drivers?

Quote:

If you decide to use one of the non-smp kernels, you will need to follow the instructions in /extra/linux-2.6.24.5-nosmp-sdk/README.TXT to modify your kernel sources for non-smp usage.
I read the instructions about running a non smp kernel. I'm not sure what to do. Do I need to compile one or could I use vmlinuz-generic-2.6.21.5 from the /boot directory?

Thanks for help.

T3slider 06-26-2008 11:31 AM

Quote:

Originally Posted by JosephS
and received the following warning:
Warning: LBA32 addressing assumed

That warning is safe. If you want to get rid of it, you should put "lba32" in the global section of your lilo.conf (see `man lilo.conf` for more information). It just means that it is defaulting to lba32 since you didn't specify it yourself.
Quote:

Originally Posted by JosephS
When I boot lilo it boots the generic-smp kernel, but it doesn't give an option to boot the huge-smp.
(I am chainloading lilo with grub from my Debian install. Don't think that would make a difference).

That is very strange. Try running `/sbin/lilo` again and make sure it adds both generic-smp and huge-smp. Your lilo.conf entry looks fine for both, so it should allow you to select either one. You could try pressing Tab at the LILO boot prompt to see what happens. You should post your entire lilo.conf in case something strange is happening at the top.
Quote:

Originally Posted by JosephS
Will running the generic kernel limit my access to drivers?

No. All of the drivers are still available -- most of them are just compiled as modules that need to be loaded into the running kernel. This is usually done automatically for most modules, but you can manually load a module using `modprobe modulename`. If you want a module to be loaded at every boot that isn't being loaded automatically, you can add an entry to /etc/rc.d/rc.modules-2.6.21.5-smp.
Quote:

Originally Posted by JosephS
I read the instructions about running a non smp kernel. I'm not sure what to do. Do I need to compile one or could I use vmlinuz-generic-2.6.21.5 from the /boot directory?

I would recommend that you stick with the generic-smp kernel anyway (as you are doing now, it appears), but if you insist on using the generic, non-smp kernel, you can do so without compiling anything. You would add an entry in lilo.conf for /boot/vmlinuz-generic-2.6.21.5, and create an initrd as before. The following line would probably work:
Code:

# mkinitrd -c -k 2.6.21.5 -m ext3 -f ext3 -r /dev/hda5
After booting into the system with the non-smp kernel, if you still insist on using it, you would have to follow these instructions to patch the kernel sources to the non-smp kernel. This does NOT require you to compile anything. You may also need to install the non-smp kernel headers package (the document linked above says that it *may* be required), so I would do it anyway. You would need to download the linux-2.6.21.5-smp-to-nosmp.diff.gz and patch-to-non-smp.sh files to a directory, navigate to that directory in a terminal, and run the following:
Code:

# ./patch-to-non-smp.sh
That will reconfigure your sources for the non-smp kernel. Again, no compiling is needed. To install the kernel headers package, download kernel-headers-2.6.21.5-i386-2.tgz and run the following:
Code:

# installpkg kernel-headers-2.6.21.5-i386-2.tgz

JosephS 06-27-2008 07:21 AM

Thanks for help.

I found why I wasn't getting the choice of kernels to boot. I had to uncomment #prompt

I think I will stick with the generic-smp. I think my problems are probably related to something else besides the kernel. I will probably
re-install (upgrade to 12.1) and see if that helps.

Can I use the initrd I made on an install of slackware 12.1?

T3slider 06-27-2008 11:25 AM

Quote:

Originally Posted by JosephS
Can I use the initrd I made on an install of slackware 12.1?

Unfortunately, no. The initrd is set up to use the modules for a specific kernel (in this case the 2.6.21.5-smp kernel modules located at /lib/modules/2.6.21.5-smp). You can, however, use the same command to generate the initrd, substituting 2.6.21.5-smp for 2.6.24.5-smp, as shown below:
Code:

# mkinitrd -c -k 2.6.24.5-smp -m ext3 -f ext3 -r /dev/hda5
That will automatically overwrite the old initrd (because the -c flag is used) and the only change you would have to make in /etc/lilo.conf would be changing the "image =" line to reflect the location of the new kernel (image = /boot/vmlinuz-generic-smp-2.6.24.5-smp). The same should be done with the entry for the huge-smp kernel, of course (and don't forget to run /sbin/lilo after editing lilo.conf).


All times are GMT -5. The time now is 02:47 AM.