By [[NickWarne]]

Original 3rd February, 2004

Following on from this documentation from Thomer Gil -

2.6.x kernel upgrade on Redhat systems

- here are a few more things I had to do when updating my Redhat 7.1 system (current status before I started this was fully up2dated to 2.4.28-7 and system binaries at the close of RH 'demo accounts') to 2.6.1 source code writing, 2.6.5 stable has been released.

The kernel documentation doesn't say a lot about the Redhat tweaked GCC compiler, but I used and built sucessfully with the latest Redhat GCC release for 7.1/7.2:

 [[root@Linux233|/root]]# gcc -v
 Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
 gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.1)

Chicken and the egg update. I have since built:

 [[root@Linux233|init.d]]# gcc -v
 Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.3/specs
 gcc version 2.95.3 20010315 (release)

from the RH GCC with no problems.

After following the above instructions from Thomer Gil's site, I rebooted into the new kernel... and found that I had to do a little bit more.

Firstly, in the instructions for the sysfs filesystem set-up, in /etc/init.d/halt halt_get_remaining() I have a different version.

instead of:

 awk '$2 ~ /^\/$|^\/proc|^\/dev/{next}

I have:

 awk '!/(^#|proc|loopfs|autofs|^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts

This needs to be changed thus:

 awk '!/(^#|proc|loopfs|sys|autofs|^none|^\/dev\/root| \/ )/ {print $2}' /proc/mounts

Secondly, I had to edit /etc/rc.sysinit (which is a symlink to /etc/rc.d/rc.sysinit! so back-up the real file first!) to include the renaming of all 'proc/ksyms' to 'proc/kallsyms' even though I do not use hotplug - this is an easy item to miss from the above 'how-to' if you are NOT looking at the hotplug stuff - it has to be done anyway.

Next, Netfilter ipt_unclean rules are now not used (they were always experimental, so I presumed failed the test and were taken out of the 2.6.x kernels). If your firewall has rules to use these, you will have to remove the chain[s] otherwise the kernel will try to load the modules at boot when the firewall starts - and fail, of course as no such modules now exist.

If you use mii-tool to adjust NIC parameters, it may be broken (as in my case). Simply installing ethtool and using in lieu is suffice (and perhaps better, as ethtool seems a lot more powerful).

Also in the logs when booting you will see this:

 kernel: warning: process `update' used the obsolete bdflush system call

'update' is the service that runs bdflush() to keep the disk[s] clean - this is now obsolete in the 2.6.x series kernels as they use kernel controlled pdflush. This took me a while to track down where RH systems start this.

in /etc/inittab simply comment out this line:

 #Things to run in every runlevel.
 #Nick - bdflush () depreciated in 2.6.x

'update' will now not run, and the logs are clean.

Several more RedHat gotcha's.

If you have updated various tools to the latest GNU releases, and selected the default install location ( /usr/local/bin/ ), and then have this location in your $PATH first, all is hunky dory - BUT RedHat crond jobs seem to hard code the location of certain binaries (AWK is one), thus the old version(s) is/are used.

To fix, simply:

  1. cd /usr/bin/
  2. mv awk awkORIG
  3. ln -s /usr/local/bin/gawk awk

will save old binary as 'awkORIG', and create a new symlink to the new GNU version (awk is really a symlink to gawk anyway). Do this with whatever else appears to be hard coded in the RedHat scripts.

An update on this.

It seems most services found in /etc/init.d/ always source the 'functions' script. Looking closer, the 'functions' script define an EXPORT thus:

 # First set up a default search path.
 export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"

Changing this to:

 # First set up a default search path.
 export PATH="/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin"

pushes the /usr/local/bin/ directory to the top of search path, thus running the newer versions of the GNU tools and processes.

Look at /etc/init.d/ (xinit/inet/init - on RH versions) to do similar changes to the export PATH $var.

As an aside, if you run a 2.2.x kernel, look in /etc/rc.d/init.d to do the same changes if you updated the tools for that kernel.

Finally I was getting spammed in the boot logs from 'named' and it's controller 'rndc':

 process `named' is using obsolete setsockopt SO_BSDCOMPAT

Now, it turns out SO_BSDCOMPAT is an obsolete define in later kernels, and this is an error generated from the bind process.

So I decided to get the latest bind source code 9.2.3, fix the error, and rebuild.

After unpacking, the code to change will be found in /lib/isc/unix/socket.c

First, locate this (around line 1297):

 #if defined(USE_CMSG) || defined(SO_BSDCOMPAT)
        int on = 1;

and change to this (i.e. remove the reference to SO_BSDCOMPAT)

 #if defined(USE_CMSG)
        int on = 1;
And then locate the subroutine (around line 1384):

        if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
                       (void *)&on, sizeof on) < 0) {
                isc__strerror(errno, strbuf, sizeof(strbuf));
                UNEXPECTED_ERROR(__FILE__, __LINE__,
                                 "setsockopt(%d, SO_BSDCOMPAT) %s: %s",
                                 isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
                                                ISC_MSG_FAILED, "failed"),

                /* Press on... /*

and comment out all of that routine completely:

 /* Nick &#35;ifdef SO_BSDCOMPAT
        if (setsockopt(sock->fd, SOL_SOCKET, SO_BSDCOMPAT,
                       (void *)&on, sizeof on) < 0) {
                isc__strerror(errno, strbuf, sizeof(strbuf));
                UNEXPECTED_ERROR(__FILE__, __LINE__,
                                 "setsockopt(%d, SO_BSDCOMPAT) %s: %s",
                                 isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
                                                ISC_MSG_FAILED, "failed"),
                Press on...
 End Nick */

Build, install... and the warnings stop.

On more 'gotcha' with this version of bind I found on Redhat. It tries to put the file in /var/run/ , but as 'root' owns that, 'named' does not have the permissions to create it.

So, in your named.conf, add

pid-file "/var/run/named/";

this to the

 options {


... section and the pid file will now go where it did before the upgrade.

Another RedHat 8 Gotcha
If your /etc/sysinit.rc tries to mount usbdevfs like mine did, it will find that usbdevfs doesn't exist any more. Just change the instances of usbdevfs to usbfs. Then your /proc/bus/usb will have stuff in again and USB will work.

LinuxHints/RedHat 2.4 To 2.6 Kernel Upgrade (last edited 2009-01-22 16:10:05 by 86)