?
Solved

Kernel 2.6.5 and gcc-3.3.1

Posted on 2004-11-19
18
Medium Priority
?
399 Views
Last Modified: 2013-12-15
I've successfully compiled and run a 2.6.5 kernel built with GCC 2.95.3.  Now I need the same kernel compiled with GCC-3.0x   So, I've built the 2.6.5 kernel using GCC-3.3.1.    It boots
okay until module loading and then:
 
modprobe:FATAL:Error inserting unix.ko  Invalid module format  and so on..................
 
This seems to point to the modules being built with a different gcc, which is impossible.
I know 2.95.3 is recommended for 2.6, but threr are many instances of successful building with gcc-3.0x.  What's going on here?   I have the correct module loader for 2.6.

MAC    
0
Comment
Question by:cliffhanger121599
  • 10
  • 8
18 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 12631564
Have you verified that the module in question in /lib/modules is the version built by Gcc 3.x? Compare the checksum of the file in /lib/modules with that of the file in the kernel source tree.
0
 

Author Comment

by:cliffhanger121599
ID: 12633184
<Have you verified that the module in question in /lib/modules is the version built by Gcc 3.x?>

I have now.  They're identical.  

Another error message I'm getting is:

unix: ver magic 2.6.5 Pentium III gcc-3.3 should be 2..6.5 Pentium III gcc-2.95
0
 

Author Comment

by:cliffhanger121599
ID: 12633303
I've just built a non-modulized 2.6.5 with 3.3.1 and it works fine, just to verify it's a module problem.

I wasn't aware the /lib/modules dir. was necessary with a non-modulized kernel?

Could just carry on unless you fell like tracking this problem down?

MAC
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 40

Expert Comment

by:jlevie
ID: 12634878
As far as I know, Gcc 3.x should build any kernel from kernel.org since 2.4. And since you've verified that the module in question is valid I'd supect the modprobe version. Was this Linux one that shipped with a 2.6 kernel?
0
 

Author Comment

by:cliffhanger121599
ID: 12650155

I think the problem lies in the kernel version being reported by the system, i.e. by uname -r.    I have just upgraded the kernel again to 2.6.9(non-modulized) and built it with 3.3.1, but 'uname -r' is reporting I'm still using a 2.6.5 kernel.   And it is reporting the kernel as being bulit with gcc-2.95.3 when I know it isn't.

Therefore when modprobe tries to load modules, it seems to be trying to do it from the previous kernel, hence the error messages.

Does any of this make any sense and is it possible?

MAC
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12650566
That would explain it. In that case it would be trying to load a module from /lib/modules/2.6.5.

What does /boot contain?
0
 

Author Comment

by:cliffhanger121599
ID: 12659378
file:/boot/System.map
file:/boot/boot-bmp.b
file:/boot/boot-menu.b
file:/boot/boot-text.b
file:/boot/boot.0300
file:/boot/boot.b
file:/boot/bzImage
file:/boot/chain.b
file:/boot/logo64a.bmp
file:/boot/map
file:/boot/mbr.b
file:/boot/os2_d.b
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12659948
What Linux is this?

When you copied the latest kernel to /boot (I assume it is in bzimage) did you also copy the new System.map to /boot?
0
 

Author Comment

by:cliffhanger121599
ID: 12669271
I was afraid you would ask that - LFS

I have been running the system for many years without problems and have compiled many kernels.   Never had these problems before.

Absolutely, got the new System.map.

I understand the kernel version that uname uses  in the Makefile under the kernel source?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12683178
> I understand the kernel version that uname uses  in the Makefile under the kernel source?

That version information would be compiled into the kernel. uname gets the version info vi a kernel function call. You can do an strace on uname and see that it doesn't open any file directly realated to the kernel, Makefile, etc.

Are you booting via lilo or Grub? And if lilo did you execute 'lilo' to update the MBR after the kernel update?
0
 

Author Comment

by:cliffhanger121599
ID: 12685161
>Are you booting via lilo or Grub? And if lilo did you execute 'lilo' to update the MBR after the kernel update?

Lilo

I always run lilo after a kernel update.   The kernel wouldn't boot otherwise aad this one does. It just refuses to load modules correctly hence the error messages.
 
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12692330
Since the kernel version is pulled via a syscall from the running kernel the only way I can see for you to get the wrong kernel reported via uname is if the old kernel is booted. That would explain the module load error and is why I asked about lilo. If you had not run 'lilo', or it failed to update the MBR, the old kernel would have booted.

I'd suggest verifying that /boot/bzImage is the correct kernel and run 'lilo -v' to see what's happening.
0
 

Author Comment

by:cliffhanger121599
ID: 12730806
This is driving me to distraction.

I know I'm booting the correct kernel - I am backing up the old kernel and system.map and copying the new kernel and system.map into /boot and then running lilo to update the MBR.

I know I'm compiling with gcc-3.3.1 because that is the only compiler present.   Despite this when I run either uname -r or cat /proc/version I'm getting not only showing the wrong kernel, but the WRONG compiler used.

For example I compile and install a 2.6.9 kernel with 3.3.1.   I reboot and cat /proc/version says:

Linux version 2.6.5 (root@Cliffhangers) (gcc version 2.95.3 20010315 (release)) #1 Sat Nov 6 21:48:38 Europe/London
 2004

uname -r says: 2.6.5

What's going on?  

0
 

Author Comment

by:cliffhanger121599
ID: 12731371
Another thing

I run depmod 2.6.9 after installing the new kernel, then depmod -a and

WARNING: Couldn't open directory /lib/modules/2.6.5: No such file or directory
FATAL: Could not open /lib/modules/2.6.5/modules.dep.temp for writing: No such file or directory
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12731477
All of that tells me that the reboot is still booting from the old kernel. And that means that when you execute lilo it isn't doing "the right thing". The depmod error is understandable when you realize that it will look at the running kernel to figure out which modules dir to use.
0
 

Author Comment

by:cliffhanger121599
ID: 12743510
Stupid question maybe.  

How am I booting from the old kernel if it no longer exists, i.e. if I have either backed it up or moved it elsewhere?
0
 
LVL 40

Accepted Solution

by:
jlevie earned 2000 total points
ID: 12745000
I'll confess to having never looked in the Lilo code to see exactly how it works, so what follows is conjecture.

I don't believe that lilo embeds any sort of file name reference in the MBR, by rather it uses some sort of direct disk addressing to find the kernel. If that is the case it could still boot the old kernel because that data could still exist at its original disk location, even though you've deleted the file or moved it elsewhere. A delete or move within a single file system only operates on the inode of the file, not the actual file data. A move across file systems is copy & delete so again only an inode change occurs on the original file.

What I'd suggest that you try is to set up lilo with a boot choice. The old kernel and the new as separate boot choices, which is good practice when building kernels.  This means that you'll want to name your kernels something other than just vmlinuz, perhaps vmlinux-2.6.9, etc.
0
 

Author Comment

by:cliffhanger121599
ID: 12747629
The problems solved, many thanks.

I have a duel boot system and I believe, or now know, that there is a problem with the FAT in windoze.   I have now taken windoze out of the lilo.

Prior to your suggestion about a boot choice I had already set
the the source of the new
kernelto '/usr/src/linux/arch/i386/boot/bzImage' but it made no difference UNTIL I removed windoze from the boot choice.

Everything has now come good inc. uname -r etc.

thanks again

MAC
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question