[K12OSN] depmod in chroot?

Jeff Siddall news at siddall.name
Thu Sep 8 14:49:57 UTC 2011

On 09/08/2011 10:25 AM, Jomegat wrote:
> On 09/08/2011 09:58 AM, Jeff Siddall wrote:
>> I have an x86_64 server with i686 clients. I run the chroot inside
>> linux32 which does the trick for most things architecture related.
>> However, I tried compiling and installing a chroot kernel module and had
>> problems. Looks like autoconfig uses `uname -r` in a number of places
>> and and of course that is the one place that still references x86_64. I
>> was able to manually hack the Makefile and got the module compiled.
>> However, the install process runs depmod -a and it is still looking for
>> an x86_64 folder which of course does not exist.
>> Any ideas how to get an i686 chroot kernel module installed on an x86_64
>> server?
> Do this as root:
> cd /opt/ltsp/i386
> setarch i386 chroot .
> uname -a
> That should now say i686 rather than x86_64.

Not really:

# cd /opt/ltsp/i386
# setarch i386 chroot .
bash-4.1# uname -a
Linux hostname 2.6.32-131.6.1.el6.x86_64 #1 SMP Tue Jul 12 17:14:50 CDT 
2011 i686 i686 i386 GNU/Linux

Yes, the machine hardware shows i686:

bash-4.1# uname -m

But the kernel still shows x86_64:

bash-4.1# uname -r

And depmod is, predictably, looking at the running kernel:

bash-4.1# depmod -a
WARNING: Couldn't open directory /lib/modules/2.6.32-131.6.1.el6.x86_64: 
No such file or directory
FATAL: Could not open 
/lib/modules/2.6.32-131.6.1.el6.x86_64/modules.dep.temp for writing: No 
such file or directory

However, after some more reading I discovered it is possible to override 
the running kernel by adding a specific version as a parameter.  Not 
sure how I missed that when googling.  I guess I was searching for 
"arch" instead of "version".  Anyway, problem solved for now.

Still, if anyone knows a way to override what uname -r returns so that 
cross-compiling "just works" in the chroot that would be a lot nicer.

More information about the K12OSN mailing list